kea-rails 1.0.3 → 1.0.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: db25fa7e45c049047b286a2ac55bbf6e54453dfb
4
- data.tar.gz: 57183ee67ad44d8544dbe545e5cebe9e5b153bce
3
+ metadata.gz: 41bd1eac8219569939c938b547353ca7c9d1278c
4
+ data.tar.gz: 09eb89eab320e446e915de000b41b428af9ce557
5
5
  SHA512:
6
- metadata.gz: d0c5da927c46a7d09bda7211ea2683b526a869c5efbc2f5a210befd08003c950eeeeb9e3bef9619b835c1870c581dccac0b15cc85211f273c736a85c1f5267ac
7
- data.tar.gz: 1b6238338f64629bd0f9f563082860d185d429f06a91b9a9cda39bd84df331a6d49568235e2b31a2b6abf8f7674619d80e28c0acc79fffa669e33719c6bd4039
6
+ metadata.gz: dcdc1ce36da5e0e52630b689e6be1737bc05067ac1b8a1e60ae7c30e51d3c39b851a23057b00468063eb303bdc43fe9f416058b5041c11d59ae5485143836c00
7
+ data.tar.gz: 4feb3931baa0e9349e28b31f246bde3f4b5f32afe519681fb9b0195fed4c26ebb6f527547fe0d44ad338bbfeb3a7ed5c18201c9c990cee76903a1f4f369eeca5
@@ -1,4 +1,4 @@
1
- (function(ko, $, app) {
1
+ (function(ko, $, app, kea) {
2
2
  "use strict";
3
3
 
4
4
  ko.bindingHandlers.komplete = {
@@ -79,7 +79,7 @@
79
79
 
80
80
  this.requestInProgress(true);
81
81
 
82
- app.services.Base._request('GET', this.url, { q: this.searchTerm() })
82
+ kea.services.Base._request('GET', this.url, { q: this.searchTerm() })
83
83
  .done(function(response) {
84
84
  that.searchResults( that.parseResults(response) );
85
85
 
@@ -169,4 +169,4 @@
169
169
  }
170
170
  };
171
171
 
172
- })(ko, $, window.app);
172
+ })(ko, $, window.app, window.kea);
@@ -1,3 +1,3 @@
1
1
  module Kea
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -54,8 +54,10 @@
54
54
  'afterCreate': [],
55
55
  'beforeShow': [],
56
56
  'afterShow': [],
57
+ 'afterHide': [],
57
58
  'groupMemberBeforeShow': [],
58
- 'groupMemberAfterShow': []
59
+ 'groupMemberAfterShow': [],
60
+ 'groupMemberAfterHide': []
59
61
  };
60
62
 
61
63
  if (typeof callbacks !== 'undefined') {
@@ -144,6 +146,7 @@
144
146
  _hasCallbackFor,
145
147
  _executeCallbacksFor,
146
148
  _createPopover,
149
+ _removePopover,
147
150
  _getAnchorPosition,
148
151
  _setPopoverPosition,
149
152
  _setPositionLabel,
@@ -159,6 +162,7 @@
159
162
  popoverClass: "",
160
163
  cssTransitionSupport: true,
161
164
  allowParallelUse: true,
165
+ disposable: false,
162
166
  debug: true
163
167
  };
164
168
 
@@ -196,11 +200,28 @@
196
200
  // use a timeout to make sure adding and removing .activating is not
197
201
  // coalesced into a single step
198
202
  setTimeout(function(){
199
- that.$popover.removeClass('activating').addClass('active');
200
-
201
- that.positionPopover();
203
+
204
+ // worst case scenario: our popover has already been removed again
205
+ if ( !this.exists() ) {
206
+ return false;
207
+ }
208
+
209
+ if (that.options.cssTransitionSupport) {
210
+
211
+ that.positionPopover();
212
+
213
+ this.$popover.one('transitionEnd webkitTransitionEnd', function() {
214
+ _executeCallbacksFor.call(that, 'afterShow', that.$anchorElement, that.$popover);
215
+ });
216
+
217
+ this.$popover.removeClass('activating').addClass('active');
218
+
219
+ } else {
220
+ that.$popover.removeClass('activating').addClass('active');
221
+ that.positionPopover();
222
+ _executeCallbacksFor.call(this, 'afterShow', this.$anchorElement, this.$popover);
223
+ }
202
224
 
203
- _executeCallbacksFor.call(this, 'afterShow', this.$anchorElement, this.$popover);
204
225
  }.bind(this), 1);
205
226
  };
206
227
 
@@ -211,14 +232,29 @@
211
232
  return false;
212
233
  }
213
234
 
214
- this.$popover.removeClass('active');
215
-
216
235
  if (this.options.cssTransitionSupport) {
217
- this.$popover.addClass('deactivating');
218
236
 
219
237
  this.$popover.one('transitionEnd webkitTransitionEnd', function() {
220
238
  that.$popover.removeClass('deactivating');
239
+
240
+ if (that.options.disposable) {
241
+ _removePopover.call(that);
242
+ }
243
+
244
+ _executeCallbacksFor.call(that, 'afterHide', that.$anchorElement, that.$popover);
221
245
  });
246
+
247
+ this.$popover.removeClass('active').addClass('deactivating');
248
+
249
+ } else {
250
+
251
+ this.$popover.removeClass('active');
252
+
253
+ if (this.options.disposable) {
254
+ _removePopover.call(this);
255
+ }
256
+
257
+ _executeCallbacksFor.call(this, 'afterHide', this.$anchorElement, this.$popover);
222
258
  }
223
259
  };
224
260
 
@@ -236,6 +272,23 @@
236
272
  $('body').append(this.$popover);
237
273
  _executeCallbacksFor.call(this, 'afterCreate', this.$anchorElement, this.$popover);
238
274
  };
275
+
276
+ /**
277
+ * Remove the popover markup from the DOM
278
+ *
279
+ * @memberOf Attache
280
+ * @private
281
+ */
282
+ _removePopover = function _removePopover() {
283
+ if ( !this.exists() ) {
284
+ return;
285
+ }
286
+
287
+ this.$popover.remove();
288
+ this.$popover = null;
289
+
290
+ // _executeCallbacksFor.call(this, 'afterCreate', this.$anchorElement, this.$popover);
291
+ };
239
292
 
240
293
  /**
241
294
  * Position or reposition the popover. If positioning fails, i.e. the popover is off-viewport, retry with options.alternativePositions
@@ -252,6 +305,10 @@
252
305
  success = false,
253
306
  position;
254
307
 
308
+ if ( !this.exists() ) {
309
+ return false;
310
+ }
311
+
255
312
  if (typeof positionLabel === 'undefined') {
256
313
  positionLabel = this.currentPositionLabel;
257
314
  }
@@ -432,7 +489,7 @@
432
489
  * @returns {Boolean}
433
490
  */
434
491
  exists = function exists() {
435
- return typeof this.$popover !== 'undefined' && this.$popover.length === 1;
492
+ return typeof this.$popover !== 'undefined' && this.$popover !== null && this.$popover.length === 1;
436
493
  };
437
494
 
438
495
  /**
@@ -474,7 +531,7 @@
474
531
  return false;
475
532
  }
476
533
 
477
- this.$popover.remove();
534
+ _removePopover.call(this);
478
535
  };
479
536
 
480
537
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attachejs",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "homepage": "https://github.com/janfoeh/attachejs",
5
5
  "authors": [
6
6
  "Jan-Christian Foeh <jan@programmanstalt.de>"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kea-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan-Christian Foeh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails