xdan-datetimepicker-rails 2.4.3 → 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d93e36be754816955a4ae9bdb6049b80009a2567
4
- data.tar.gz: 80c262e33b594ecf00a825247ccacffce1e87f36
3
+ metadata.gz: c4540044f283cee237da711b04abef19d9f02762
4
+ data.tar.gz: 117a405cb589b9b0cac60c0c5b09536055285205
5
5
  SHA512:
6
- metadata.gz: ed2a05f9abb7bc57f9997c33c0bb5644cf07dde823a405caaaef9af2c1db20024dca9b63b40a4f656a70ca494af35d018b7263e57edf61d81dbab995f16bbbe6
7
- data.tar.gz: c83389650af6c3c865c0ab41ee82723b02ba999d9480aefaef8898c9b3c8d237909e9949ea2e05eadbeba408fd6ef579367d4f5409983fdeb7108064d6b8e643
6
+ metadata.gz: a96c3e61b09a9c64dbf976d42a0453b7c60ad3f4f03eac5ebacd600656b368cf3fa46906e236faea8b8d1b79fd4e34f6bc8cd2acdc560681d2fe2c263e694bc1
7
+ data.tar.gz: 10d1c0f3d19975a489f05f1ec92f22bcba0e7fb6831c4a66db378b36d2f573c00c05f31d7165c1196d4c54a185379d1204202594dc437895b5ab55b21274059b
data/Rakefile CHANGED
@@ -1,21 +1,44 @@
1
1
  require "bundler/gem_tasks"
2
+ require "xdan-datetimepicker-rails/version"
2
3
 
3
- require 'net/http'
4
- require 'open-uri'
4
+ require "net/http"
5
+ require "open-uri"
5
6
 
6
7
  namespace :source do
7
8
  desc "update the source file"
8
9
  task :update do
9
- version = ENV['version'] || 'master'
10
+ old_version = XdanDatetimepickerRails::VERSION
11
+ new_version = ENV["version"] || "master"
10
12
  puts "Downloading jquery.datetimepicker.js..."
11
- download "https://raw.github.com/xdan/datetimepicker/#{version}/jquery.datetimepicker.js", "app/assets/javascripts/jquery.xdan.datetimepicker.js"
13
+ download "https://raw.github.com/xdan/datetimepicker/#{new_version}/jquery.datetimepicker.js", "app/assets/javascripts/jquery.xdan.datetimepicker.js"
12
14
 
13
15
  puts "Downloading jquery.datetimepicker.css..."
14
- download "https://raw.github.com/xdan/datetimepicker/#{version}/jquery.datetimepicker.css", "app/assets/stylesheets/jquery.xdan.datetimepicker.css"
16
+ download "https://raw.github.com/xdan/datetimepicker/#{new_version}/jquery.datetimepicker.css", "app/assets/stylesheets/jquery.xdan.datetimepicker.css"
17
+
18
+ update_version from: old_version, to: new_version
19
+
20
+ system "git add app/assets/ lib/xdan-datetimepicker-rails/version.rb"
21
+ system "git commit -m 'Update source to version #{new_version}\n\n[Diff from #{old_version} to #{new_version}](https://www.github.com/xdan/datetimepicker/compare/#{old_version}...#{new_version})'"
22
+ system "git tag #{new_version}"
15
23
  end
16
24
  end
17
25
 
26
+ namespace :rubygems do
27
+ desc "build and release new version to rubygems"
28
+ task :release do
29
+ puts "Building xdan-datetimepicker-rails.gemspec"
30
+ system "gem build xdan-datetimepicker-rails.gemspec"
31
+ print "\nPushing xdan-datetimepicker-rails-#{XdanDatetimepickerRails::VERSION} to rubygems..."
32
+ system "gem push xdan-datetimepicker-rails-#{XdanDatetimepickerRails::VERSION}.gem"
33
+ puts "done!"
34
+ end
35
+ end
18
36
 
19
- def download remote_path, local_path
37
+ def download(remote_path, local_path)
20
38
  `wget -O #{local_path} #{remote_path}`
21
39
  end
40
+
41
+ def update_version(from:, to:)
42
+ version_rb = "lib/xdan-datetimepicker-rails/version.rb"
43
+ File.write(version_rb, File.open(version_rb, &:read).gsub(from, to))
44
+ end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.4.3
2
+ * @preserve jQuery DateTimePicker plugin v2.4.4
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
4
  * (c) 2014, Chupurnov Valeriy.
5
5
  */
@@ -32,6 +32,14 @@
32
32
  "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
33
33
  ]
34
34
  },
35
+ is: { // Icelandic
36
+ months: [
37
+ "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
38
+ ],
39
+ dayOfWeek: [
40
+ "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
41
+ ]
42
+ },
35
43
  bg: { // Bulgarian
36
44
  months: [
37
45
  "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
@@ -460,6 +468,8 @@
460
468
  maxDate: false,
461
469
  minTime: false,
462
470
  maxTime: false,
471
+ disabledMinTime: false,
472
+ disabledMaxTime: false,
463
473
 
464
474
  allowTimes: [],
465
475
  opened: false,
@@ -511,6 +521,7 @@
511
521
  highlightedDates: [],
512
522
  highlightedPeriods: [],
513
523
  disabledDates : [],
524
+ disabledWeekDays: [],
514
525
  yearOffset: 0,
515
526
  beforeShowDay: null,
516
527
 
@@ -735,7 +746,7 @@
735
746
  };
736
747
 
737
748
  createDateTimePicker = function (input) {
738
- var datetimepicker = $('<div ' + (options.id ? 'id="' + options.id + '"' : '') + ' ' + (options.style ? 'style="' + options.style + '"' : '') + ' class="xdsoft_datetimepicker xdsoft_' + options.theme + ' xdsoft_noselect ' + (options.weeks ? ' xdsoft_showweeks' : '') + options.className + '"></div>'),
749
+ var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
739
750
  xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
740
751
  datepicker = $('<div class="xdsoft_datepicker active"></div>'),
741
752
  mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
@@ -746,7 +757,7 @@
746
757
  timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),
747
758
  timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
748
759
  timebox = $('<div class="xdsoft_time_variant"></div>'),
749
- applyButton = $('<button class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
760
+ applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
750
761
  /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
751
762
  scroller = $('<div class="xdsoft_scroller"></div>'),*/
752
763
  monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
@@ -762,6 +773,13 @@
762
773
  timer1 = 0,
763
774
  _xdsoft_datetime;
764
775
 
776
+ if (options.id) datetimepicker.attr('id', options.id);
777
+ if (options.style) datetimepicker.attr('style', options.style);
778
+ if (options.weeks) datetimepicker.addClass('xdsoft_showweeks');
779
+
780
+ datetimepicker.addClass('xdsoft_' + options.theme);
781
+ datetimepicker.addClass(options.className);
782
+
765
783
  mounth_picker
766
784
  .find('.xdsoft_month span')
767
785
  .after(monthselect);
@@ -935,6 +953,10 @@
935
953
  if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
936
954
  options.disabledDates = $.extend(true, [], _options.disabledDates);
937
955
  }
956
+
957
+ if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
958
+ options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
959
+ }
938
960
 
939
961
  if ((options.open || options.opened) && (!options.inline)) {
940
962
  input.trigger('open.xdsoft');
@@ -1325,6 +1347,18 @@
1325
1347
  _xdsoft_datetime.setCurrentTime(0);
1326
1348
  datetimepicker.trigger('afterOpen.xdsoft');
1327
1349
  }).on('dblclick.xdsoft', function () {
1350
+ var currentDate = _xdsoft_datetime.getCurrentTime();
1351
+ currentDate = new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate());
1352
+ var minDate = _xdsoft_datetime.strToDate(options.minDate);
1353
+ minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
1354
+ if(currentDate < minDate) {
1355
+ return;
1356
+ }
1357
+ var maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1358
+ maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate());
1359
+ if(currentDate > maxDate) {
1360
+ return;
1361
+ }
1328
1362
  input.val(_xdsoft_datetime.str());
1329
1363
  datetimepicker.trigger('close.xdsoft');
1330
1364
  });
@@ -1404,6 +1438,7 @@
1404
1438
  maxDate = false,
1405
1439
  minDate = false,
1406
1440
  hDate,
1441
+ day,
1407
1442
  d,
1408
1443
  y,
1409
1444
  m,
@@ -1447,6 +1482,7 @@
1447
1482
  classes = [];
1448
1483
  i += 1;
1449
1484
 
1485
+ day = start.getDay();
1450
1486
  d = start.getDate();
1451
1487
  y = start.getFullYear();
1452
1488
  m = start.getMonth();
@@ -1465,6 +1501,8 @@
1465
1501
  classes.push('xdsoft_disabled');
1466
1502
  } else if (options.disabledDates.indexOf(start.dateFormat(options.formatDate)) !== -1) {
1467
1503
  classes.push('xdsoft_disabled');
1504
+ } else if (options.disabledWeekDays.indexOf(day) !== -1) {
1505
+ classes.push('xdsoft_disabled');
1468
1506
  }
1469
1507
 
1470
1508
  if (customDateSettings && customDateSettings[1] !== "") {
@@ -1540,6 +1578,9 @@
1540
1578
  if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) {
1541
1579
  classes.push('xdsoft_disabled');
1542
1580
  }
1581
+ if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
1582
+ classes.push('xdsoft_disabled');
1583
+ }
1543
1584
 
1544
1585
  current_time = new Date(_xdsoft_datetime.currentTime);
1545
1586
  current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
@@ -1641,7 +1682,7 @@
1641
1682
  datetimepicker.trigger('select.xdsoft', [currentTime]);
1642
1683
 
1643
1684
  input.val(_xdsoft_datetime.str());
1644
- if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === 0 && !options.timepicker))) && !options.inline) {
1685
+ if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
1645
1686
  datetimepicker.trigger('close.xdsoft');
1646
1687
  }
1647
1688
 
@@ -1769,6 +1810,14 @@
1769
1810
  left = $(window).width() - datetimepicker[0].offsetWidth;
1770
1811
  }
1771
1812
  }
1813
+ var node = datetimepicker[0]
1814
+ do {
1815
+ node = node.parentNode;
1816
+ if(window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) {
1817
+ left = left - (($(window).width() - node.offsetWidth)/2)
1818
+ break
1819
+ }
1820
+ } while(node.nodeName != 'HTML')
1772
1821
  datetimepicker.css({
1773
1822
  left: left,
1774
1823
  top: top,
@@ -1,3 +1,3 @@
1
1
  module XdanDatetimepickerRails
2
- VERSION = '2.4.3'
2
+ VERSION = '2.4.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xdan-datetimepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Kovach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-18 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.4.8
104
+ rubygems_version: 2.6.1
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: XDan's jQuery DateTimePicker packaged for the Rails Asset Pipeline