Sfoglia il codice sorgente

Apply the timepicker to dashboard's time fields.

We currently don't have any time fields in Oscar's stock dashboard.
But this change facilitates customising them if added, and makes good
sense as we already support datetime and date fields.
master
Markus Bertheau 12 anni fa
parent
commit
33c756f5d3
1 ha cambiato i file con 12 aggiunte e 0 eliminazioni
  1. 12
    0
      oscar/static/oscar/js/oscar/dashboard.js

+ 12
- 0
oscar/static/oscar/js/oscar/dashboard.js Vedi File

@@ -130,6 +130,18 @@ var oscar = (function(o, $) {
130 130
                         'stepMinute': $ele.data('stepminute')});
131 131
                     $ele.datetimepicker(config);
132 132
                 });
133
+
134
+                var defaultTimepickerConfig = {
135
+                    'timeFormat': o.dashboard.options.timeFormat,
136
+                    'stepMinute': o.dashboard.options.stepMinute
137
+                };
138
+                $('input[name$="time"]').not('input[name$="datetime"]').each(function(ind, ele) {
139
+                    var $ele = $(ele),
140
+                        config = $.extend({}, defaultTimepickerConfig, {
141
+                        'timeFormat': $ele.data('timeformat'),
142
+                        'stepMinute': $ele.data('stepminute')});
143
+                    $ele.timepicker(config);
144
+                });
133 145
             }
134 146
         },
135 147
         initWYSIWYG: function() {

Loading…
Annulla
Salva