wingman_rails 0.0.4 → 0.0.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.
@@ -1444,15 +1444,29 @@
1444
1444
  this.nodeData = nodeData;
1445
1445
  this.scope = scope;
1446
1446
  this.context = context;
1447
- this.view = this.context.createChildView(this.nodeData.name);
1448
- if (this.context.get(this.nodeData.name)) {
1449
- this.view.setProperty(this.nodeData.name, this.context.get(this.nodeData.name));
1450
- }
1451
- this.view.render();
1447
+ this.view = this.context.createChildView(this.nodeData.name, this.options());
1452
1448
  element = this.view.el;
1453
1449
  this.scope.appendChild(element);
1454
1450
  }
1455
1451
 
1452
+ ChildView.prototype.options = function() {
1453
+ var options, properties;
1454
+ options = {
1455
+ render: true
1456
+ };
1457
+ if (properties = this.properties()) options.properties = properties;
1458
+ return options;
1459
+ };
1460
+
1461
+ ChildView.prototype.properties = function() {
1462
+ var properties;
1463
+ if (this.context.get(this.nodeData.name)) {
1464
+ properties = {};
1465
+ properties[this.nodeData.name] = this.context.get(this.nodeData.name);
1466
+ return properties;
1467
+ }
1468
+ };
1469
+
1456
1470
  ChildView.prototype.remove = function() {
1457
1471
  return this.view.remove();
1458
1472
  };
@@ -1648,7 +1662,8 @@
1648
1662
  }).call(this);
1649
1663
  }, "wingman/template/node_factory/for_block": function(exports, require, module) {(function() {
1650
1664
  var Fleck, ForBlock, NodeFactory, WingmanObject,
1651
- __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
1665
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
1666
+ __slice = Array.prototype.slice;
1652
1667
 
1653
1668
  WingmanObject = require('../../shared/object');
1654
1669
 
@@ -1678,8 +1693,10 @@
1678
1693
  this.nodes[value] = [];
1679
1694
  newContext = new WingmanObject;
1680
1695
  if (this.context.createChildView) {
1681
- newContext.createChildView = function(name) {
1682
- return _this.context.createChildView.call(_this.context, name);
1696
+ newContext.createChildView = function() {
1697
+ var args, _ref;
1698
+ args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
1699
+ return (_ref = _this.context.createChildView).call.apply(_ref, [_this.context].concat(__slice.call(args)));
1683
1700
  };
1684
1701
  }
1685
1702
  key = Fleck.singularize(this.nodeData.source.split('.').pop());
@@ -2069,14 +2086,17 @@
2069
2086
  parent: this,
2070
2087
  app: this.get('app')
2071
2088
  });
2072
- view.bind('descendantCreated', function(view) {
2073
- return _this.trigger('descendantCreated', view);
2074
- });
2075
- this.trigger('descendantCreated', view);
2089
+ if (options != null ? options.properties : void 0) {
2090
+ view.set(options.properties);
2091
+ }
2076
2092
  this.get('children').push(view);
2077
2093
  view.bind('remove', function() {
2078
2094
  return _this.get('children').remove(view);
2079
2095
  });
2096
+ view.bind('descendantCreated', function(view) {
2097
+ return _this.trigger('descendantCreated', view);
2098
+ });
2099
+ this.trigger('descendantCreated', view);
2080
2100
  if (options != null ? options.render : void 0) view.render();
2081
2101
  return view;
2082
2102
  };
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
4
+ version: 0.0.5
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-10 00:00:00.000000000 Z
12
+ date: 2012-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70174767217400 !ruby/object:Gem::Requirement
16
+ requirement: &70326630559760 !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: *70174767217400
27
+ version_requirements: *70326630559760
28
28
  description: This gem provides Wingman for your Rails 3 application.
29
29
  email:
30
30
  - rasmusrnielsen@gmail.com