wingman_rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/vendor/assets/javascripts/wingman.js +43 -2
- metadata +4 -4
@@ -54,6 +54,7 @@
|
|
54
54
|
if (typeof window !== "undefined" && window !== null) {
|
55
55
|
exports.document = window.document;
|
56
56
|
exports.window = window;
|
57
|
+
exports.global = window;
|
57
58
|
exports.localStorage = localStorage;
|
58
59
|
}
|
59
60
|
|
@@ -189,7 +190,8 @@
|
|
189
190
|
}, "wingman/controller": function(exports, require, module) {(function() {
|
190
191
|
var Navigator, Wingman, WingmanObject,
|
191
192
|
__hasProp = Object.prototype.hasOwnProperty,
|
192
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }
|
193
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; },
|
194
|
+
__slice = Array.prototype.slice;
|
193
195
|
|
194
196
|
WingmanObject = require('./shared/object');
|
195
197
|
|
@@ -211,9 +213,30 @@
|
|
211
213
|
this.set({
|
212
214
|
app: view.app
|
213
215
|
});
|
216
|
+
this.setupBindings();
|
214
217
|
if (typeof this.ready === "function") this.ready();
|
215
218
|
}
|
216
219
|
|
220
|
+
_Class.prototype.setupBindings = function() {
|
221
|
+
var eventName, methodName, _ref, _results;
|
222
|
+
_ref = this.bindings;
|
223
|
+
_results = [];
|
224
|
+
for (eventName in _ref) {
|
225
|
+
methodName = _ref[eventName];
|
226
|
+
_results.push(this.setupBinding(eventName, methodName));
|
227
|
+
}
|
228
|
+
return _results;
|
229
|
+
};
|
230
|
+
|
231
|
+
_Class.prototype.setupBinding = function(eventName, methodName) {
|
232
|
+
var _this = this;
|
233
|
+
return this.get('view').bind(eventName, function() {
|
234
|
+
var args;
|
235
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
236
|
+
return _this[methodName].apply(_this, args);
|
237
|
+
});
|
238
|
+
};
|
239
|
+
|
217
240
|
return _Class;
|
218
241
|
|
219
242
|
})(WingmanObject);
|
@@ -321,7 +344,7 @@
|
|
321
344
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
322
345
|
hasManyName = _ref[_i];
|
323
346
|
klassName = Fleck.camelize(Fleck.singularize(Fleck.underscore(hasManyName)), true);
|
324
|
-
klass = Wingman.
|
347
|
+
klass = Wingman.global[klassName];
|
325
348
|
association = new HasManyAssociation(this, klass);
|
326
349
|
this.setProperty(hasManyName, association);
|
327
350
|
association.bind('add', function(model) {
|
@@ -2012,9 +2035,18 @@
|
|
2012
2035
|
});
|
2013
2036
|
}
|
2014
2037
|
this.el = this.domElement = (options != null ? options.el : void 0) || Wingman.document.createElement(this.tag || 'div');
|
2038
|
+
this.set({
|
2039
|
+
children: []
|
2040
|
+
});
|
2015
2041
|
if (options != null ? options.render : void 0) this.render();
|
2016
2042
|
}
|
2017
2043
|
|
2044
|
+
_Class.prototype.name = function() {
|
2045
|
+
var withoutView;
|
2046
|
+
withoutView = this.constructor.name.replace(/View$/, '');
|
2047
|
+
return Fleck.camelize(Fleck.underscore(withoutView));
|
2048
|
+
};
|
2049
|
+
|
2018
2050
|
_Class.prototype.render = function() {
|
2019
2051
|
var template, templateSource;
|
2020
2052
|
templateSource = this.get('templateSource');
|
@@ -2041,6 +2073,10 @@
|
|
2041
2073
|
return _this.trigger('descendantCreated', view);
|
2042
2074
|
});
|
2043
2075
|
this.trigger('descendantCreated', view);
|
2076
|
+
this.get('children').push(view);
|
2077
|
+
view.bind('remove', function() {
|
2078
|
+
return _this.get('children').remove(view);
|
2079
|
+
});
|
2044
2080
|
if (options != null ? options.render : void 0) view.render();
|
2045
2081
|
return view;
|
2046
2082
|
};
|
@@ -2139,6 +2175,11 @@
|
|
2139
2175
|
}
|
2140
2176
|
};
|
2141
2177
|
|
2178
|
+
_Class.prototype.remove = function() {
|
2179
|
+
if (this.el.parentNode) Elementary.remove.call(this);
|
2180
|
+
return this.trigger('remove');
|
2181
|
+
};
|
2182
|
+
|
2142
2183
|
_Class.prototype.setupStyles = function() {
|
2143
2184
|
var name, property, _results;
|
2144
2185
|
_results = [];
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wingman_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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-04-
|
12
|
+
date: 2012-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement: &
|
16
|
+
requirement: &70174767217400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version: '5.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70174767217400
|
28
28
|
description: This gem provides Wingman for your Rails 3 application.
|
29
29
|
email:
|
30
30
|
- rasmusrnielsen@gmail.com
|