sudojs-rails 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sudojs/version.rb +1 -1
- data/vendor/assets/javascripts/sudojs/sudo.js +15 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ce00bbcc867422371ddb22d8105e34d97ac4b5f
|
4
|
+
data.tar.gz: 223bafb13bd62591e3d048c3e0b7de721115f6e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 162bf0d1c377bb2b5b1dbcec422d12536f2ad6d43e7bcd3a9f65b703446c030afa50992dcb168dd3e485f3643f51ec39ae9e93895836fc8d1d6f2181245dd3e3
|
7
|
+
data.tar.gz: bc2fcbdc78e33b4d0805af2a601535db81032b043fa97a1ac139946a2879d5b768f9b16e0908f3f2b8de33c568b6814ae972ca1c4bf8a0c5598d538797cf8d59
|
data/lib/sudojs/version.rb
CHANGED
@@ -770,16 +770,14 @@ sudo.DataView = function(el, data) {
|
|
770
770
|
sudo.View.call(this, el, data);
|
771
771
|
// implements the listener extension
|
772
772
|
$.extend(this, sudo.extensions.listener);
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
// only call the initial build if not an autoRender type
|
782
|
-
else this.build();
|
773
|
+
if(this.model.data.autoRender) {
|
774
|
+
// dont autoRender on the setting of events,
|
775
|
+
this.autoRenderBlacklist = {event: true, events: true};
|
776
|
+
// autoRender types observe their own model
|
777
|
+
if(!this.model.observe) $.extend(this.model, sudo.extensions.observable);
|
778
|
+
// you may need to override `build` if you provide a template and the data
|
779
|
+
// isnt hydrated (as that is the expectation)
|
780
|
+
} else this.build();
|
783
781
|
if(this.role === 'dataview') this.init();
|
784
782
|
};
|
785
783
|
// `private`
|
@@ -790,8 +788,10 @@ sudo.inherit(sudo.View, sudo.DataView);
|
|
790
788
|
// if not an autoRender (which will render on model change), as well as setup the events (in children too)
|
791
789
|
sudo.DataView.prototype.addedToParent = function(parent) {
|
792
790
|
this.bindEvents();
|
793
|
-
// autoRender
|
791
|
+
// non-autoRender types should render now
|
794
792
|
if(!this.model.data.autoRender) return this.render();
|
793
|
+
// autoRender Dataviews should only render on model change
|
794
|
+
else this.observer = this.model.observe(this.render.bind(this));
|
795
795
|
return this;
|
796
796
|
};
|
797
797
|
// ###build
|
@@ -819,6 +819,8 @@ sudo.DataView.prototype.build = function build() {
|
|
819
819
|
sudo.DataView.prototype.removeFromParent = function removeFromParent(keep) {
|
820
820
|
this.parent.removeChild(this);
|
821
821
|
this.unbindEvents().$el[keep ? 'detach' : 'remove']();
|
822
|
+
// in the case that this.model is 'foreign'
|
823
|
+
if(this.observer) this.model.unobserve(this.observer);
|
822
824
|
return this;
|
823
825
|
};
|
824
826
|
// ###render
|
@@ -833,15 +835,14 @@ sudo.DataView.prototype.removeFromParent = function removeFromParent(keep) {
|
|
833
835
|
//
|
834
836
|
// `returns` {Object} `this`
|
835
837
|
sudo.DataView.prototype.render = function render(change) {
|
836
|
-
var d;
|
837
838
|
// return early if a `blacklisted` key is set to my model
|
838
839
|
if(change && this.autoRenderBlacklist[change.name]) return this;
|
839
|
-
d = this.model.data;
|
840
840
|
// has `build` been executed already? If not call it again
|
841
841
|
if(!this.built) this.build();
|
842
842
|
// if there is no template by this point *you are doing it wrong*
|
843
843
|
// erase the flag
|
844
844
|
else this.built = false;
|
845
|
+
d = this.model.data;
|
845
846
|
if(d.renderTarget) {
|
846
847
|
this._normalizedEl_(d.renderTarget)[d.renderMethod || 'append'](this.$el);
|
847
848
|
delete d.renderTarget;
|
@@ -1468,6 +1469,7 @@ sudo.extensions.persistable = {
|
|
1468
1469
|
//
|
1469
1470
|
// `param` {string} `base` the baseUrl set in this models ajax options
|
1470
1471
|
url: function url(base) {
|
1472
|
+
if(!base) return void 0;
|
1471
1473
|
// could possibly be 0...
|
1472
1474
|
if('id' in this.data) {
|
1473
1475
|
return base + (base.charAt(base.length - 1) === '/' ?
|
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.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- robrobbins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-24 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.
|