bootstrap-datepicker-rails 0.6.30 → 0.6.31

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,13 +15,13 @@ def fixes
15
15
 
16
16
  end
17
17
 
18
- desc "Build and publish de gem"
18
+ desc "Build"
19
19
  task "build" do
20
20
  system("gem build bootstrap-datepicker-rails.gemspec")
21
21
  end
22
22
 
23
- desc "Build and publish de gem"
24
- task "publish" do
23
+ desc "Build and publish the gem"
24
+ task :publish => :build do
25
25
  require File.expand_path('../lib/bootstrap-datepicker-rails/version', __FILE__)
26
26
  system("gem push bootstrap-datepicker-rails-#{BootstrapDatepickerRails::Rails::VERSION}.gem")
27
27
  system("git push")
@@ -1,5 +1,5 @@
1
1
  module BootstrapDatepickerRails
2
2
  module Rails
3
- VERSION = "0.6.30"
3
+ VERSION = "0.6.31"
4
4
  end
5
5
  end
@@ -48,6 +48,8 @@
48
48
  if(this.component && this.component.length === 0)
49
49
  this.component = false;
50
50
 
51
+ this._attachEvents();
52
+
51
53
  this.forceParse = true;
52
54
  if ('forceParse' in options) {
53
55
  this.forceParse = options.forceParse;
@@ -55,27 +57,6 @@
55
57
  this.forceParse = this.element.data('date-force-parse');
56
58
  }
57
59
 
58
- if (this.isInput) {
59
- this.element.on({
60
- focus: $.proxy(this.show, this),
61
- keyup: $.proxy(this.update, this),
62
- keydown: $.proxy(this.keydown, this)
63
- });
64
- } else {
65
- if (this.component && this.hasInput){
66
- // For components that are not readonly, allow keyboard nav
67
- this.element.find('input').on({
68
- focus: $.proxy(this.show, this),
69
- keyup: $.proxy(this.update, this),
70
- keydown: $.proxy(this.keydown, this)
71
- });
72
-
73
- this.component.on('click', $.proxy(this.show, this));
74
- } else {
75
- this.element.on('click', $.proxy(this.show, this));
76
- }
77
- }
78
-
79
60
  $(document).on('mousedown', function (e) {
80
61
  // Clicked outside the datepicker, hide it
81
62
  if ($(e.target).closest('.datepicker').length == 0) {
@@ -131,6 +112,53 @@
131
112
  Datepicker.prototype = {
132
113
  constructor: Datepicker,
133
114
 
115
+ _events: [],
116
+ _attachEvents: function(){
117
+ this._detachEvents();
118
+ if (this.isInput) {
119
+ this._events = [
120
+ [this.element, {
121
+ focus: $.proxy(this.show, this),
122
+ keyup: $.proxy(this.update, this),
123
+ keydown: $.proxy(this.keydown, this)
124
+ }]
125
+ ];
126
+ }
127
+ else if (this.component && this.hasInput){
128
+ this._events = [
129
+ // For components that are not readonly, allow keyboard nav
130
+ [this.element.find('input'), {
131
+ focus: $.proxy(this.show, this),
132
+ keyup: $.proxy(this.update, this),
133
+ keydown: $.proxy(this.keydown, this),
134
+ }],
135
+ [this.component, {
136
+ click: $.proxy(this.show, this)
137
+ }]
138
+ ];
139
+ }
140
+ else {
141
+ this._events = [
142
+ [this.element, {
143
+ click: $.proxy(this.show, this)
144
+ }]
145
+ ];
146
+ }
147
+ for (var i=0, el, ev; i<this._events.length; i++){
148
+ el = this._events[i][0];
149
+ ev = this._events[i][1];
150
+ el.on(ev);
151
+ }
152
+ },
153
+ _detachEvents: function(){
154
+ for (var i=0, el, ev; i<this._events.length; i++){
155
+ el = this._events[i][0];
156
+ ev = this._events[i][1];
157
+ el.off(ev);
158
+ }
159
+ this._events = [];
160
+ },
161
+
134
162
  show: function(e) {
135
163
  this.picker.show();
136
164
  this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
@@ -170,6 +198,12 @@
170
198
  });
171
199
  },
172
200
 
201
+ remove: function() {
202
+ this._detachEvents();
203
+ this.picker.remove();
204
+ delete this.element.data().datepicker;
205
+ },
206
+
173
207
  getDate: function() {
174
208
  var d = this.getUTCDate();
175
209
  return new Date(d.getTime() + (d.getTimezoneOffset()*60000))
@@ -1,14 +1,14 @@
1
- /**
2
- * Bulgarian translation for bootstrap-datepicker
3
- * Apostol Apostolov <apostol.s.apostolov@gmail.com>
4
- */
5
- ;(function($){
6
- $.fn.datepicker.dates['bg'] = {
7
- days: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота", "Неделя"],
8
- daysShort: ["Нед", "Пон", "Вто", "Сря", "Чет", "Пет", "Съб", "Нед"],
9
- daysMin: ["Н", "П", "В", "С", "Ч", "П", "С", "Н"],
10
- months: ["Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"],
11
- monthsShort: ["Ян", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Ное", "Дек"],
12
- today: "днес"
13
- };
14
- }(jQuery));
1
+ /**
2
+ * Bulgarian translation for bootstrap-datepicker
3
+ * Apostol Apostolov <apostol.s.apostolov@gmail.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.datepicker.dates['bg'] = {
7
+ days: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота", "Неделя"],
8
+ daysShort: ["Нед", "Пон", "Вто", "Сря", "Чет", "Пет", "Съб", "Нед"],
9
+ daysMin: ["Н", "П", "В", "С", "Ч", "П", "С", "Н"],
10
+ months: ["Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"],
11
+ monthsShort: ["Ян", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Ное", "Дек"],
12
+ today: "днес"
13
+ };
14
+ }(jQuery));
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-datepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.30
4
+ version: 0.6.31
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: 2012-11-22 00:00:00.000000000 Z
12
+ date: 2012-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -121,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  segments:
123
123
  - 0
124
- hash: -911006301523283185
124
+ hash: 4213993866824750986
125
125
  required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  none: false
127
127
  requirements:
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  segments:
132
132
  - 0
133
- hash: -911006301523283185
133
+ hash: 4213993866824750986
134
134
  requirements: []
135
135
  rubyforge_project:
136
136
  rubygems_version: 1.8.24