serenade_rails 0.2.0 → 0.2.1
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/lib/assets/javascripts/serenade.js +92 -247
- data/lib/serenade_rails/version.rb +1 -1
- metadata +8 -8
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Serenade.js JavaScript Framework v0.2.
|
2
|
+
* Serenade.js JavaScript Framework v0.2.1
|
3
3
|
* http://github.com/elabs/serenade.js
|
4
4
|
*
|
5
5
|
* Copyright 2011, Jonas Nicklas, Elabs AB
|
@@ -109,6 +109,20 @@
|
|
109
109
|
isArray: function(object) {
|
110
110
|
return Object.prototype.toString.call(object) === "[object Array]";
|
111
111
|
},
|
112
|
+
indexOf: function(object, search) {
|
113
|
+
var index, item, _i, _len;
|
114
|
+
if (typeof Array.prototype.indexOf === "function") {
|
115
|
+
return Array.prototype.indexOf.call(object, search);
|
116
|
+
} else {
|
117
|
+
for (index = _i = 0, _len = object.length; _i < _len; index = ++_i) {
|
118
|
+
item = object[index];
|
119
|
+
if (item === search) {
|
120
|
+
return index;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
return -1;
|
124
|
+
}
|
125
|
+
},
|
112
126
|
pairToObject: function(one, two) {
|
113
127
|
var temp;
|
114
128
|
temp = {};
|
@@ -202,12 +216,12 @@
|
|
202
216
|
};require['./collection'] = new function() {
|
203
217
|
var exports = this;
|
204
218
|
(function() {
|
205
|
-
var Events, extend, get, getLength, isArrayIndex, serializeObject, _ref,
|
219
|
+
var Events, extend, get, getLength, indexOf, isArrayIndex, serializeObject, _ref,
|
206
220
|
__slice = [].slice;
|
207
221
|
|
208
222
|
Events = require('./events').Events;
|
209
223
|
|
210
|
-
_ref = require('./helpers'), extend = _ref.extend, serializeObject = _ref.serializeObject, get = _ref.get;
|
224
|
+
_ref = require('./helpers'), indexOf = _ref.indexOf, extend = _ref.extend, serializeObject = _ref.serializeObject, get = _ref.get;
|
211
225
|
|
212
226
|
isArrayIndex = function(index) {
|
213
227
|
return index.match(/^\d+$/);
|
@@ -364,18 +378,7 @@
|
|
364
378
|
};
|
365
379
|
|
366
380
|
Collection.prototype.indexOf = function(search) {
|
367
|
-
|
368
|
-
if (typeof Array.prototype.indexOf === "function") {
|
369
|
-
return Array.prototype.indexOf.call(this, search);
|
370
|
-
} else {
|
371
|
-
for (index = _i = 0, _len = this.length; _i < _len; index = ++_i) {
|
372
|
-
item = this[index];
|
373
|
-
if (item === search) {
|
374
|
-
return index;
|
375
|
-
}
|
376
|
-
}
|
377
|
-
return -1;
|
378
|
-
}
|
381
|
+
return indexOf(this, search);
|
379
382
|
};
|
380
383
|
|
381
384
|
Collection.prototype.lastIndexOf = function(search) {
|
@@ -657,7 +660,7 @@
|
|
657
660
|
};require['./properties'] = new function() {
|
658
661
|
var exports = this;
|
659
662
|
(function() {
|
660
|
-
var AssociationCollection, Associations, Collection, Events, Properties, addDependencies, addGlobalDependencies, define, exp, extend, get, globalDependencies, pairToObject, prefix, serializeObject, triggerChangesTo, triggerGlobal, _ref,
|
663
|
+
var AssociationCollection, Associations, Collection, Events, Properties, addDependencies, addGlobalDependencies, define, exp, extend, get, globalDependencies, indexOf, pairToObject, prefix, serializeObject, triggerChangesTo, triggerGlobal, _ref,
|
661
664
|
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
662
665
|
__hasProp = {}.hasOwnProperty;
|
663
666
|
|
@@ -667,7 +670,7 @@
|
|
667
670
|
|
668
671
|
Events = require('./events').Events;
|
669
672
|
|
670
|
-
_ref = require('./helpers'), pairToObject = _ref.pairToObject, serializeObject = _ref.serializeObject, extend = _ref.extend, get = _ref.get;
|
673
|
+
_ref = require('./helpers'), indexOf = _ref.indexOf, pairToObject = _ref.pairToObject, serializeObject = _ref.serializeObject, extend = _ref.extend, get = _ref.get;
|
671
674
|
|
672
675
|
prefix = "_prop_";
|
673
676
|
|
@@ -718,7 +721,7 @@
|
|
718
721
|
_ref1 = name.split(/[:\.]/), name = _ref1[0], subname = _ref1[1];
|
719
722
|
}
|
720
723
|
object[_name = "_dep_" + name] || (object[_name] = []);
|
721
|
-
if (object["_dep_" + name]
|
724
|
+
if (indexOf(object["_dep_" + name], dependency) === -1) {
|
722
725
|
_results.push(object["_dep_" + name].push(dependency));
|
723
726
|
} else {
|
724
727
|
_results.push(void 0);
|
@@ -773,7 +776,7 @@
|
|
773
776
|
_results = [];
|
774
777
|
for (_i = 0, _len = dependencies.length; _i < _len; _i++) {
|
775
778
|
dependency = dependencies[_i];
|
776
|
-
if (
|
779
|
+
if (indexOf(names, dependency) === -1) {
|
777
780
|
names.push(dependency);
|
778
781
|
_results.push(findDependencies(dependency));
|
779
782
|
} else {
|
@@ -936,7 +939,9 @@
|
|
936
939
|
return get(this.get(name), 'id');
|
937
940
|
},
|
938
941
|
set: function(id) {
|
939
|
-
|
942
|
+
if (id != null) {
|
943
|
+
return this.set(name, attributes.as().find(id));
|
944
|
+
}
|
940
945
|
},
|
941
946
|
dependsOn: name,
|
942
947
|
serialize: attributes.serializeId
|
@@ -1053,7 +1058,11 @@
|
|
1053
1058
|
New.modelName = name;
|
1054
1059
|
|
1055
1060
|
function New() {
|
1056
|
-
|
1061
|
+
var val;
|
1062
|
+
val = New.__super__.constructor.apply(this, arguments);
|
1063
|
+
if (val) {
|
1064
|
+
return val;
|
1065
|
+
}
|
1057
1066
|
if (ctor) {
|
1058
1067
|
ctor.apply(this, arguments);
|
1059
1068
|
}
|
@@ -1128,7 +1137,7 @@
|
|
1128
1137
|
extend(Serenade.prototype, Properties);
|
1129
1138
|
|
1130
1139
|
extend(Serenade, {
|
1131
|
-
VERSION: '0.2.
|
1140
|
+
VERSION: '0.2.1',
|
1132
1141
|
_views: {},
|
1133
1142
|
_controllers: {},
|
1134
1143
|
document: typeof window !== "undefined" && window !== null ? window.document : void 0,
|
@@ -1141,8 +1150,8 @@
|
|
1141
1150
|
return new View(void 0, nameOrTemplate);
|
1142
1151
|
}
|
1143
1152
|
},
|
1144
|
-
render: function(name, model, controller, parent) {
|
1145
|
-
return this._views[name].render(model, controller, parent);
|
1153
|
+
render: function(name, model, controller, parent, skipCallback) {
|
1154
|
+
return this._views[name].render(model, controller, parent, skipCallback);
|
1146
1155
|
},
|
1147
1156
|
controller: function(name, klass) {
|
1148
1157
|
return this._controllers[name] = klass;
|
@@ -1217,7 +1226,7 @@
|
|
1217
1226
|
};require['./lexer'] = new function() {
|
1218
1227
|
var exports = this;
|
1219
1228
|
(function() {
|
1220
|
-
var IDENTIFIER, KEYWORDS, LITERAL, Lexer, MULTI_DENT, STRING, WHITESPACE,
|
1229
|
+
var COMMENT, IDENTIFIER, KEYWORDS, LITERAL, Lexer, MULTI_DENT, STRING, WHITESPACE,
|
1221
1230
|
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
1222
1231
|
|
1223
1232
|
IDENTIFIER = /^[a-zA-Z][a-zA-Z0-9\-_]*/;
|
@@ -1230,6 +1239,8 @@
|
|
1230
1239
|
|
1231
1240
|
WHITESPACE = /^[^\r\n\S]+/;
|
1232
1241
|
|
1242
|
+
COMMENT = /^\s*\/\/[^\n]*/;
|
1243
|
+
|
1233
1244
|
KEYWORDS = ["IF", "COLLECTION", "IN", "VIEW", "UNLESS"];
|
1234
1245
|
|
1235
1246
|
Lexer = (function() {
|
@@ -1249,7 +1260,7 @@
|
|
1249
1260
|
this.tokens = [];
|
1250
1261
|
i = 0;
|
1251
1262
|
while (this.chunk = this.code.slice(i)) {
|
1252
|
-
i += this.identifierToken() || this.whitespaceToken() || this.lineToken() || this.stringToken() || this.literalToken();
|
1263
|
+
i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.stringToken() || this.literalToken();
|
1253
1264
|
}
|
1254
1265
|
while (tag = this.ends.pop()) {
|
1255
1266
|
if (tag === 'OUTDENT') {
|
@@ -1258,9 +1269,24 @@
|
|
1258
1269
|
this.error("missing " + tag);
|
1259
1270
|
}
|
1260
1271
|
}
|
1272
|
+
while (this.tokens[0][0] === "TERMINATOR") {
|
1273
|
+
this.tokens.shift();
|
1274
|
+
}
|
1275
|
+
while (this.tokens[this.tokens.length - 1][0] === "TERMINATOR") {
|
1276
|
+
this.tokens.pop();
|
1277
|
+
}
|
1261
1278
|
return this.tokens;
|
1262
1279
|
};
|
1263
1280
|
|
1281
|
+
Lexer.prototype.commentToken = function() {
|
1282
|
+
var match;
|
1283
|
+
if (match = COMMENT.exec(this.chunk)) {
|
1284
|
+
return match[0].length;
|
1285
|
+
} else {
|
1286
|
+
return 0;
|
1287
|
+
}
|
1288
|
+
};
|
1289
|
+
|
1264
1290
|
Lexer.prototype.whitespaceToken = function() {
|
1265
1291
|
var match;
|
1266
1292
|
if (match = WHITESPACE.exec(this.chunk)) {
|
@@ -1563,7 +1589,7 @@
|
|
1563
1589
|
getValue = function(ast, model) {
|
1564
1590
|
if (ast.bound && ast.value) {
|
1565
1591
|
return get(model, ast.value, true);
|
1566
|
-
} else if (ast.value) {
|
1592
|
+
} else if (ast.value != null) {
|
1567
1593
|
return ast.value;
|
1568
1594
|
} else {
|
1569
1595
|
return model;
|
@@ -1662,8 +1688,9 @@
|
|
1662
1688
|
classes = classes.concat(value);
|
1663
1689
|
}
|
1664
1690
|
if (classes.length) {
|
1665
|
-
return element.
|
1691
|
+
return element.className = classes.join(' ');
|
1666
1692
|
} else {
|
1693
|
+
element.className = '';
|
1667
1694
|
return element.removeAttribute(ast.name);
|
1668
1695
|
}
|
1669
1696
|
} else if (value === void 0) {
|
@@ -1695,9 +1722,14 @@
|
|
1695
1722
|
if ((_ref1 = ast.classes) != null ? _ref1.length : void 0) {
|
1696
1723
|
element.setAttribute('class', ast.classes.join(' '));
|
1697
1724
|
}
|
1698
|
-
_ref2 = ast.
|
1725
|
+
_ref2 = ast.children;
|
1699
1726
|
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
1700
|
-
|
1727
|
+
child = _ref2[_i];
|
1728
|
+
compile(child, model, controller).append(element);
|
1729
|
+
}
|
1730
|
+
_ref3 = ast.properties;
|
1731
|
+
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
|
1732
|
+
property = _ref3[_j];
|
1701
1733
|
action = Property[property.scope];
|
1702
1734
|
if (action) {
|
1703
1735
|
action(property, node, model, controller);
|
@@ -1705,17 +1737,16 @@
|
|
1705
1737
|
throw SyntaxError("" + property.scope + " is not a valid scope");
|
1706
1738
|
}
|
1707
1739
|
}
|
1708
|
-
_ref3 = ast.children;
|
1709
|
-
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
|
1710
|
-
child = _ref3[_j];
|
1711
|
-
compile(child, model, controller).append(element);
|
1712
|
-
}
|
1713
1740
|
return node;
|
1714
1741
|
},
|
1715
1742
|
view: function(ast, model, parent) {
|
1716
|
-
var controller, element;
|
1717
|
-
controller = Serenade.controllerFor(ast["arguments"][0])
|
1718
|
-
|
1743
|
+
var controller, element, skipCallback;
|
1744
|
+
controller = Serenade.controllerFor(ast["arguments"][0]);
|
1745
|
+
if (!controller) {
|
1746
|
+
skipCallback = true;
|
1747
|
+
controller = parent;
|
1748
|
+
}
|
1749
|
+
element = Serenade.render(ast["arguments"][0], model, controller, parent, skipCallback);
|
1719
1750
|
return new Node(ast, element);
|
1720
1751
|
},
|
1721
1752
|
helper: function(ast, model, controller) {
|
@@ -1830,11 +1861,8 @@
|
|
1830
1861
|
return dynamic;
|
1831
1862
|
},
|
1832
1863
|
"in": function(ast, model, controller) {
|
1833
|
-
|
1834
|
-
|
1835
|
-
update = function() {
|
1836
|
-
var child, nodes, value;
|
1837
|
-
value = get(model, ast["arguments"][0]);
|
1864
|
+
return Compile.bound(ast, model, controller, function(dynamic, value) {
|
1865
|
+
var child, nodes;
|
1838
1866
|
if (value) {
|
1839
1867
|
nodes = (function() {
|
1840
1868
|
var _i, _len, _ref1, _results;
|
@@ -1850,19 +1878,11 @@
|
|
1850
1878
|
} else {
|
1851
1879
|
return dynamic.clear();
|
1852
1880
|
}
|
1853
|
-
};
|
1854
|
-
update();
|
1855
|
-
if (typeof model.bind === "function") {
|
1856
|
-
model.bind("change:" + ast["arguments"][0], update);
|
1857
|
-
}
|
1858
|
-
return dynamic;
|
1881
|
+
});
|
1859
1882
|
},
|
1860
1883
|
"if": function(ast, model, controller) {
|
1861
|
-
|
1862
|
-
|
1863
|
-
update = function() {
|
1864
|
-
var child, nodes, value;
|
1865
|
-
value = get(model, ast["arguments"][0]);
|
1884
|
+
return Compile.bound(ast, model, controller, function(dynamic, value) {
|
1885
|
+
var child, nodes;
|
1866
1886
|
if (value) {
|
1867
1887
|
nodes = (function() {
|
1868
1888
|
var _i, _len, _ref1, _results;
|
@@ -1878,19 +1898,11 @@
|
|
1878
1898
|
} else {
|
1879
1899
|
return dynamic.clear();
|
1880
1900
|
}
|
1881
|
-
};
|
1882
|
-
update();
|
1883
|
-
if (typeof model.bind === "function") {
|
1884
|
-
model.bind("change:" + ast["arguments"][0], update);
|
1885
|
-
}
|
1886
|
-
return dynamic;
|
1901
|
+
});
|
1887
1902
|
},
|
1888
1903
|
unless: function(ast, model, controller) {
|
1889
|
-
|
1890
|
-
|
1891
|
-
update = function() {
|
1892
|
-
var child, nodes, value;
|
1893
|
-
value = get(model, ast["arguments"][0]);
|
1904
|
+
return Compile.bound(ast, model, controller, function(dynamic, value) {
|
1905
|
+
var child, nodes;
|
1894
1906
|
if (value) {
|
1895
1907
|
return dynamic.clear();
|
1896
1908
|
} else {
|
@@ -1906,6 +1918,15 @@
|
|
1906
1918
|
})();
|
1907
1919
|
return dynamic.replace([nodes]);
|
1908
1920
|
}
|
1921
|
+
});
|
1922
|
+
},
|
1923
|
+
bound: function(ast, model, controller, callback) {
|
1924
|
+
var dynamic, update;
|
1925
|
+
dynamic = new DynamicNode(ast);
|
1926
|
+
update = function() {
|
1927
|
+
var value;
|
1928
|
+
value = get(model, ast["arguments"][0]);
|
1929
|
+
return callback(dynamic, value);
|
1909
1930
|
};
|
1910
1931
|
update();
|
1911
1932
|
if (typeof model.bind === "function") {
|
@@ -2232,185 +2253,7 @@ parse: function parse(input) {
|
|
2232
2253
|
return true;
|
2233
2254
|
}
|
2234
2255
|
};
|
2235
|
-
|
2236
|
-
var lexer = (function(){
|
2237
|
-
var lexer = ({EOF:1,
|
2238
|
-
parseError:function parseError(str, hash) {
|
2239
|
-
if (this.yy.parser) {
|
2240
|
-
this.yy.parser.parseError(str, hash);
|
2241
|
-
} else {
|
2242
|
-
throw new Error(str);
|
2243
|
-
}
|
2244
|
-
},
|
2245
|
-
setInput:function (input) {
|
2246
|
-
this._input = input;
|
2247
|
-
this._more = this._less = this.done = false;
|
2248
|
-
this.yylineno = this.yyleng = 0;
|
2249
|
-
this.yytext = this.matched = this.match = '';
|
2250
|
-
this.conditionStack = ['INITIAL'];
|
2251
|
-
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
|
2252
|
-
if (this.options.ranges) this.yylloc.range = [0,0];
|
2253
|
-
this.offset = 0;
|
2254
|
-
return this;
|
2255
|
-
},
|
2256
|
-
input:function () {
|
2257
|
-
var ch = this._input[0];
|
2258
|
-
this.yytext += ch;
|
2259
|
-
this.yyleng++;
|
2260
|
-
this.offset++;
|
2261
|
-
this.match += ch;
|
2262
|
-
this.matched += ch;
|
2263
|
-
var lines = ch.match(/(?:\r\n?|\n).*/g);
|
2264
|
-
if (lines) {
|
2265
|
-
this.yylineno++;
|
2266
|
-
this.yylloc.last_line++;
|
2267
|
-
} else {
|
2268
|
-
this.yylloc.last_column++;
|
2269
|
-
}
|
2270
|
-
if (this.options.ranges) this.yylloc.range[1]++;
|
2271
|
-
|
2272
|
-
this._input = this._input.slice(1);
|
2273
|
-
return ch;
|
2274
|
-
},
|
2275
|
-
unput:function (ch) {
|
2276
|
-
var len = ch.length;
|
2277
|
-
var lines = ch.split(/(?:\r\n?|\n)/g);
|
2278
|
-
|
2279
|
-
this._input = ch + this._input;
|
2280
|
-
this.yytext = this.yytext.substr(0, this.yytext.length-len-1);
|
2281
|
-
//this.yyleng -= len;
|
2282
|
-
this.offset -= len;
|
2283
|
-
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
2284
|
-
this.match = this.match.substr(0, this.match.length-1);
|
2285
|
-
this.matched = this.matched.substr(0, this.matched.length-1);
|
2286
|
-
|
2287
|
-
if (lines.length-1) this.yylineno -= lines.length-1;
|
2288
|
-
var r = this.yylloc.range;
|
2289
|
-
|
2290
|
-
this.yylloc = {first_line: this.yylloc.first_line,
|
2291
|
-
last_line: this.yylineno+1,
|
2292
|
-
first_column: this.yylloc.first_column,
|
2293
|
-
last_column: lines ?
|
2294
|
-
(lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
|
2295
|
-
this.yylloc.first_column - len
|
2296
|
-
};
|
2297
|
-
|
2298
|
-
if (this.options.ranges) {
|
2299
|
-
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
2300
|
-
}
|
2301
|
-
return this;
|
2302
|
-
},
|
2303
|
-
more:function () {
|
2304
|
-
this._more = true;
|
2305
|
-
return this;
|
2306
|
-
},
|
2307
|
-
less:function (n) {
|
2308
|
-
this.unput(this.match.slice(n));
|
2309
|
-
},
|
2310
|
-
pastInput:function () {
|
2311
|
-
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
2312
|
-
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
2313
|
-
},
|
2314
|
-
upcomingInput:function () {
|
2315
|
-
var next = this.match;
|
2316
|
-
if (next.length < 20) {
|
2317
|
-
next += this._input.substr(0, 20-next.length);
|
2318
|
-
}
|
2319
|
-
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
|
2320
|
-
},
|
2321
|
-
showPosition:function () {
|
2322
|
-
var pre = this.pastInput();
|
2323
|
-
var c = new Array(pre.length + 1).join("-");
|
2324
|
-
return pre + this.upcomingInput() + "\n" + c+"^";
|
2325
|
-
},
|
2326
|
-
next:function () {
|
2327
|
-
if (this.done) {
|
2328
|
-
return this.EOF;
|
2329
|
-
}
|
2330
|
-
if (!this._input) this.done = true;
|
2331
|
-
|
2332
|
-
var token,
|
2333
|
-
match,
|
2334
|
-
tempMatch,
|
2335
|
-
index,
|
2336
|
-
col,
|
2337
|
-
lines;
|
2338
|
-
if (!this._more) {
|
2339
|
-
this.yytext = '';
|
2340
|
-
this.match = '';
|
2341
|
-
}
|
2342
|
-
var rules = this._currentRules();
|
2343
|
-
for (var i=0;i < rules.length; i++) {
|
2344
|
-
tempMatch = this._input.match(this.rules[rules[i]]);
|
2345
|
-
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
2346
|
-
match = tempMatch;
|
2347
|
-
index = i;
|
2348
|
-
if (!this.options.flex) break;
|
2349
|
-
}
|
2350
|
-
}
|
2351
|
-
if (match) {
|
2352
|
-
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
2353
|
-
if (lines) this.yylineno += lines.length;
|
2354
|
-
this.yylloc = {first_line: this.yylloc.last_line,
|
2355
|
-
last_line: this.yylineno+1,
|
2356
|
-
first_column: this.yylloc.last_column,
|
2357
|
-
last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length};
|
2358
|
-
this.yytext += match[0];
|
2359
|
-
this.match += match[0];
|
2360
|
-
this.matches = match;
|
2361
|
-
this.yyleng = this.yytext.length;
|
2362
|
-
if (this.options.ranges) {
|
2363
|
-
this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
2364
|
-
}
|
2365
|
-
this._more = false;
|
2366
|
-
this._input = this._input.slice(match[0].length);
|
2367
|
-
this.matched += match[0];
|
2368
|
-
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
|
2369
|
-
if (this.done && this._input) this.done = false;
|
2370
|
-
if (token) return token;
|
2371
|
-
else return;
|
2372
|
-
}
|
2373
|
-
if (this._input === "") {
|
2374
|
-
return this.EOF;
|
2375
|
-
} else {
|
2376
|
-
return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
|
2377
|
-
{text: "", token: null, line: this.yylineno});
|
2378
|
-
}
|
2379
|
-
},
|
2380
|
-
lex:function lex() {
|
2381
|
-
var r = this.next();
|
2382
|
-
if (typeof r !== 'undefined') {
|
2383
|
-
return r;
|
2384
|
-
} else {
|
2385
|
-
return this.lex();
|
2386
|
-
}
|
2387
|
-
},
|
2388
|
-
begin:function begin(condition) {
|
2389
|
-
this.conditionStack.push(condition);
|
2390
|
-
},
|
2391
|
-
popState:function popState() {
|
2392
|
-
return this.conditionStack.pop();
|
2393
|
-
},
|
2394
|
-
_currentRules:function _currentRules() {
|
2395
|
-
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
|
2396
|
-
},
|
2397
|
-
topState:function () {
|
2398
|
-
return this.conditionStack[this.conditionStack.length-2];
|
2399
|
-
},
|
2400
|
-
pushState:function begin(condition) {
|
2401
|
-
this.begin(condition);
|
2402
|
-
}});
|
2403
|
-
lexer.options = {};
|
2404
|
-
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
2405
|
-
|
2406
|
-
var YYSTATE=YY_START
|
2407
|
-
switch($avoiding_name_collisions) {
|
2408
|
-
}
|
2409
|
-
};
|
2410
|
-
lexer.rules = [];
|
2411
|
-
lexer.conditions = {"INITIAL":{"rules":[],"inclusive":true}};
|
2412
|
-
return lexer;})()
|
2413
|
-
parser.lexer = lexer;function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
|
2256
|
+
;function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
|
2414
2257
|
return new Parser;
|
2415
2258
|
})();
|
2416
2259
|
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
|
@@ -2475,7 +2318,7 @@ if (typeof module !== 'undefined' && require.main === module) {
|
|
2475
2318
|
}
|
2476
2319
|
};
|
2477
2320
|
|
2478
|
-
View.prototype.render = function(model, controller, parent) {
|
2321
|
+
View.prototype.render = function(model, controller, parent, skipCallback) {
|
2479
2322
|
var node;
|
2480
2323
|
if (this.name) {
|
2481
2324
|
controller || (controller = Serenade.controllerFor(this.name, model));
|
@@ -2485,8 +2328,10 @@ if (typeof module !== 'undefined' && require.main === module) {
|
|
2485
2328
|
controller = new controller(model, parent);
|
2486
2329
|
}
|
2487
2330
|
node = compile(this.parse(), model, controller);
|
2488
|
-
if (
|
2489
|
-
controller.loaded
|
2331
|
+
if (!skipCallback) {
|
2332
|
+
if (typeof controller.loaded === "function") {
|
2333
|
+
controller.loaded(model, node.element);
|
2334
|
+
}
|
2490
2335
|
}
|
2491
2336
|
return node.element;
|
2492
2337
|
};
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serenade_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153773400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153773400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: execjs
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153772900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.3.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153772900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153772440 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '2.0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153772440
|
47
47
|
description: Use Serenade.js within the Rails asset pipeline
|
48
48
|
email:
|
49
49
|
- jonas.nicklas@gmail.com
|