easyctf-2017/web/pages/admin/settings.html
2016-04-19 11:00:43 -04:00

33 lines
1.1 KiB
HTML

<div>
<h1>CTF Settings</h1>
<div ng-if="settings">
<div id="settings_msg"/>
<form class="form-horizontal" onsubmit="update_settings(); return false;" id="update_settings_form">
<input class="form-control" name="ctf_begin" placeholder="CTF Start time (seconds)" value="{{ settings['ctf_begin'] }}" required/>
<br>
<input class="form-control" name="ctf_end" placeholder="CTF End time (seconds)" value="{{ settings['ctf_end'] }}"required/>
<br>
<input type="submit" class="btn btn-success" value="Update"/>
</form>
</div>
</div>
<script>
var update_settings = function() {
var input = "#update_settings_form form input";
var data = $("#update_settings_form").serializeObject();
$(input).attr("disabled", "disabled");
api_call("POST", "/api/settings/update", data, function(result) {
if (result["success"] == 1) {
display_message("settings_msg", "success", result["message"], function() {
$(input).removeAttr("disabled");
});
} else {
display_message("settings_msg", "danger", result["message"], function() {
$(input).removeAttr("disabled");
});
console.log(result["error"]);
}
});
}
</script>