bootstrap-datetimepicker-rails 0.0.10 → 0.0.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module BootstrapDatetimepicker
2
2
  module Rails
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.10.1"
4
4
  end
5
5
  end
@@ -77,7 +77,7 @@
77
77
  icon.removeClass(this.timeIcon);
78
78
  icon.addClass(this.dateIcon);
79
79
  }
80
- this.widget = $(getTemplate(this.timeIcon, options.pickDate, options.pickTime, options.pick12HourFormat, options.pickSeconds)).appendTo('body');
80
+ this.widget = $(getTemplate(this.timeIcon, options.pickDate, options.pickTime, options.pick12HourFormat, options.pickSeconds, options.collapse)).appendTo('body');
81
81
  this.minViewMode = options.minViewMode||this.$element.data('date-minviewmode')||0;
82
82
  if (typeof this.minViewMode === 'string') {
83
83
  switch (this.minViewMode) {
@@ -260,9 +260,20 @@
260
260
  },
261
261
 
262
262
  place: function(){
263
+ var position = 'absolute';
263
264
  var offset = this.component ? this.component.offset() : this.$element.offset();
265
+ offset.top = offset.top + this.height;
266
+
267
+ if (this._isInFixed()) {
268
+ var $window = $(window);
269
+ position = 'fixed';
270
+ offset.top -= $window.scrollTop();
271
+ offset.left -= $window.scrollLeft();
272
+ }
273
+
264
274
  this.widget.css({
265
- top: offset.top + this.height,
275
+ position: position,
276
+ top: offset.top,
266
277
  left: offset.left
267
278
  });
268
279
  },
@@ -1024,7 +1035,23 @@
1024
1035
  if (!this.isInput) {
1025
1036
  $(document).off('mousedown.datetimepicker' + this.id);
1026
1037
  }
1027
- }
1038
+ },
1039
+
1040
+ _isInFixed: function() {
1041
+ if (this.$element) {
1042
+ var parents = this.$element.parents();
1043
+ var inFixed = false;
1044
+ for (var i=0; i<parents.length; i++) {
1045
+ if ($(parents[i]).css('position') == 'fixed') {
1046
+ inFixed = true;
1047
+ break;
1048
+ }
1049
+ };
1050
+ return inFixed;
1051
+ } else {
1052
+ return false;
1053
+ }
1054
+ }
1028
1055
  };
1029
1056
 
1030
1057
  $.fn.datetimepicker = function ( option, val ) {
@@ -1047,7 +1074,8 @@
1047
1074
  pick12HourFormat: false,
1048
1075
  pickSeconds: true,
1049
1076
  startDate: -Infinity,
1050
- endDate: Infinity
1077
+ endDate: Infinity,
1078
+ collapse: true
1051
1079
  };
1052
1080
  $.fn.datetimepicker.Constructor = DateTimePicker;
1053
1081
  var dpgId = 0;
@@ -1096,18 +1124,18 @@
1096
1124
  else return Array(l - s.length + 1).join(c || ' ') + s;
1097
1125
  }
1098
1126
 
1099
- function getTemplate(timeIcon, pickDate, pickTime, is12Hours, showSeconds) {
1127
+ function getTemplate(timeIcon, pickDate, pickTime, is12Hours, showSeconds, collapse) {
1100
1128
  if (pickDate && pickTime) {
1101
1129
  return (
1102
1130
  '<div class="bootstrap-datetimepicker-widget dropdown-menu">' +
1103
1131
  '<ul>' +
1104
- '<li class="collapse in">' +
1132
+ '<li' + (collapse ? ' class="collapse in"' : '') + '>' +
1105
1133
  '<div class="datepicker">' +
1106
1134
  DPGlobal.template +
1107
1135
  '</div>' +
1108
1136
  '</li>' +
1109
- '<li class="picker-switch"><a class="accordion-toggle"><i class="' + timeIcon + '"></i></a></li>' +
1110
- '<li class="collapse">' +
1137
+ '<li class="picker-switch accordion-toggle"><a><i class="' + timeIcon + '"></i></a></li>' +
1138
+ '<li' + (collapse ? ' class="collapse"' : '') + '>' +
1111
1139
  '<div class="timepicker">' +
1112
1140
  TPGlobal.getTemplate(is12Hours, showSeconds) +
1113
1141
  '</div>' +
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Faroese translation for bootstrap-datetimepicker
3
+ * René Bischoff <http://github.com/Fjandin>
4
+ */
5
+ ;(function($){
6
+ $.fn.datetimepicker.dates['fo'] = {
7
+ days: ["Sunnudagur", "Mánadagur", "Týsdagur", "Mikudagur", "Hósdagur", "Fríggjadagur", "Leygardagur", "Sunnudagur"],
8
+ daysShort: ["Sun", "Mán", "Týs", "Mik", "Hós", "Frí", "Ley", "Sun"],
9
+ daysMin: ["Su", "Má", "Tý", "Mi", "Hó", "Fr", "Le", "Su"],
10
+ months: ["Januar", "Februar", "Mars", "Apríl", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"],
11
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"],
12
+ today: "Í dag"
13
+ };
14
+ }(jQuery));
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-datetimepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.10.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-09 00:00:00.000000000 Z
12
+ date: 2013-03-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This gem packages the bootstrap-datetimepicker (JavaScripts & stylesheets)
15
15
  for Rails 3.1+ asset pipeline
@@ -29,6 +29,7 @@ files:
29
29
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.es.js
30
30
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fa-IR.js
31
31
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fi.js
32
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fo.js
32
33
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fr.js
33
34
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.hr.js
34
35
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.hu.js