From eaa266ec50dc0c1d35b24f70bf8480c76493ad87 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Wed, 28 Oct 2015 14:33:25 +0100 Subject: [PATCH] use own template for datepicker for Icons --- .../app/controllers/_ui_element/date.coffee | 3 + .../controllers/_ui_element/datetime.coffee | 3 + .../app/lib/bootstrap/bootstrap-datepicker.js | 10 +-- .../app/views/generic/datepicker.jst.eco | 71 +++++++++++++++++++ 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 app/assets/javascripts/app/views/generic/datepicker.jst.eco diff --git a/app/assets/javascripts/app/controllers/_ui_element/date.coffee b/app/assets/javascripts/app/controllers/_ui_element/date.coffee index 79320e14b..841b94adc 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/date.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/date.coffee @@ -10,6 +10,9 @@ class App.UiElement.date attribute: attribute ) ) + # set our custom template + $.fn.datepicker.defaults.template = App.view('generic/datepicker')() + # apply date widgets $.fn.datepicker.dates['custom'] = days: [App.i18n.translateInline('Sunday'), App.i18n.translateInline('Monday'), App.i18n.translateInline('Tuesday'), App.i18n.translateInline('Wednesday'), App.i18n.translateInline('Thursday'), App.i18n.translateInline('Friday'), App.i18n.translateInline('Saturday'), App.i18n.translateInline('Sunday')], diff --git a/app/assets/javascripts/app/controllers/_ui_element/datetime.coffee b/app/assets/javascripts/app/controllers/_ui_element/datetime.coffee index 9419a5e17..a3b8a4069 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/datetime.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/datetime.coffee @@ -10,6 +10,9 @@ class App.UiElement.datetime attribute: attribute ) ) + # set our custom template + $.fn.datepicker.defaults.template = App.view('generic/datepicker')() + # apply date widgets $.fn.datepicker.dates['custom'] = days: [App.i18n.translateInline('Sunday'), App.i18n.translateInline('Monday'), App.i18n.translateInline('Tuesday'), App.i18n.translateInline('Wednesday'), App.i18n.translateInline('Thursday'), App.i18n.translateInline('Friday'), App.i18n.translateInline('Saturday'), App.i18n.translateInline('Sunday')], diff --git a/app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js b/app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js index 3f58995c7..fd482de40 100755 --- a/app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js +++ b/app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js @@ -24,7 +24,7 @@ Zammad Edits: - fix todayBtn toggle of display none and block: toggleClass instead - - [ICONS]: hardwire our icons + - allow custom template as options parameter */ @@ -122,7 +122,9 @@ if (this.component && this.component.length === 0) this.component = false; - this.picker = $(DPGlobal.template); + console.log("bootstrap", this.o.template); + + this.picker = $(this.o.template || DPGlobal.template); this._buildEvents(); this._attachEvents(); @@ -1868,9 +1870,9 @@ ''+ ''+ ''+ - ''+ + '«'+ ''+ - ''+ + '»'+ ''+ '', contTemplate: '', diff --git a/app/assets/javascripts/app/views/generic/datepicker.jst.eco b/app/assets/javascripts/app/views/generic/datepicker.jst.eco new file mode 100644 index 000000000..0d464a7d6 --- /dev/null +++ b/app/assets/javascripts/app/views/generic/datepicker.jst.eco @@ -0,0 +1,71 @@ +
+
+ + + + + + + + + + + + + + + + + + + + +
<%- @Icon('arrow-left') %><%- @Icon('arrow-right') %>
+
+
+ + + + + + + + + + + + + + + + + + + + +
<%- @Icon('arrow-left') %><%- @Icon('arrow-right') %>
+
+
+ + + + + + + + + + + + + + + + + + + + +
<%- @Icon('arrow-left') %><%- @Icon('arrow-right') %>
+
+
\ No newline at end of file