rails-backbone 0.6.0.rc → 0.6.0
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
CHANGED
@@ -28,11 +28,11 @@ end
|
|
28
28
|
task :default => :test
|
29
29
|
|
30
30
|
namespace :backbone do
|
31
|
-
desc "Download the latest versions of underscore and backbone.js
|
31
|
+
desc "Download the latest released versions of underscore and backbone.js"
|
32
32
|
task :download_latest do
|
33
33
|
files = {
|
34
|
-
'underscore.js'=>'
|
35
|
-
'backbone.js' => '
|
34
|
+
'underscore.js'=>'http://underscorejs.org/underscore.js',
|
35
|
+
'backbone.js' => 'http://backbonejs.org/backbone.js'
|
36
36
|
}
|
37
37
|
|
38
38
|
vendor_dir = "vendor/assets/javascripts"
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<% attributes.each do |attribute| -%>
|
5
5
|
<div class="field">
|
6
6
|
<label for="<%= attribute.name %>"> <%= attribute.name %>:</label>
|
7
|
-
<input type="text" name="<%= attribute.name %>" id="<%= attribute.name %>" value
|
7
|
+
<input type="text" name="<%= attribute.name %>" id="<%= attribute.name %>" value="<%%= <%= attribute.name %> %>" >
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<% end -%>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<% attributes.each do |attribute| -%>
|
5
5
|
<div class="field">
|
6
6
|
<label for="<%= attribute.name %>"> <%= attribute.name %>:</label>
|
7
|
-
<input type="text" name="<%= attribute.name %>" id="<%= attribute.name %>" value
|
7
|
+
<input type="text" name="<%= attribute.name %>" id="<%= attribute.name %>" value="<%%= <%= attribute.name %> %>" >
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<% end -%>
|
@@ -31,8 +31,8 @@
|
|
31
31
|
var _ = root._;
|
32
32
|
if (!_ && (typeof require !== 'undefined')) _ = require('underscore')._;
|
33
33
|
|
34
|
-
// For Backbone's purposes, jQuery
|
35
|
-
var $ = root.jQuery || root.Zepto
|
34
|
+
// For Backbone's purposes, jQuery or Zepto owns the `$` variable.
|
35
|
+
var $ = root.jQuery || root.Zepto;
|
36
36
|
|
37
37
|
// Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
|
38
38
|
// to its previous owner. Returns a reference to this Backbone object.
|
@@ -984,7 +984,7 @@
|
|
984
984
|
// Ensure that the View has a DOM element to render into.
|
985
985
|
// If `this.el` is a string, pass it through `$()`, take the first
|
986
986
|
// matching element, and re-assign it to `el`. Otherwise, create
|
987
|
-
// an element from the `id`, `className` and `tagName`
|
987
|
+
// an element from the `id`, `className` and `tagName` proeprties.
|
988
988
|
_ensureElement : function() {
|
989
989
|
if (!this.el) {
|
990
990
|
var attrs = this.attributes || {};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
// Underscore.js 1.
|
2
|
-
// (c) 2009-
|
1
|
+
// Underscore.js 1.3.0
|
2
|
+
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
3
3
|
// Underscore is freely distributable under the MIT license.
|
4
4
|
// Portions of Underscore are inspired or borrowed from Prototype,
|
5
5
|
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
@@ -25,7 +25,6 @@
|
|
25
25
|
|
26
26
|
// Create quick reference variables for speed access to core prototypes.
|
27
27
|
var slice = ArrayProto.slice,
|
28
|
-
concat = ArrayProto.concat,
|
29
28
|
unshift = ArrayProto.unshift,
|
30
29
|
toString = ObjProto.toString,
|
31
30
|
hasOwnProperty = ObjProto.hasOwnProperty;
|
@@ -49,26 +48,21 @@
|
|
49
48
|
// Create a safe reference to the Underscore object for use below.
|
50
49
|
var _ = function(obj) { return new wrapper(obj); };
|
51
50
|
|
52
|
-
// Export the Underscore object for **Node.js
|
53
|
-
// backwards-compatibility for the old `require()` API. If we're
|
54
|
-
//
|
51
|
+
// Export the Underscore object for **Node.js**, with
|
52
|
+
// backwards-compatibility for the old `require()` API. If we're in
|
53
|
+
// the browser, add `_` as a global object via a string identifier,
|
54
|
+
// for Closure Compiler "advanced" mode.
|
55
55
|
if (typeof exports !== 'undefined') {
|
56
56
|
if (typeof module !== 'undefined' && module.exports) {
|
57
57
|
exports = module.exports = _;
|
58
58
|
}
|
59
59
|
exports._ = _;
|
60
|
-
} else if (typeof define === 'function' && define.amd) {
|
61
|
-
// Register as a named module with AMD.
|
62
|
-
define('underscore', function() {
|
63
|
-
return _;
|
64
|
-
});
|
65
60
|
} else {
|
66
|
-
// Exported as a string, for Closure Compiler "advanced" mode.
|
67
61
|
root['_'] = _;
|
68
62
|
}
|
69
63
|
|
70
64
|
// Current version.
|
71
|
-
_.VERSION = '1.
|
65
|
+
_.VERSION = '1.3.0';
|
72
66
|
|
73
67
|
// Collection Functions
|
74
68
|
// --------------------
|
@@ -102,6 +96,7 @@
|
|
102
96
|
each(obj, function(value, index, list) {
|
103
97
|
results[results.length] = iterator.call(context, value, index, list);
|
104
98
|
});
|
99
|
+
if (obj.length === +obj.length) results.length = obj.length;
|
105
100
|
return results;
|
106
101
|
};
|
107
102
|
|
@@ -218,7 +213,7 @@
|
|
218
213
|
_.invoke = function(obj, method) {
|
219
214
|
var args = slice.call(arguments, 2);
|
220
215
|
return _.map(obj, function(value) {
|
221
|
-
return (method
|
216
|
+
return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
|
222
217
|
});
|
223
218
|
};
|
224
219
|
|
@@ -583,7 +578,7 @@
|
|
583
578
|
// conditionally execute the original function.
|
584
579
|
_.wrap = function(func, wrapper) {
|
585
580
|
return function() {
|
586
|
-
var args = concat.
|
581
|
+
var args = [func].concat(slice.call(arguments, 0));
|
587
582
|
return wrapper.apply(this, args);
|
588
583
|
};
|
589
584
|
};
|
@@ -892,6 +887,11 @@
|
|
892
887
|
escape : /<%-([\s\S]+?)%>/g
|
893
888
|
};
|
894
889
|
|
890
|
+
// When customizing `templateSettings`, if you don't want to define an
|
891
|
+
// interpolation, evaluation or escaping regex, we need one that is
|
892
|
+
// guaranteed not to match.
|
893
|
+
var noMatch = /.^/;
|
894
|
+
|
895
895
|
// JavaScript micro-templating, similar to John Resig's implementation.
|
896
896
|
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
897
897
|
// and correctly escapes quotes within interpolated code.
|
@@ -901,15 +901,16 @@
|
|
901
901
|
'with(obj||{}){__p.push(\'' +
|
902
902
|
str.replace(/\\/g, '\\\\')
|
903
903
|
.replace(/'/g, "\\'")
|
904
|
-
.replace(c.escape, function(match, code) {
|
904
|
+
.replace(c.escape || noMatch, function(match, code) {
|
905
905
|
return "',_.escape(" + code.replace(/\\'/g, "'") + "),'";
|
906
906
|
})
|
907
|
-
.replace(c.interpolate, function(match, code) {
|
907
|
+
.replace(c.interpolate || noMatch, function(match, code) {
|
908
908
|
return "'," + code.replace(/\\'/g, "'") + ",'";
|
909
909
|
})
|
910
|
-
.replace(c.evaluate ||
|
910
|
+
.replace(c.evaluate || noMatch, function(match, code) {
|
911
911
|
return "');" + code.replace(/\\'/g, "'")
|
912
|
-
.replace(/[\r\n\t]/g, ' ')
|
912
|
+
.replace(/[\r\n\t]/g, ' ')
|
913
|
+
.replace(/\\\\/g, '\\') + ";__p.push('";
|
913
914
|
})
|
914
915
|
.replace(/\r/g, '\\r')
|
915
916
|
.replace(/\n/g, '\\n')
|
@@ -922,6 +923,11 @@
|
|
922
923
|
};
|
923
924
|
};
|
924
925
|
|
926
|
+
// Add a "chain" function, which will delegate to the wrapper.
|
927
|
+
_.chain = function(obj) {
|
928
|
+
return _(obj).chain();
|
929
|
+
};
|
930
|
+
|
925
931
|
// The OOP Wrapper
|
926
932
|
// ---------------
|
927
933
|
|
@@ -954,8 +960,11 @@
|
|
954
960
|
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
|
955
961
|
var method = ArrayProto[name];
|
956
962
|
wrapper.prototype[name] = function() {
|
957
|
-
|
958
|
-
|
963
|
+
var wrapped = this._wrapped;
|
964
|
+
method.apply(wrapped, arguments);
|
965
|
+
var length = wrapped.length;
|
966
|
+
if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
|
967
|
+
return result(wrapped, this._chain);
|
959
968
|
};
|
960
969
|
});
|
961
970
|
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-backbone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ryan Fitzgerald
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2012-01-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|
17
|
-
requirement: &
|
17
|
+
requirement: &70290060720380 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.1.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70290060720380
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: coffee-script
|
28
|
-
requirement: &
|
28
|
+
requirement: &70290060719700 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 2.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70290060719700
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: ejs
|
39
|
-
requirement: &
|
39
|
+
requirement: &70290060719200 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: 1.0.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70290060719200
|
48
48
|
description: Quickly setup backbone.js for use with rails 3.1. Generators are provided
|
49
49
|
to quickly get started.
|
50
50
|
email:
|
@@ -99,13 +99,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: 453131605878927391
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|
106
|
-
- - ! '
|
106
|
+
- - ! '>='
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
108
|
+
version: '0'
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
hash: 453131605878927391
|
109
112
|
requirements: []
|
110
113
|
rubyforge_project:
|
111
114
|
rubygems_version: 1.8.11
|