-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
feature_toggles.html
72 lines (59 loc) · 2.37 KB
/
feature_toggles.html
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
---
layout: basic
---
<div class="w3-container w3-padding"> </div>
<div class="w3-row">
<div class="w3-quarter w3-container">
</div>
<div class="w3-half w3-container">
<div class="w3-card-4 w3-dark-grey">
<header class="w3-container w3-black w3-text-white">
<h2>Feature Toggles</h2>
<div class="w3-margin-left">
<p>These features can be enabled for testing or to get an early preview;<br/>however, as they are still in development, may break without warning.</p>
<p>Proceed with caution.</p>
</div>
</header>
<div class="w3-container">
{% for toggle in site.data.feature_toggles %}{% unless toggle.hidden %}
<div class="w3-row-padding w3-padding-large {% unless forloop.first %}w3-border-top{% endunless %}" title="{{ toggle.description }}">
<div class="w3-col s2">
<div class="w3-bar-item">
<label class="rounded_switch" >
<input type="checkbox" id="chbox_{{toggle.code_key}}" class="js_chbox"
name="{{toggle.code_key}}" {% if toggle.default %}checked{% endif %}>
<span class="slider round"></span>
</label>
</div>
</div>
<div class="w3-col s10">{{ toggle.name }}</div>
</div>{% endunless %}
{% endfor %}
</div>
<footer class="w3-container w3-black w3-text-white">
<span id="message"></span>
</footer>
</div>
</div>
<div class="w3-quarter w3-container">
</div>
</div>
<script>
function init() {
for (const property in FEATURE_TOGGLES) {
var _value = FEATURE_TOGGLES[property];
console.log(`Toogle: ${property}\nValue: ${_value}`);
$(`#chbox_${property}`).prop('checked', _value);
}
$('.js_chbox').change(set_toggle);
}
$(window).load(init);
function set_toggle() {
_debug_log("Setting toggle for", $(this));
var toggle = $(this).attr("name");
var value = $(this).prop('checked');
set_feature_toggle(toggle, value);
}
</script>