diff options
Diffstat (limited to 'resources/assets/js')
-rw-r--r-- | resources/assets/js/forms.js | 18 | ||||
-rw-r--r-- | resources/assets/js/vendor.js | 1 |
2 files changed, 11 insertions, 8 deletions
diff --git a/resources/assets/js/forms.js b/resources/assets/js/forms.js index 2531f04e..f5818e97 100644 --- a/resources/assets/js/forms.js +++ b/resources/assets/js/forms.js @@ -104,7 +104,7 @@ $(function () { var opts = { minDate: '', maxDate: '', - locale: 'en', + locale: $('html').attr('lang'), format: 'YYYY-MM-DD', widgetPositioning: {horizontal: 'auto', vertical: 'bottom'} }; @@ -133,18 +133,22 @@ $(function () { */ $(function () { $('.input-group.time').each(function () { - var elem = $(this).children('input').first(); + var elem = $(this); var opts = { - locale: 'en', + locale: $('html').attr('lang'), format: 'HH:mm', widgetPositioning: {horizontal: 'auto', vertical: 'bottom'} }; $.extend(opts, elem.data()); - elem.attr('type', 'text'); - elem.datetimepicker(opts); - elem.on('click', function (ev) { + elem.children('input').attr('type', 'text'); + elem.children('input').on('click', function (ev) { ev.stopImmediatePropagation(); - elem.data('DateTimePicker').toggle(); + if (typeof elem.data('DateTimePicker') === 'undefined') { + elem.datetimepicker(opts); + elem.data('DateTimePicker').show(); + } else { + elem.data('DateTimePicker').toggle(); + } }); }); }); diff --git a/resources/assets/js/vendor.js b/resources/assets/js/vendor.js index 07561fdf..d9da845c 100644 --- a/resources/assets/js/vendor.js +++ b/resources/assets/js/vendor.js @@ -4,7 +4,6 @@ require('bootstrap'); require('imports-loader?this=>window&define=>false&exports=>false!moment'); require('imports-loader?this=>window&define=>false&exports=>false!moment/locale/de'); require('imports-loader?define=>false&exports=>false!eonasdan-bootstrap-datetimepicker'); -require('eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css'); require('imports-loader?this=>window!chart.js'); require('./forms'); require('./sticky-headers'); |