Black config_json. Add feedback on submit

This commit is contained in:
Andrew 2023-01-18 18:00:50 -05:00
parent ba415c1168
commit 868b324547

View File

@ -69,7 +69,9 @@
$(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>
@ -93,12 +95,12 @@
<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>&nbsp;<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();
}, },
}); });
}); });