Просмотр исходного кода

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 лет назад
Родитель
Сommit
33c756f5d3
1 измененных файлов: 12 добавлений и 0 удалений
  1. 12
    0
      oscar/static/oscar/js/oscar/dashboard.js

+ 12
- 0
oscar/static/oscar/js/oscar/dashboard.js Просмотреть файл

@@ -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() {

Загрузка…
Отмена
Сохранить