-
Notifications
You must be signed in to change notification settings - Fork 16
/
admin_system_panel.jinja2
77 lines (74 loc) · 4.21 KB
/
admin_system_panel.jinja2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{% extends "sitebase.jinja2" %}
{% set page_title = _("ADMINISTRATOR SYSTEM PANEL") %}
{% set show_breadcrumbs = False %}
{% block head %}
<script>
$(function(){
to_class = function(choice){ return ["alert", "alert-"+choice]; }
update_test_msg();
select_class("#system_msg_style", "#test_msg", to_class);
});
function update_test_msg() {
let msg_text_field = document.system_msg_form.system_msg_text;
let msg_hours_field = document.system_msg_form.system_msg_hours;
let msg_mins_field = document.system_msg_form.system_msg_minutes;
if(msg_text_field.selectedIndex < 1) {
document.getElementById("test_msg").innerHTML = "";
} else {
if (msg_text_field.options[msg_text_field.selectedIndex].value == "going_down") {
msg_hours_field.disabled = false;
msg_mins_field.disabled = false;
document.getElementById("test_msg").innerHTML = msg_text_field.options[msg_text_field.selectedIndex].text + " " + msg_hours_field.options[msg_hours_field.selectedIndex].text + ":" + msg_mins_field.options[msg_mins_field.selectedIndex].text.padStart(2,'0');
} else {
msg_hours_field.disabled = true;
msg_mins_field.disabled = true;
document.getElementById("test_msg").innerHTML = msg_text_field.options[msg_text_field.selectedIndex].text;
}
}
}
</script>
{% endblock %}
{% block content %}
<h4> {{ _('Set System Message') }} </h4>
<div id="test_msg" class="alert alert-{{system_msg_style|e}}" role="alert">
{% if system_msg_text %}
{{system_msg_dictionary[system_msg_text][_(EN_US_KEY)]}}
{% endif %}
</div>
<form method="post" id="system_msg_form" name="system_msg_form">
<div class="form-group row">
<label for="system_msg_text" name="system_msg_label" class="col-sm-2 col-form-label">{{ _('System Message') }}:</label>
<div class="col-sm-8">
System Message Class:
<select id="system_msg_style" name="system_msg_style" class="form-control" required>
<option value="primary" {% if system_msg_style == "primary" %} selected {% endif %}>{{ _('primary') }}</option>
<option value="secondary" {% if system_msg_style == "secondary" %} selected {% endif %}>{{ _('secondary') }}</option>
<option value="success" {% if system_msg_style == "success" %} selected {% endif %}>{{ _('success') }}</option>
<option value="danger" {% if system_msg_style == "danger" %} selected {% endif %}>{{ _('danger') }}</option>
<option value="warning" {% if system_msg_style == "warning" %} selected {% endif %}>{{ _('warning') }}</option>
<option value="info" {% if system_msg_style == "info" %} selected {% endif %}>{{ _('info') }}</option>
<option value="light" {% if system_msg_style == "light" %} selected {% endif %}>{{ _('light') }}</option>
<option value="dark" {% if system_msg_style == "dark" %} selected {% endif %}>{{ _('dark') }}</option>
</select><br />
System Message Text:
<select id="system_msg_text" name="system_msg_text" class="form-control" onChange="update_test_msg()">
<option value="">--None--</option>
{% for key, value in system_msg_dictionary.items() %}
<option value="{{ key }}">{{ value[_(EN_US_KEY)] }}</option>
{% endfor %}
</select><br />
Shutdown Time Hours: <select id="system_msg_hours" name="system_msg_hours" class="form-control" onChange="update_test_msg()">
{% for i in range(24) %}
<option value="{{ i }}">{{ i }}</option>
{% endfor %}
</select><br />
Shutdown Time Minutes: <select id="system_msg_minutes" name="system_msg_minutes" class="form-control" onChange="update_test_msg()">
{% for i in range(60) %}
<option value="{{ i }}">{{ i }}</option>
{% endfor %}
</select><br />
</div>
</div>
<button type="submit" class="btn btn-primary">{{ _('Set System Message') }}</button>
</form>
{% endblock %}