From 0745a7aa9ac6447d9c3e5c8d48e3676cd6eab4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Sun, 13 Sep 2015 04:43:59 +0200 Subject: [PATCH] Advancing on rule editing --- .../uds/static/adm/js/gui-d-calendar.coffee | 3 +- server/src/uds/static/adm/js/gui-tools.coffee | 16 +++- .../uds/admin/tmpl/calendar_rule.html | 83 ++++++++++++++++--- 3 files changed, 84 insertions(+), 18 deletions(-) diff --git a/server/src/uds/static/adm/js/gui-d-calendar.coffee b/server/src/uds/static/adm/js/gui-d-calendar.coffee index 7b641896a..bdef326ae 100644 --- a/server/src/uds/static/adm/js/gui-d-calendar.coffee +++ b/server/src/uds/static/adm/js/gui-d-calendar.coffee @@ -48,13 +48,14 @@ gui.calendars.link = -> realFnc = (value, refreshFnc) -> api.templates.get "calendar_rule", (tmpl) -> content = api.templates.evaluate(tmpl, + days: (w.substr(0, 3) for w in weekDays) ) modalId = gui.launchModal((if value is null then gettext("New rule") else gettext("Edit rule")), content, actionButton: "" ) gui.tools.applyCustoms modalId $(modalId + " .button-accept").click -> - alert('Save') + alert('Save') if forEdit is true (value, event, table, refreshFnc) -> diff --git a/server/src/uds/static/adm/js/gui-tools.coffee b/server/src/uds/static/adm/js/gui-tools.coffee index 95cbeaef8..c74267148 100644 --- a/server/src/uds/static/adm/js/gui-tools.coffee +++ b/server/src/uds/static/adm/js/gui-tools.coffee @@ -64,7 +64,10 @@ applyCustoms: (selector) -> # Activate "custom" styles - $(selector + " input:checkbox").bootstrapSwitch() + $.each $(selector + " input:checkbox"), (index, tspn) -> + $tspn = $(tspn) + if $tspn.attr("basic") != "true" + $tspn.bootstrapSwitch() $.each $(selector + " input[type=date]:not([readonly])"), (index, tspn) -> $tspn = $(tspn) @@ -74,11 +77,16 @@ $tspn.val(api.tools.strftime('%Y-12-31')) $tspn.attr("type", "text") - $tspn.parent().datepicker( + + options = format: 'yyyy-mm-dd' container: 'html' - ) - + + if $tspn.attr('clear') == "true" + options.clearBtn = true + + $tspn.parent().datepicker options + # Activate "cool" selects $.each $(selector + " .selectpicker"), (index, tspn) -> $tspn = $(tspn) diff --git a/server/src/uds/templates/uds/admin/tmpl/calendar_rule.html b/server/src/uds/templates/uds/admin/tmpl/calendar_rule.html index a68bf2f6b..82691fbf6 100644 --- a/server/src/uds/templates/uds/admin/tmpl/calendar_rule.html +++ b/server/src/uds/templates/uds/admin/tmpl/calendar_rule.html @@ -1,21 +1,78 @@ {% load i18n html5 %} {% image_size as size %} -
-
- - +
+
+ +
+
+
-
- - +
+ +
+
+
-
- -
- -
+
+ +
+
+ +
+
-
+
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+ {% verbatim %}{{#each days}} + + {{/each}}{% endverbatim %} +
+
+
+ +
+ +
+ +
+
+ +