summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorSean Fridman <fridman@mail.sfsu.edu>2015-06-19 15:29:19 -0400
committerSean Fridman <fridman@mail.sfsu.edu>2015-06-19 15:30:59 -0400
commit27abfdd15714895894565124bcc660b9d6774494 (patch)
tree920db8ec4972e0b8aa24b184d4be986033b2452b /themes
parent5f002254c523bb9651e627c2fbd7d9cd9b021568 (diff)
Add 'flag' data type
Diffstat (limited to 'themes')
-rw-r--r--themes/okadmin/public/js/app.js11
-rw-r--r--themes/okadmin/templates/partials/inputs.liquid13
2 files changed, 23 insertions, 1 deletions
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js
index d58cb2a..4be0afc 100644
--- a/themes/okadmin/public/js/app.js
+++ b/themes/okadmin/public/js/app.js
@@ -181,6 +181,17 @@ var OKAdmin = function(){
$(el).append(normalizedInput)
})
+ // Modify flags checkboxes such that unchecked ones return "false"
+ // instead of nothing
+ $('.property .flag').each(function(i, el) {
+ var input = el.querySelector('input')
+ var checked = !!input.checked
+ if (!checked) {
+ $(input).attr('value', 'false')
+ input.checked = true
+ }
+ })
+
$("ol").each(function(){
$("li", this).each(function(index){
$(this).find("input,textarea").each(function(){
diff --git a/themes/okadmin/templates/partials/inputs.liquid b/themes/okadmin/templates/partials/inputs.liquid
index e766558..9c1a26b 100644
--- a/themes/okadmin/templates/partials/inputs.liquid
+++ b/themes/okadmin/templates/partials/inputs.liquid
@@ -51,7 +51,7 @@
</div>
</div>
- {% elsif type =='date' %}
+ {% elsif type == 'date' %}
<div class="date">
<input name="{{name}}"
@@ -62,6 +62,17 @@
>
</div>
+ {% elsif type == 'flag' %}
+
+ <div class="flag">
+ <input name="{{name}}"
+ type="checkbox"
+ {% if spec.value == 'true' %}
+ checked="true"
+ {% endif %}
+ value="true">
+ </div>
+
{% elsif type == 'tag-list' %}
<div class="tag-list">
<input name="{{name}}"