sudojs-rails 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sudojs/version.rb +1 -1
- data/vendor/assets/javascripts/sudojs/sudo-x.js +13 -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: 052b161f2a4cf96dc045cf19a5ac2430e5292b29
|
4
|
+
data.tar.gz: 6a7bcb1da37e0be82a59e3573ec73a9bca335d10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8811c9b9d8ec57cc7402963a56febee654c26b12e0e169ed6ca9c8d941c97cdc5df4c49e700d4b3f173170da7e8f66788cf013df8c47024a04edb2c04f965745
|
7
|
+
data.tar.gz: c906fbb67a79a3263b6c2fb64fb68be9e54d06552bb0c3978eb30218bd91a974b20975939104c5c65cfba2c1c59568e1978da4efcd960351b5e19b23b38d0b82
|
data/lib/sudojs/version.rb
CHANGED
@@ -842,8 +842,7 @@ sudo.template = function template(str, data, scope) {
|
|
842
842
|
//
|
843
843
|
//`constructor`
|
844
844
|
sudo.DataView = function(el, data) {
|
845
|
-
|
846
|
-
sudo.View.call(this, el, d);
|
845
|
+
sudo.View.call(this, el, data);
|
847
846
|
// implements the listener extension
|
848
847
|
$.extend(this, sudo.extensions.listener);
|
849
848
|
// dataview's models are observable, make it so if not already
|
@@ -853,12 +852,8 @@ sudo.DataView = function(el, data) {
|
|
853
852
|
this.autoRenderBlacklist = {event: true, events: true};
|
854
853
|
// if autorendering, observe your own model
|
855
854
|
// use this ref to unobserve if desired
|
856
|
-
if(
|
857
|
-
|
858
|
-
if((t = d.template)) {
|
859
|
-
if(typeof t === 'string') this.model.data.template = sudo.template(t);
|
860
|
-
}
|
861
|
-
this.build();
|
855
|
+
if(this.model.data.autoRender) this.observer = this.model.observe(this.render.bind(this));
|
856
|
+
this.build();
|
862
857
|
this.bindEvents();
|
863
858
|
if(this.role === 'dataview') this.init();
|
864
859
|
};
|
@@ -873,9 +868,13 @@ sudo.DataView.prototype.addedToParent = function(parent) {
|
|
873
868
|
// ###build
|
874
869
|
// Construct the innerHTML of the $el here so that the behavior of the
|
875
870
|
// DataView, that the markup is ready after a subclass calls `this.construct`,
|
876
|
-
// is the same as other View classes
|
871
|
+
// is the same as other View classes -- IF there is a template available
|
872
|
+
// there may not be yet as some get added later by a ViewController
|
877
873
|
sudo.DataView.prototype.build = function build() {
|
878
|
-
|
874
|
+
var t;
|
875
|
+
if(!(t = this.model.data.template)) return;
|
876
|
+
if(typeof t === 'string') t = sudo.template(t);
|
877
|
+
this.$el.html(t(this.model.data));
|
879
878
|
this.built = true;
|
880
879
|
return this;
|
881
880
|
};
|
@@ -905,9 +904,10 @@ sudo.DataView.prototype.render = function render(change) {
|
|
905
904
|
// return early if a `blacklisted` key is set to my model
|
906
905
|
if(change && this.autoRenderBlacklist[change.name]) return this;
|
907
906
|
d = this.model.data;
|
908
|
-
// has `build` been
|
909
|
-
if(!this.built) this
|
910
|
-
|
907
|
+
// has `build` been executed already? If not call it again
|
908
|
+
if(!this.built) this.build();
|
909
|
+
// if there is no template by this point *you are doing it wrong*
|
910
|
+
// erase the flag
|
911
911
|
else this.built = false;
|
912
912
|
if(d.renderTarget) {
|
913
913
|
this._normalizedEl_(d.renderTarget)[d.renderMethod || 'append'](this.$el);
|
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.
|
4
|
+
version: 0.4.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-06-
|
11
|
+
date: 2013-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|