mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Black config_json. Add feedback on submit
This commit is contained in:
parent
ba415c1168
commit
868b324547
@ -69,10 +69,12 @@
|
|||||||
$(this).removeAttr('selected').prop('selected', false);
|
$(this).removeAttr('selected').prop('selected', false);
|
||||||
});">Enable all Languages</button>
|
});">Enable all Languages</button>
|
||||||
|
|
||||||
<textarea id="disabled_lang" name="{{item[0]}}" class="form-control list hidden" rows="{{ len(data['all_languages']) }}" value="{{','.join(item[1])}}" hidden>{{','.join(item[1])}}</textarea>
|
<textarea id="disabled_lang" name="{{item[0]}}" class="form-control list hidden"
|
||||||
|
rows="{{ len(data['all_languages']) }}" value="{{','.join(item[1])}}"
|
||||||
|
hidden>{{','.join(item[1])}}</textarea>
|
||||||
{% elif isinstance(item[1], list) %}
|
{% elif isinstance(item[1], list) %}
|
||||||
<textarea value="{{','.join(item[1])}}" type="text" name="{{item[0]}}"
|
<textarea value="{{','.join(item[1])}}" type="text" name="{{item[0]}}"
|
||||||
class="form-control list">{{','.join(item[1])}}</textarea>
|
class="form-control list">{{','.join(item[1])}}</textarea>
|
||||||
{% elif isinstance(item[1], bool) %}
|
{% elif isinstance(item[1], bool) %}
|
||||||
{% if item[1] == True %}
|
{% if item[1] == True %}
|
||||||
<div style="margin-left: 30px;">
|
<div style="margin-left: 30px;">
|
||||||
@ -91,14 +93,14 @@
|
|||||||
{% end %}
|
{% end %}
|
||||||
{% elif isinstance(item[1], int) %}
|
{% elif isinstance(item[1], int) %}
|
||||||
<input type="number" class="form-control" name="{{item[0]}}" id="{{item[0]}}" value="{{ item[1] }}"
|
<input type="number" class="form-control" name="{{item[0]}}" id="{{item[0]}}" value="{{ item[1] }}"
|
||||||
step="1" min="0" required>
|
step="1" min="0" required>
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="text" class="form-control" name="{{item[0]}}" id="{{item[0]}}" value="{{ item[1] }}" step="2"
|
<input type="text" class="form-control" name="{{item[0]}}" id="{{item[0]}}" value="{{ item[1] }}"
|
||||||
min="0" required>
|
step="2" min="0" required>
|
||||||
{% end %}
|
{% end %}
|
||||||
</div>
|
</div>
|
||||||
{% end %}
|
{% end %}
|
||||||
<button class="btn btn-success" type="submit">Submit</button>
|
<button class="btn btn-success" type="submit">Submit</button> <span id="submit-status"></span>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -133,6 +135,7 @@
|
|||||||
var token = getCookie("_xsrf")
|
var token = getCookie("_xsrf")
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
$("#submit-status").html('<i class="fa fa-spinner fa-spin"></i>');
|
||||||
/* Convert multiple select to text list */
|
/* Convert multiple select to text list */
|
||||||
let selected_Lang = $('#lang_select').val();
|
let selected_Lang = $('#lang_select').val();
|
||||||
$('#disabled_lang').val(selected_Lang);
|
$('#disabled_lang').val(selected_Lang);
|
||||||
@ -147,12 +150,11 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
headers: { 'X-XSRFToken': token },
|
headers: { 'X-XSRFToken': token },
|
||||||
dataType: "json",
|
dataType: "text",
|
||||||
url: '/panel/config_json',
|
url: '/panel/config_json',
|
||||||
data: form_json,
|
data: form_json,
|
||||||
success: function () {
|
success: function (data) {
|
||||||
console.log("in reload")
|
$("#submit-status").html('<i class="fa fa-check"></i>');
|
||||||
window.location.reload();
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user