sudojs-rails 0.3.1 → 0.3.2
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.
- data/Rakefile +4 -4
- data/lib/sudojs/version.rb +1 -1
- data/vendor/assets/javascripts/sudo-x.js +35 -22
- data/vendor/assets/javascripts/sudo.js +6 -4
- metadata +4 -4
data/Rakefile
CHANGED
@@ -11,10 +11,10 @@ namespace :sudojs do
|
|
11
11
|
desc "Download the latest released versions sudo.js as well as Ecmascript-5 shims for non-standard browsers"
|
12
12
|
task :download_latest do
|
13
13
|
files = {
|
14
|
-
'sudo.js'=>'https://raw.github.com/
|
15
|
-
'sudo-x.js' => 'https://raw.github.com/
|
16
|
-
'es5-shim.js' => 'https://raw.github.com/
|
17
|
-
'es5-sham.js' => 'https://raw.github.com/
|
14
|
+
'sudo.js'=>'https://raw.github.com/taskrabbit/sudojs/master/build/debug/sudo.js',
|
15
|
+
'sudo-x.js' => 'https://raw.github.com/taskrabbit/sudojs/master/build/debug/sudo-x.js',
|
16
|
+
'es5-shim.js' => 'https://raw.github.com/taskrabbit/sudojs/master/lib/es5-shim/es5-shim.js',
|
17
|
+
'es5-sham.js' => 'https://raw.github.com/taskrabbit/sudojs/master/lib/es5-shim/es5-sham.js'
|
18
18
|
}
|
19
19
|
|
20
20
|
vendor_dir = "vendor/assets/javascripts"
|
data/lib/sudojs/version.rb
CHANGED
@@ -418,6 +418,8 @@ sudo.Container.prototype.removeChild = function removeChild(arg) {
|
|
418
418
|
delete this.childNames[c.name];
|
419
419
|
// child is now an `orphan`
|
420
420
|
delete c.parent;
|
421
|
+
delete c.index;
|
422
|
+
delete c.name;
|
421
423
|
this._indexChildren_(i);
|
422
424
|
return this;
|
423
425
|
};
|
@@ -459,7 +461,7 @@ sudo.Container.prototype.send = function send(/*args*/) {
|
|
459
461
|
args[0].sendMethod || void 0;
|
460
462
|
}
|
461
463
|
// target is either specified or my parent
|
462
|
-
targ = d && d.sendTarget || this.
|
464
|
+
targ = d && d.sendTarget || this.bubble();
|
463
465
|
// obvious chance for errors here, don't be dumb
|
464
466
|
fn = targ[meth];
|
465
467
|
while(!fn && (targ = targ.bubble())) {
|
@@ -655,8 +657,8 @@ sudo.ViewController.prototype.doMapping = function() {
|
|
655
657
|
// Helper for instantiateChildren
|
656
658
|
// `private`
|
657
659
|
sudo.ViewController.prototype._handleObserve_ = function _handleObserve_(obs, c) {
|
658
|
-
var obj = obs.object ? this._objectForPath_(obs.object) : this;
|
659
|
-
|
660
|
+
var obj = obs.object ? this._objectForPath_(obs.object) : this.model;
|
661
|
+
obj.observe(c[obs.cb].bind(c));
|
660
662
|
};
|
661
663
|
// ###instantiateChildren
|
662
664
|
// instantiate the children described in the passed in array or the `descriptors` array
|
@@ -810,7 +812,7 @@ sudo.template = function template(str, data, scope) {
|
|
810
812
|
template.source = 'function(' + scope + '){\n' + source + '}';
|
811
813
|
return template;
|
812
814
|
};
|
813
|
-
// ##
|
815
|
+
// ##DataView Class Object
|
814
816
|
|
815
817
|
// Create an instance of an Object, inheriting from sudo.View that:
|
816
818
|
// 1. Expects to have a template located in its internal data Store accessible via `this.get('template')`.
|
@@ -824,7 +826,7 @@ sudo.template = function template(str, data, scope) {
|
|
824
826
|
// extension object
|
825
827
|
//
|
826
828
|
//`constructor`
|
827
|
-
sudo.
|
829
|
+
sudo.DataView = function(el, data) {
|
828
830
|
var d = data || {}, t;
|
829
831
|
sudo.View.call(this, el, d);
|
830
832
|
// implements the listener extension
|
@@ -841,17 +843,15 @@ sudo.Dataview = function(el, data) {
|
|
841
843
|
if((t = d.template)) {
|
842
844
|
if(typeof t === 'string') this.model.data.template = sudo.template(t);
|
843
845
|
}
|
844
|
-
|
845
|
-
|
846
|
-
this.init();
|
847
|
-
}
|
846
|
+
this.bindEvents();
|
847
|
+
if(this.role === 'dataview') this.init();
|
848
848
|
};
|
849
849
|
// `private`
|
850
|
-
sudo.inherit(sudo.View, sudo.
|
850
|
+
sudo.inherit(sudo.View, sudo.DataView);
|
851
851
|
// ###addedToParent
|
852
852
|
// Container's will check for the presence of this method and call it if it is present
|
853
853
|
// after adding a child - essentially, this will auto render the dataview when added to a parent
|
854
|
-
sudo.
|
854
|
+
sudo.DataView.prototype.addedToParent = function(parent) {
|
855
855
|
return this.render();
|
856
856
|
};
|
857
857
|
// ###removeFromParent
|
@@ -859,7 +859,7 @@ sudo.Dataview.prototype.addedToParent = function() {
|
|
859
859
|
// Overrides `sudo.View.removeFromParent` to actually remove the DOM as well
|
860
860
|
//
|
861
861
|
// `returns` {Object} `this`
|
862
|
-
sudo.
|
862
|
+
sudo.DataView.prototype.removeFromParent = function removeFromParent() {
|
863
863
|
this.parent.removeChild(this);
|
864
864
|
this.$el.remove();
|
865
865
|
return this;
|
@@ -875,10 +875,11 @@ sudo.Dataview.prototype.removeFromParent = function removeFromParent() {
|
|
875
875
|
// `param` {object} `change` dataviews may be observing their model if `autoRender: true`
|
876
876
|
//
|
877
877
|
// `returns` {Object} `this`
|
878
|
-
sudo.
|
878
|
+
sudo.DataView.prototype.render = function render(change) {
|
879
|
+
var d;
|
879
880
|
// return early if a `blacklisted` key is set to my model
|
880
881
|
if(change && this.autoRenderBlacklist[change.name]) return this;
|
881
|
-
|
882
|
+
d = this.model.data;
|
882
883
|
this.$el.html(d.template(d));
|
883
884
|
if(d.renderTarget) {
|
884
885
|
this._normalizedEl_(d.renderTarget)[d.renderMethod || 'append'](this.$el);
|
@@ -887,7 +888,7 @@ sudo.Dataview.prototype.render = function render(change) {
|
|
887
888
|
return this;
|
888
889
|
};
|
889
890
|
// `private`
|
890
|
-
sudo.
|
891
|
+
sudo.DataView.prototype.role = 'dataview';
|
891
892
|
// ##Navigator Class Object
|
892
893
|
|
893
894
|
// Abstracts location and history events, parsing their information into a
|
@@ -923,12 +924,22 @@ sudo.Navigator.prototype.getFragment = function getFragment(fragment) {
|
|
923
924
|
}
|
924
925
|
return decodeURIComponent(fragment.replace(this.leadingStripper, ''));
|
925
926
|
};
|
927
|
+
// ###getHash
|
928
|
+
// Check either the passed in fragment, or the full location.href
|
929
|
+
// for a `hash` value
|
930
|
+
//
|
931
|
+
// `param` {string} `fragment` Optional fragment to check
|
926
932
|
// `returns` {String} the normalized current `hash`
|
927
933
|
sudo.Navigator.prototype.getHash = function getHash(fragment) {
|
928
934
|
fragment || (fragment = window.location.href);
|
929
935
|
var match = fragment.match(/#(.*)$/);
|
930
936
|
return match ? match[1] : '';
|
931
937
|
};
|
938
|
+
// ###getSearch
|
939
|
+
// Check either the passed in fragment, or the full location.href
|
940
|
+
// for a `search` value
|
941
|
+
//
|
942
|
+
// `param` {string} `fragment` Optional fragment to check
|
932
943
|
// `returns` {String} the normalized current `search`
|
933
944
|
sudo.Navigator.prototype.getSearch = function getSearch(fragment) {
|
934
945
|
fragment || (fragment = window.location.href);
|
@@ -1008,7 +1019,9 @@ sudo.Navigator.prototype.setData = function setData() {
|
|
1008
1019
|
};
|
1009
1020
|
// ###start
|
1010
1021
|
// Gather the necessary information about the current environment and
|
1011
|
-
// bind to either (push|pop)state or hashchange
|
1022
|
+
// bind to either (push|pop)state or hashchange.
|
1023
|
+
// Also, if given an imcorrect URL for the current environment (hashchange
|
1024
|
+
// vs pushState) normalize it and set accordingly.
|
1012
1025
|
//
|
1013
1026
|
// `returns` {object} `this`
|
1014
1027
|
sudo.Navigator.prototype.start = function start() {
|
@@ -1114,13 +1127,13 @@ sudo.extensions.observable = {
|
|
1114
1127
|
// Allow an array of callbacks to be registered as changeRecord recipients
|
1115
1128
|
//
|
1116
1129
|
// `param` {Array} ary
|
1117
|
-
// `returns` {
|
1130
|
+
// `returns` {Array} the Array passed in to observe
|
1118
1131
|
observes: function observes(ary) {
|
1119
1132
|
var i;
|
1120
1133
|
for(i = 0; i < ary.length; i++) {
|
1121
1134
|
this.observe(ary[i]);
|
1122
1135
|
}
|
1123
|
-
return
|
1136
|
+
return ary;
|
1124
1137
|
},
|
1125
1138
|
// ###set
|
1126
1139
|
// Overrides sudo.Base.set to check for observers
|
@@ -1529,7 +1542,7 @@ sudo.extensions.persistable = {
|
|
1529
1542
|
// ###create
|
1530
1543
|
//
|
1531
1544
|
// Save this model on the server. If a subset of this model's attributes
|
1532
|
-
//
|
1545
|
+
// have not been stated (ajax:{data:{...}}) send all of the model's data.
|
1533
1546
|
// Anticipate that the server response will send back the
|
1534
1547
|
// state of the model on the server and set it here (via a success callback).
|
1535
1548
|
//
|
@@ -1539,8 +1552,8 @@ sudo.extensions.persistable = {
|
|
1539
1552
|
return this._sendData_('POST', params);
|
1540
1553
|
},
|
1541
1554
|
// ###destroy
|
1542
|
-
|
1543
|
-
//
|
1555
|
+
//
|
1556
|
+
// Delete this model on the server
|
1544
1557
|
//
|
1545
1558
|
// `param` {object} `params` Optional hash of options for the XHR
|
1546
1559
|
// `returns` {object} jqXhr
|
@@ -1716,7 +1729,7 @@ sudo.delegates.Data.prototype.filter = function(obj) {
|
|
1716
1729
|
// `private`
|
1717
1730
|
sudo.delegates.Data.prototype.role = 'data';
|
1718
1731
|
|
1719
|
-
sudo.version = "0.9.
|
1732
|
+
sudo.version = "0.9.3";
|
1720
1733
|
window.sudo = sudo;
|
1721
1734
|
if(typeof window._ === "undefined") window._ = sudo;
|
1722
1735
|
}).call(this, this);
|
@@ -418,6 +418,8 @@ sudo.Container.prototype.removeChild = function removeChild(arg) {
|
|
418
418
|
delete this.childNames[c.name];
|
419
419
|
// child is now an `orphan`
|
420
420
|
delete c.parent;
|
421
|
+
delete c.index;
|
422
|
+
delete c.name;
|
421
423
|
this._indexChildren_(i);
|
422
424
|
return this;
|
423
425
|
};
|
@@ -459,7 +461,7 @@ sudo.Container.prototype.send = function send(/*args*/) {
|
|
459
461
|
args[0].sendMethod || void 0;
|
460
462
|
}
|
461
463
|
// target is either specified or my parent
|
462
|
-
targ = d && d.sendTarget || this.
|
464
|
+
targ = d && d.sendTarget || this.bubble();
|
463
465
|
// obvious chance for errors here, don't be dumb
|
464
466
|
fn = targ[meth];
|
465
467
|
while(!fn && (targ = targ.bubble())) {
|
@@ -639,13 +641,13 @@ sudo.extensions.observable = {
|
|
639
641
|
// Allow an array of callbacks to be registered as changeRecord recipients
|
640
642
|
//
|
641
643
|
// `param` {Array} ary
|
642
|
-
// `returns` {
|
644
|
+
// `returns` {Array} the Array passed in to observe
|
643
645
|
observes: function observes(ary) {
|
644
646
|
var i;
|
645
647
|
for(i = 0; i < ary.length; i++) {
|
646
648
|
this.observe(ary[i]);
|
647
649
|
}
|
648
|
-
return
|
650
|
+
return ary;
|
649
651
|
},
|
650
652
|
// ###set
|
651
653
|
// Overrides sudo.Base.set to check for observers
|
@@ -809,7 +811,7 @@ sudo.extensions.observable = {
|
|
809
811
|
return this.deliverChangeRecords();
|
810
812
|
}
|
811
813
|
};
|
812
|
-
sudo.version = "0.9.
|
814
|
+
sudo.version = "0.9.3";
|
813
815
|
window.sudo = sudo;
|
814
816
|
if(typeof window._ === "undefined") window._ = sudo;
|
815
817
|
}).call(this, this);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sudojs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
segments:
|
80
80
|
- 0
|
81
|
-
hash:
|
81
|
+
hash: 2964322839606070983
|
82
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
segments:
|
89
89
|
- 0
|
90
|
-
hash:
|
90
|
+
hash: 2964322839606070983
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
93
|
rubygems_version: 1.8.24
|