ember-rails 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ if ('undefined' === typeof Ember) {
10
10
  /**
11
11
  @namespace
12
12
  @name Ember
13
- @version 0.9.7
13
+ @version 0.9.7.1
14
14
 
15
15
  All Ember methods and functions are defined inside of this namespace.
16
16
  You generally should not add new properties to this namespace as it may be
@@ -42,10 +42,10 @@ if ('undefined' !== typeof window) {
42
42
  /**
43
43
  @static
44
44
  @type String
45
- @default '0.9.7'
45
+ @default '0.9.7.1'
46
46
  @constant
47
47
  */
48
- Ember.VERSION = '0.9.7';
48
+ Ember.VERSION = '0.9.7.1';
49
49
 
50
50
  /**
51
51
  @static
@@ -610,7 +610,6 @@ Ember.wrap = function(func, superFunc) {
610
610
  Ember.isArray([]); // true
611
611
  Ember.isArray( Ember.ArrayProxy.create({ content: [] }) ); // true
612
612
 
613
- @name Ember.isArray
614
613
  @param {Object} obj The object to test
615
614
  @returns {Boolean}
616
615
  */
@@ -1607,7 +1607,7 @@ if ('undefined' === typeof Ember) {
1607
1607
  /**
1608
1608
  @namespace
1609
1609
  @name Ember
1610
- @version 0.9.7
1610
+ @version 0.9.7.1
1611
1611
 
1612
1612
  All Ember methods and functions are defined inside of this namespace.
1613
1613
  You generally should not add new properties to this namespace as it may be
@@ -1639,10 +1639,10 @@ if ('undefined' !== typeof window) {
1639
1639
  /**
1640
1640
  @static
1641
1641
  @type String
1642
- @default '0.9.7'
1642
+ @default '0.9.7.1'
1643
1643
  @constant
1644
1644
  */
1645
- Ember.VERSION = '0.9.7';
1645
+ Ember.VERSION = '0.9.7.1';
1646
1646
 
1647
1647
  /**
1648
1648
  @static
@@ -2207,7 +2207,6 @@ Ember.wrap = function(func, superFunc) {
2207
2207
  Ember.isArray([]); // true
2208
2208
  Ember.isArray( Ember.ArrayProxy.create({ content: [] }) ); // true
2209
2209
 
2210
- @name Ember.isArray
2211
2210
  @param {Object} obj The object to test
2212
2211
  @returns {Boolean}
2213
2212
  */
@@ -11996,13 +11995,27 @@ Ember._RenderBuffer.prototype =
11996
11995
  },
11997
11996
 
11998
11997
  _escapeAttribute: function(value) {
11999
- // Escaping only double quotes is probably sufficient, but it can't hurt to do a few more
12000
- return value.toString()
12001
- .replace(/&/g, '&')
12002
- .replace(/</g, '&lt;')
12003
- .replace(/>/g, '&gt;')
12004
- .replace(/'/g, '&#x27;')
12005
- .replace(/"/g, '&quot;');
11998
+ // Stolen shamelessly from Handlebars
11999
+
12000
+ var escape = {
12001
+ "<": "&lt;",
12002
+ ">": "&gt;",
12003
+ '"': "&quot;",
12004
+ "'": "&#x27;",
12005
+ "`": "&#x60;"
12006
+ };
12007
+
12008
+ var badChars = /&(?!\w+;)|[<>"'`]/g;
12009
+ var possible = /[&<>"'`]/;
12010
+
12011
+ var escapeChar = function(chr) {
12012
+ return escape[chr] || "&amp;";
12013
+ };
12014
+
12015
+ var string = value.toString();
12016
+
12017
+ if(!possible.test(string)) { return string; }
12018
+ return string.replace(badChars, escapeChar);
12006
12019
  }
12007
12020
 
12008
12021
  };
@@ -14254,8 +14267,7 @@ var childViewsProperty = Ember.computed(function() {
14254
14267
 
14255
14268
  /**
14256
14269
  @class
14257
- @extends Ember.View
14258
-
14270
+
14259
14271
  A `ContainerView` is an `Ember.View` subclass that allows for manual or programatic
14260
14272
  management of a view's `childViews` array that will correctly update the `ContainerView`
14261
14273
  instance's rendered DOM representation.
@@ -14421,6 +14433,8 @@ var childViewsProperty = Ember.computed(function() {
14421
14433
  property on a container view will not result in the template or layout being rendered.
14422
14434
  The HTML contents of a `Ember.ContainerView`'s DOM representation will only be the rendered HTML
14423
14435
  of its child views.
14436
+
14437
+ @extends Ember.View
14424
14438
  */
14425
14439
 
14426
14440
  Ember.ContainerView = Ember.View.extend({
@@ -14640,9 +14654,7 @@ var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
14640
14654
 
14641
14655
  /**
14642
14656
  @class
14643
- @since Ember 0.9
14644
- @extends Ember.ContainerView
14645
-
14657
+
14646
14658
  `Ember.CollectionView` is an `Ember.View` descendent responsible for managing a
14647
14659
  collection (an array or array-like object) by maintaing a child view object and
14648
14660
  associated DOM representation for each item in the array and ensuring that child
@@ -14749,7 +14761,9 @@ var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
14749
14761
  ## Use in templates via the `{{collection}}` Ember.Handlebars helper
14750
14762
  Ember.Handlebars provides a helper specifically for adding `CollectionView`s to templates.
14751
14763
  See `Ember.Handlebars.collection` for more details
14752
-
14764
+
14765
+ @since Ember 0.9
14766
+ @extends Ember.ContainerView
14753
14767
  */
14754
14768
  Ember.CollectionView = Ember.ContainerView.extend(
14755
14769
  /** @scope Ember.CollectionView.prototype */ {
@@ -17012,7 +17026,7 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
17012
17026
  var classBindings = attrs['class'];
17013
17027
  if (classBindings !== null && classBindings !== undefined) {
17014
17028
  var classResults = EmberHandlebars.bindClasses(this, classBindings, view, dataId, options);
17015
- ret.push('class="' + classResults.join(' ') + '"');
17029
+ ret.push('class="' + Handlebars.Utils.escapeExpression(classResults.join(' ')) + '"');
17016
17030
  delete attrs['class'];
17017
17031
  }
17018
17032
 
@@ -17063,8 +17077,9 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
17063
17077
 
17064
17078
  // if this changes, also change the logic in ember-views/lib/views/view.js
17065
17079
  if ((type === 'string' || (type === 'number' && !isNaN(value)))) {
17066
- ret.push(attr + '="' + value + '"');
17080
+ ret.push(attr + '="' + Handlebars.Utils.escapeExpression(value) + '"');
17067
17081
  } else if (value && type === 'boolean') {
17082
+ // The developer controls the attr name, so it should always be safe
17068
17083
  ret.push(attr + '="' + attr + '"');
17069
17084
  }
17070
17085
  }, this);
@@ -17330,6 +17345,143 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
17330
17345
  });
17331
17346
 
17332
17347
  /**
17348
+ `{{view}}` inserts a new instance of `Ember.View` into a template passing its options
17349
+ to the `Ember.View`'s `create` method and using the supplied block as the view's own template.
17350
+
17351
+ An empty `<body>` and the following template:
17352
+
17353
+ <script type="text/x-handlebars">
17354
+ A span:
17355
+ {{#view tagName="span"}}
17356
+ hello.
17357
+ {{/view}}
17358
+ </script>
17359
+
17360
+ Will result in HTML structure:
17361
+
17362
+ <body>
17363
+ <!-- Note: the handlebars template script
17364
+ also results in a rendered Ember.View
17365
+ which is the outer <div> here -->
17366
+
17367
+ <div class="ember-view">
17368
+ A span:
17369
+ <span id="ember1" class="ember-view">
17370
+ Hello.
17371
+ </span>
17372
+ </div>
17373
+ </body>
17374
+
17375
+ ### parentView setting
17376
+ The `parentView` property of the new `Ember.View` instance created through `{{view}}`
17377
+ will be set to the `Ember.View` instance of the template where `{{view}}` was called.
17378
+
17379
+ aView = Ember.View.create({
17380
+ template: Ember.Handlebars.compile("{{#view}} my parent: {{parentView.elementId}} {{/view}}")
17381
+ })
17382
+
17383
+ aView.appendTo('body')
17384
+
17385
+ Will result in HTML structure:
17386
+
17387
+ <div id="ember1" class="ember-view">
17388
+ <div id="ember2" class="ember-view">
17389
+ my parent: ember1
17390
+ </div>
17391
+ </div>
17392
+
17393
+
17394
+
17395
+ ### Setting CSS id and class attributes
17396
+ The HTML `id` attribute can be set on the `{{view}}`'s resulting element with the `id` option.
17397
+ This option will _not_ be passed to `Ember.View.create`.
17398
+
17399
+ <script type="text/x-handlebars">
17400
+ {{#view tagName="span" id="a-custom-id"}}
17401
+ hello.
17402
+ {{/view}}
17403
+ </script>
17404
+
17405
+ Results in the following HTML structure:
17406
+
17407
+ <div class="ember-view">
17408
+ <span id="a-custom-id" class="ember-view">
17409
+ hello.
17410
+ </span>
17411
+ </div>
17412
+
17413
+ The HTML `class` attribute can be set on the `{{view}}`'s resulting element with
17414
+ the `class` or `classNameBindings` options. The `class` option
17415
+ will directly set the CSS `class` attribute and will not be passed to
17416
+ `Ember.View.create`. `classNameBindings` will be passed to `create` and use
17417
+ `Ember.View`'s class name binding functionality:
17418
+
17419
+ <script type="text/x-handlebars">
17420
+ {{#view tagName="span" class="a-custom-class"}}
17421
+ hello.
17422
+ {{/view}}
17423
+ </script>
17424
+
17425
+ Results in the following HTML structure:
17426
+
17427
+ <div class="ember-view">
17428
+ <span id="ember2" class="ember-view a-custom-class">
17429
+ hello.
17430
+ </span>
17431
+ </div>
17432
+
17433
+ ### Supplying a different view class
17434
+ `{{view}}` can take an optional first argument before its supplied options to specify a
17435
+ path to a custom view class.
17436
+
17437
+ <script type="text/x-handlebars">
17438
+ {{#view "MyApp.CustomView"}}
17439
+ hello.
17440
+ {{/view}}
17441
+ </script>
17442
+
17443
+ The first argument can also be a relative path. Ember will search for the view class
17444
+ starting at the `Ember.View` of the template where `{{view}}` was used as the root object:
17445
+
17446
+
17447
+ MyApp = Ember.Application.create({})
17448
+ MyApp.OuterView = Ember.View.extend({
17449
+ innerViewClass: Ember.View.extend({
17450
+ classNames: ['a-custom-view-class-as-property']
17451
+ }),
17452
+ template: Ember.Handlebars.compile('{{#view "innerViewClass"}} hi {{/view}}')
17453
+ })
17454
+
17455
+ MyApp.OuterView.create().appendTo('body')
17456
+
17457
+ Will result in the following HTML:
17458
+
17459
+ <div id="ember1" class="ember-view">
17460
+ <div id="ember2" class="ember-view a-custom-view-class-as-property">
17461
+ hi
17462
+ </div>
17463
+ </div>
17464
+
17465
+ ### Blockless use
17466
+ If you supply a custom `Ember.View` subclass that specifies its own template
17467
+ or provide a `templateName` option to `{{view}}` it can be used without supplying a block.
17468
+ Attempts to use both a `templateName` option and supply a block will throw an error.
17469
+
17470
+ <script type="text/x-handlebars">
17471
+ {{view "MyApp.ViewWithATemplateDefined"}}
17472
+ </script>
17473
+
17474
+ ### viewName property
17475
+ You can supply a `viewName` option to `{{view}}`. The `Ember.View` instance will
17476
+ be referenced as a property of its parent view by this name.
17477
+
17478
+ aView = Ember.View.create({
17479
+ template: Ember.Handlebars.compile('{{#view viewName="aChildByName"}} hi {{/view}}')
17480
+ })
17481
+
17482
+ aView.appendTo('body')
17483
+ aView.get('aChildByName') // the instance of Ember.View created by {{view}} helper
17484
+
17333
17485
  @name Handlebars.helpers.view
17334
17486
  @param {String} path
17335
17487
  @param {Hash} options
@@ -17691,9 +17843,33 @@ var EmberHandlebars = Ember.Handlebars, getPath = EmberHandlebars.getPath;
17691
17843
  var ActionHelper = EmberHandlebars.ActionHelper = {
17692
17844
  registeredActions: {}
17693
17845
  };
17846
+
17847
+ ActionHelper.registerAction = function(actionName, eventName, target, view, context) {
17848
+ var actionId = (++Ember.$.uuid).toString();
17849
+
17850
+ ActionHelper.registeredActions[actionId] = {
17851
+ eventName: eventName,
17852
+ handler: function(event) {
17853
+ event.view = view;
17854
+ event.context = context;
17855
+
17856
+ // Check for StateManager (or compatible object)
17857
+ if (target.isState && typeof target.send === 'function') {
17858
+ return target.send(actionName, event);
17859
+ } else {
17860
+ return target[actionName].call(target, event);
17861
+ }
17862
+ }
17863
+ };
17864
+
17865
+ view.on('willRerender', function() {
17866
+ delete ActionHelper.registeredActions[actionId];
17867
+ });
17868
+
17869
+ return actionId;
17870
+ };
17871
+
17694
17872
  /**
17695
- @name Handlebars.helpers.action
17696
-
17697
17873
  The `{{action}}` helper registers an HTML element within a template for
17698
17874
  DOM event handling. User interaction with that element will call the method
17699
17875
  on the template's associated `Ember.View` instance that has the same name
@@ -17801,33 +17977,11 @@ var ActionHelper = EmberHandlebars.ActionHelper = {
17801
17977
  an `Ember.EventDispatcher` instance is available. An `Ember.EventDispatcher` instance
17802
17978
  will be created when a new `Ember.Application` is created. Having an instance of
17803
17979
  `Ember.Application` will satisfy this requirement.
17804
-
17805
- */
17806
- ActionHelper.registerAction = function(actionName, eventName, target, view, context) {
17807
- var actionId = (++Ember.$.uuid).toString();
17808
-
17809
- ActionHelper.registeredActions[actionId] = {
17810
- eventName: eventName,
17811
- handler: function(event) {
17812
- event.view = view;
17813
- event.context = context;
17814
-
17815
- // Check for StateManager (or compatible object)
17816
- if (target.isState && typeof target.send === 'function') {
17817
- return target.send(actionName, event);
17818
- } else {
17819
- return target[actionName].call(target, event);
17820
- }
17821
- }
17822
- };
17823
-
17824
- view.on('willRerender', function() {
17825
- delete ActionHelper.registeredActions[actionId];
17826
- });
17827
-
17828
- return actionId;
17829
- };
17830
17980
 
17981
+ @name Handlebars.helpers.action
17982
+ @param {String} actionName
17983
+ @param {Hash} options
17984
+ */
17831
17985
  EmberHandlebars.registerHelper('action', function(actionName, options) {
17832
17986
  var hash = options.hash || {},
17833
17987
  eventName = hash.on || "click",
@@ -17850,14 +18004,13 @@ EmberHandlebars.registerHelper('action', function(actionName, options) {
17850
18004
  var get = Ember.get, set = Ember.set;
17851
18005
 
17852
18006
  /**
17853
- @name Handlebars.helpers.yield
17854
-
18007
+
17855
18008
  When used in a Handlebars template that is assigned to an `Ember.View` instance's
17856
18009
  `layout` property Ember will render the layout template first, inserting the view's
17857
18010
  own rendered output at the `{{ yield }}` location.
17858
-
18011
+
17859
18012
  An empty `<body>` and the following application code:
17860
-
18013
+
17861
18014
  AView = Ember.View.extend({
17862
18015
  classNames: ['a-view-with-layout'],
17863
18016
  layout: Ember.Handlebars.compile('<div class="wrapper">{{ yield }}</div>'),
@@ -17866,9 +18019,9 @@ var get = Ember.get, set = Ember.set;
17866
18019
 
17867
18020
  aView = AView.create()
17868
18021
  aView.appendTo('body')
17869
-
18022
+
17870
18023
  Will result in the following HTML output:
17871
-
18024
+
17872
18025
  <body>
17873
18026
  <div class='ember-view a-view-with-layout'>
17874
18027
  <div class="wrapper">
@@ -17876,11 +18029,11 @@ var get = Ember.get, set = Ember.set;
17876
18029
  </div>
17877
18030
  </div>
17878
18031
  </body>
17879
-
17880
-
18032
+
18033
+
17881
18034
  The yield helper cannot be used outside of a template assigned to an `Ember.View`'s `layout` property
17882
18035
  and will throw an error if attempted.
17883
-
18036
+
17884
18037
  BView = Ember.View.extend({
17885
18038
  classNames: ['a-view-with-layout'],
17886
18039
  template: Ember.Handlebars.compile('{{yield}}')
@@ -17888,9 +18041,13 @@ var get = Ember.get, set = Ember.set;
17888
18041
 
17889
18042
  bView = BView.create()
17890
18043
  bView.appendTo('body')
17891
-
18044
+
17892
18045
  // throws
17893
18046
  // Uncaught Error: assertion failed: You called yield in a template that was not a layout
18047
+
18048
+ @name Handlebars.helpers.yield
18049
+ @param {Hash} options
18050
+ @returns {String} HTML string
17894
18051
  */
17895
18052
  Ember.Handlebars.registerHelper('yield', function(options) {
17896
18053
  var view = options.data.view, template;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,11 +12,11 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-04-19 00:00:00.000000000 Z
15
+ date: 2012-04-20 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: execjs
19
- requirement: &70157492866740 !ruby/object:Gem::Requirement
19
+ requirement: &70283282286380 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: '1.2'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70157492866740
27
+ version_requirements: *70283282286380
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: railties
30
- requirement: &70157492866220 !ruby/object:Gem::Requirement
30
+ requirement: &70283282285860 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ~>
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: '3.1'
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *70157492866220
38
+ version_requirements: *70283282285860
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: rails
41
- requirement: &70157492865740 !ruby/object:Gem::Requirement
41
+ requirement: &70283282285380 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ~>
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '3.1'
47
47
  type: :development
48
48
  prerelease: false
49
- version_requirements: *70157492865740
49
+ version_requirements: *70283282285380
50
50
  description:
51
51
  email:
52
52
  - me@keithpitt.com
@@ -76,10 +76,12 @@ files:
76
76
  - lib/generators/templates/array_controller.js
77
77
  - lib/generators/templates/controller.js
78
78
  - lib/generators/templates/model.js
79
+ - vendor/assets/javascripts/development/ember-runtime.js
80
+ - vendor/assets/javascripts/development/ember.js
79
81
  - vendor/assets/javascripts/ember-dev.js
80
82
  - vendor/assets/javascripts/ember-runtime-dev.js
81
- - vendor/assets/javascripts/ember-runtime.js
82
- - vendor/assets/javascripts/ember.js
83
+ - vendor/assets/javascripts/production/ember-runtime.js
84
+ - vendor/assets/javascripts/production/ember.js
83
85
  homepage: https://github.com/emberjs/ember-rails
84
86
  licenses: []
85
87
  post_install_message:
@@ -94,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
96
  version: '0'
95
97
  segments:
96
98
  - 0
97
- hash: 248381783363684182
99
+ hash: 1318040576675237297
98
100
  required_rubygems_version: !ruby/object:Gem::Requirement
99
101
  none: false
100
102
  requirements:
@@ -103,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
105
  version: '0'
104
106
  segments:
105
107
  - 0
106
- hash: 248381783363684182
108
+ hash: 1318040576675237297
107
109
  requirements: []
108
110
  rubyforge_project:
109
111
  rubygems_version: 1.8.11