bootstrap-datepicker-rails 1.0.0.1 → 1.0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 905d023a948c35fdd99fd341556ba6c245a83d77
4
+ data.tar.gz: ad4663b35cd0f423f2625a5dacdd37204692ab3b
5
+ SHA512:
6
+ metadata.gz: 3f483fb57fe0ddefd80594066700e0e76b9c66a0b4052862b75af5215b6a0ece3e8aedcb3a97a2fcab6510a36cd22c24768a02cd9d88d6fba76e32cf75035e76
7
+ data.tar.gz: 8e7ec6fc5b3b35a7aacc1e2945b82d8841fb78569de2a267a476c53894221f2530888d3a468c23c47ee16e94b96f96327a039c7d3667af72ca16e7f3d718b75e
data/.rvmrc CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
7
  # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p327@bootstrap-datepicker-rails"
8
+ # echo "rvm use 2.0.0" > .rvmrc
9
+ environment_id="ruby-2.0.0-p0@bootstrap-datepicker-rails"
10
10
 
11
11
  # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.16.20 (stable)" # 1.10.1 seams as a safe start
12
+ # rvmrc_rvm_version="1.18.21 (master)" # 1.10.1 seams as a safe start
13
13
  # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
14
  # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
15
  # return 1
@@ -23,8 +23,13 @@ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
23
  && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
24
  then
25
25
  \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
26
+ for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"*
27
+ do
28
+ if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]]
29
+ then \. "${__hook}" || true
30
+ fi
31
+ done
32
+ unset __hook
28
33
  else
29
34
  # If the environment file has not yet been created, use the RVM CLI to select.
30
35
  rvm --create "$environment_id" || {
@@ -3,10 +3,10 @@ require "bootstrap-datepicker-rails/version"
3
3
 
4
4
  module BootstrapDatepickerRails
5
5
  module Rails
6
- if ::Rails.version < "3.1"
6
+ if ::Rails.version.to_s < "3.1"
7
7
  require "bootstrap-datepicker-rails/railtie"
8
8
  else
9
9
  require "bootstrap-datepicker-rails/engine"
10
10
  end
11
11
  end
12
- end
12
+ end
@@ -1,5 +1,5 @@
1
1
  module BootstrapDatepickerRails
2
2
  module Rails
3
- VERSION = "1.0.0.1"
3
+ VERSION = "1.0.0.2"
4
4
  end
5
5
  end
@@ -46,8 +46,6 @@
46
46
  if(this.component && this.component.length === 0)
47
47
  this.component = false;
48
48
 
49
- this._attachEvents();
50
-
51
49
  this.forceParse = true;
52
50
  if ('forceParse' in options) {
53
51
  this.forceParse = options.forceParse;
@@ -55,12 +53,9 @@
55
53
  this.forceParse = this.element.data('date-force-parse');
56
54
  }
57
55
 
58
-
59
- this.picker = $(DPGlobal.template)
60
- .on({
61
- click: $.proxy(this.click, this),
62
- mousedown: $.proxy(this.mousedown, this)
63
- });
56
+ this.picker = $(DPGlobal.template);
57
+ this._buildEvents();
58
+ this._attachEvents();
64
59
 
65
60
  if(this.isInline) {
66
61
  this.picker.addClass('datepicker-inline').appendTo(this.element);
@@ -72,12 +67,6 @@
72
67
  this.picker.find('.prev i, .next i')
73
68
  .toggleClass('icon-arrow-left icon-arrow-right');
74
69
  }
75
- $(document).on('mousedown', function (e) {
76
- // Clicked outside the datepicker, hide it
77
- if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) {
78
- that.hide();
79
- }
80
- });
81
70
 
82
71
  this.autoclose = false;
83
72
  if ('autoclose' in options) {
@@ -164,8 +153,22 @@
164
153
  constructor: Datepicker,
165
154
 
166
155
  _events: [],
167
- _attachEvents: function(){
168
- this._detachEvents();
156
+ _secondaryEvents: [],
157
+ _applyEvents: function(evs){
158
+ for (var i=0, el, ev; i<evs.length; i++){
159
+ el = evs[i][0];
160
+ ev = evs[i][1];
161
+ el.on(ev);
162
+ }
163
+ },
164
+ _unapplyEvents: function(evs){
165
+ for (var i=0, el, ev; i<evs.length; i++){
166
+ el = evs[i][0];
167
+ ev = evs[i][1];
168
+ el.off(ev);
169
+ }
170
+ },
171
+ _buildEvents: function(){
169
172
  if (this.isInput) { // single input
170
173
  this._events = [
171
174
  [this.element, {
@@ -188,9 +191,9 @@
188
191
  }]
189
192
  ];
190
193
  }
191
- else if (this.element.is('div')) { // inline datepicker
192
- this.isInline = true;
193
- }
194
+ else if (this.element.is('div')) { // inline datepicker
195
+ this.isInline = true;
196
+ }
194
197
  else {
195
198
  this._events = [
196
199
  [this.element, {
@@ -198,19 +201,37 @@
198
201
  }]
199
202
  ];
200
203
  }
201
- for (var i=0, el, ev; i<this._events.length; i++){
202
- el = this._events[i][0];
203
- ev = this._events[i][1];
204
- el.on(ev);
205
- }
204
+
205
+ this._secondaryEvents = [
206
+ [this.picker, {
207
+ click: $.proxy(this.click, this)
208
+ }],
209
+ [$(window), {
210
+ resize: $.proxy(this.place, this)
211
+ }],
212
+ [$(document), {
213
+ mousedown: $.proxy(function (e) {
214
+ // Clicked outside the datepicker, hide it
215
+ if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) {
216
+ this.hide();
217
+ }
218
+ }, this)
219
+ }]
220
+ ];
221
+ },
222
+ _attachEvents: function(){
223
+ this._detachEvents();
224
+ this._applyEvents(this._events);
206
225
  },
207
226
  _detachEvents: function(){
208
- for (var i=0, el, ev; i<this._events.length; i++){
209
- el = this._events[i][0];
210
- ev = this._events[i][1];
211
- el.off(ev);
212
- }
213
- this._events = [];
227
+ this._unapplyEvents(this._events);
228
+ },
229
+ _attachSecondaryEvents: function(){
230
+ this._detachSecondaryEvents();
231
+ this._applyEvents(this._secondaryEvents);
232
+ },
233
+ _detachSecondaryEvents: function(){
234
+ this._unapplyEvents(this._secondaryEvents);
214
235
  },
215
236
 
216
237
  show: function(e) {
@@ -219,7 +240,7 @@
219
240
  this.picker.show();
220
241
  this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
221
242
  this.place();
222
- $(window).on('resize', $.proxy(this.place, this));
243
+ this._attachSecondaryEvents();
223
244
  if (e) {
224
245
  e.preventDefault();
225
246
  }
@@ -233,12 +254,9 @@
233
254
  if(this.isInline) return;
234
255
  if (!this.picker.is(':visible')) return;
235
256
  this.picker.hide().detach();
236
- $(window).off('resize', this.place);
257
+ this._detachSecondaryEvents();
237
258
  this.viewMode = this.startViewMode;
238
259
  this.showMode();
239
- if (!this.isInput) {
240
- $(document).off('mousedown', this.hide);
241
- }
242
260
 
243
261
  if (
244
262
  this.forceParse &&
@@ -255,7 +273,9 @@
255
273
  },
256
274
 
257
275
  remove: function() {
276
+ this.hide();
258
277
  this._detachEvents();
278
+ this._detachSecondaryEvents();
259
279
  this.picker.remove();
260
280
  delete this.element.data().datepicker;
261
281
  if (!this.isInput) {
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-datepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.1
5
- prerelease:
4
+ version: 1.0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Gonzalo Rodríguez-Baltanás Díaz
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
11
+ date: 2013-03-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '1.0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '1.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: A date picker for Twitter Bootstrap
@@ -174,32 +167,25 @@ files:
174
167
  - vendor/assets/stylesheets/bootstrap-datepicker.css
175
168
  homepage: https://github.com/Nerian/bootstrap-datepicker-rails
176
169
  licenses: []
170
+ metadata: {}
177
171
  post_install_message:
178
172
  rdoc_options: []
179
173
  require_paths:
180
174
  - lib
181
175
  required_ruby_version: !ruby/object:Gem::Requirement
182
- none: false
183
176
  requirements:
184
- - - ! '>='
177
+ - - '>='
185
178
  - !ruby/object:Gem::Version
186
179
  version: '0'
187
- segments:
188
- - 0
189
- hash: -3904933935366444967
190
180
  required_rubygems_version: !ruby/object:Gem::Requirement
191
- none: false
192
181
  requirements:
193
- - - ! '>='
182
+ - - '>='
194
183
  - !ruby/object:Gem::Version
195
184
  version: '0'
196
- segments:
197
- - 0
198
- hash: -3904933935366444967
199
185
  requirements: []
200
186
  rubyforge_project:
201
- rubygems_version: 1.8.25
187
+ rubygems_version: 2.0.2
202
188
  signing_key:
203
- specification_version: 3
189
+ specification_version: 4
204
190
  summary: A date picker for Twitter Bootstrap
205
191
  test_files: []