sudojs-rails 0.4.8 → 0.4.9

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: 749b82adc40d69bcf3d577ee8eb1823ab0227672
4
- data.tar.gz: 2b780d7060f01ecfb6a3e60abeac11c3e34767e3
3
+ metadata.gz: d992bf4b05abd85ca7c01e0a3b2b4dfcd9d61834
4
+ data.tar.gz: 04a5998a9ed91aa16870b280a4cf978e4d47066f
5
5
  SHA512:
6
- metadata.gz: 5d5e9b10cc795e4799a9037e5dce5af4cc0b45eae28c9c2e1b5940c7001122d280eb56f34b484f02b05ab466d1516a0beb10696a5c07120b76e9e66397e38974
7
- data.tar.gz: 6109a38157cab48e991c27e7d41ce6be4630b1da9d992bf01e70a65912aabc25f22c4142a5ee5152a9cff6a98e499f351f7da5dd124baeff13a987e14cef66c1
6
+ metadata.gz: 7de7f91acd795c1011aad94f3c9aaf4268f0711383152e5a872db98cff3714f9057e6e7ae691e570b31ecb2b24597fcc7d6cec460e52090ba4418aba3123f79d
7
+ data.tar.gz: 3e316fa6732f2cd5007cbc85f08634316c6aeebffc7a7cd2a5e7b254b32d20afb3b30329b6bff51ed3890dee211c7cd1c371929225ffb028980634ba420b4503
@@ -1,3 +1,3 @@
1
1
  module Sudojs
2
- VERSION = '0.4.8'
2
+ VERSION = '0.4.9'
3
3
  end
@@ -403,6 +403,22 @@ sudo.Container.prototype.addChildren = function addChildren(arg) {
403
403
  //
404
404
  // `returns` {Object|undefined}
405
405
  sudo.Container.prototype.bubble = function bubble() {return this.parent;};
406
+ // ###eachChild
407
+ // Call a named method and pass any args to each child in a container's
408
+ // collection of children
409
+ //
410
+ // `param` {*} Any number of arguments the first of which must be
411
+ // The named method to look for and call. Other args are passed through
412
+ // `returns` {object} `this`
413
+ sudo.Container.prototype.eachChild = function eachChild(/*args*/) {
414
+ var args = Array.prototype.slice.call(arguments),
415
+ which = args.shift(), i, len, curr;
416
+ for (i = 0, len = this.children.length; i < len; i++) {
417
+ curr = this.children[i];
418
+ if(which in curr) curr[which].apply(curr, args);
419
+ }
420
+ return this;
421
+ };
406
422
  // ###getChild
407
423
  // If a child was added with a name, via `addChild`,
408
424
  // that object can be fetched by name. This prevents us from having to reference a
@@ -892,9 +908,13 @@ sudo.inherit(sudo.View, sudo.DataView);
892
908
  // ###addedToParent
893
909
  // Container's will check for the presence of this method and call it if it is present
894
910
  // after adding a child - essentially, this will auto render the dataview when added to a parent
895
- // as well as setup the events
911
+ // if not an autoRender (which will render on model change), as well as setup the events (in children too)
896
912
  sudo.DataView.prototype.addedToParent = function(parent) {
897
- return this.bindEvents().render();
913
+ this.bindEvents();
914
+ this.eachChild('bindEvents');
915
+ // autoRender Dataviews should only render on model change
916
+ if(!this.model.data.autoRender) return this.render();
917
+ return this;
898
918
  };
899
919
  // ###build
900
920
  // Construct the innerHTML of the $el here so that the behavior of the
@@ -909,15 +929,18 @@ sudo.DataView.prototype.build = function build() {
909
929
  this.built = true;
910
930
  return this;
911
931
  };
932
+
912
933
  // ###removeFromParent
913
934
  // Remove this object from the DOM and its parent's list of children.
914
- // Overrides `sudo.View.removeFromParent` to actually remove the DOM as well
935
+ // Overrides `sudo.View.removeFromParent` to unbind events and remove its $el
936
+ // as well if passed a truthy value otherwise will $.detach its $el
915
937
  //
938
+ // `param` {bool} `remove` should this Object $el.remove or $el.detach?
916
939
  // `returns` {Object} `this`
917
- sudo.DataView.prototype.removeFromParent = function removeFromParent() {
940
+ sudo.DataView.prototype.removeFromParent = function removeFromParent(remove) {
918
941
  this.parent.removeChild(this);
919
- // all events need to be unbound to avoid memory leaks
920
- this.unbindEvents().$el.remove();
942
+ this.unbindEvents().$el[remove ? 'remove' : 'detach']();
943
+ this.eachChild('unbindEvents');
921
944
  return this;
922
945
  };
923
946
  // ###render
@@ -1846,7 +1869,7 @@ sudo.delegates.Data.prototype.removeFilter = function removeFilter(key) {
1846
1869
  // `private`
1847
1870
  sudo.delegates.Data.prototype.role = 'data';
1848
1871
 
1849
- sudo.version = "0.9.5";
1872
+ sudo.version = "0.9.6";
1850
1873
  window.sudo = sudo;
1851
1874
  if(typeof window._ === "undefined") window._ = sudo;
1852
1875
  }).call(this, this);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sudojs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - robrobbins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-25 00:00:00.000000000 Z
11
+ date: 2013-07-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Install the latest versions of sudo.js and provide generators for fast
14
14
  and easy use.