mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Improve date picker UI
- Set first day of week to Monday - Enable year and month selectors #590
This commit is contained in:
parent
513a729673
commit
1ed10d2237
6 changed files with 24 additions and 11 deletions
|
@ -9,6 +9,7 @@
|
|||
#= require jquery-ui/datepicker
|
||||
#= require select2
|
||||
#= require jquery.doubleScroll
|
||||
#= require datepicker
|
||||
#= require admin/application
|
||||
#= require admin/app
|
||||
#= require_tree ./admin
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
$('.datepicker').datepicker({
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
21
app/assets/javascripts/datepicker.js
Normal file
21
app/assets/javascripts/datepicker.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
(function () {
|
||||
$.datepicker.setDefaults({
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
duration: 'fast',
|
||||
firstDay: 1, // Monday
|
||||
dateFormat: 'yy-mm-dd',
|
||||
});
|
||||
|
||||
function attachDatePicker() {
|
||||
var dateFields = $('.datepicker');
|
||||
dateFields.datepicker();
|
||||
}
|
||||
|
||||
// For turbolinks
|
||||
document.addEventListener('page:change', function () {
|
||||
attachDatePicker();
|
||||
});
|
||||
|
||||
attachDatePicker();
|
||||
})();
|
|
@ -8,7 +8,6 @@
|
|||
#= require shared/jquery.validate.bootstrap
|
||||
#= require jquery-ui/datepicker
|
||||
#= require select2
|
||||
|
||||
#= require datepicker
|
||||
#= require shared/general
|
||||
|
||||
#= require registrar/application
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
#= require jquery.nested_attributes
|
||||
#= require jquery-ui/datepicker
|
||||
#= require select2
|
||||
|
||||
#= require datepicker
|
||||
#= require shared/general
|
||||
|
||||
#= require registrar/autocomplete
|
||||
#= require registrar/application
|
||||
|
|
|
@ -21,10 +21,6 @@ $(document).on 'page:change', ->
|
|||
tomorrow = new Date(today)
|
||||
tomorrow.setDate(today.getDate() + 1)
|
||||
|
||||
$('.datepicker').datepicker(
|
||||
dateFormat: "yy-mm-dd"
|
||||
)
|
||||
|
||||
if $('.js-combobox').length
|
||||
$('.js-combobox').select2
|
||||
width: "100%"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue