Commit bd3f11a081537e81aeb7c6aafbbb08be56878ff9
1 parent
56458d00
fix double calendar icon added in case of multiple datetimepicker widgets used
Showing
1 changed file
with
13 additions
and
4 deletions
Show diff stats
web/jQuery/ui-addon/datetimepicker.anubis
| @@ -35,18 +35,27 @@ public define String | @@ -35,18 +35,27 @@ public define String | ||
| 35 | $('.timepicker').datetimepicker({datepicker:false,format:'H:i',step:5}); | 35 | $('.timepicker').datetimepicker({datepicker:false,format:'H:i',step:5}); |
| 36 | " + if add_icon then " | 36 | " + if add_icon then " |
| 37 | var items_add_func = function (index) { | 37 | var items_add_func = function (index) { |
| 38 | - var icon_file = 'icon_calendar.gif'; | ||
| 39 | - var dt_picker = $(this); | 38 | + var icon_file, |
| 39 | + dt_picker = $(this), | ||
| 40 | + icon; | ||
| 40 | 41 | ||
| 42 | + if (dt_picker.hasClass('cxm-icon')) { | ||
| 43 | + return; | ||
| 44 | + } | ||
| 45 | + | ||
| 41 | if (dt_picker.hasClass('timepicker')) { | 46 | if (dt_picker.hasClass('timepicker')) { |
| 42 | icon_file = 'icon_clock.gif'; | 47 | icon_file = 'icon_clock.gif'; |
| 48 | + } else { | ||
| 49 | + icon_file = 'icon_calendar.gif'; | ||
| 43 | } | 50 | } |
| 44 | - | ||
| 45 | - var icon = $('<img src=\"icons/16x16/'+icon_file+'\"/>'); | 51 | + |
| 52 | + icon = $('<img src=\"icons/16x16/'+icon_file+'\"/>'); | ||
| 46 | 53 | ||
| 47 | icon.click(function () { dt_picker.datetimepicker('show'); }); | 54 | icon.click(function () { dt_picker.datetimepicker('show'); }); |
| 48 | icon.hover(function() { $(this).css('cursor','pointer'); }); | 55 | icon.hover(function() { $(this).css('cursor','pointer'); }); |
| 49 | dt_picker.after(icon); | 56 | dt_picker.after(icon); |
| 57 | + | ||
| 58 | + dt_picker.addClass('cxm-icon'); | ||
| 50 | }; | 59 | }; |
| 51 | 60 | ||
| 52 | $('.datepicker').each(items_add_func); | 61 | $('.datepicker').each(items_add_func); |