dist/ember.js in ember-source-1.13.7 vs dist/ember.js in ember-source-1.13.8
- old
+ new
@@ -3,11 +3,11 @@
* @copyright Copyright 2011-2015 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 1.13.7
+ * @version 1.13.8
*/
(function() {
var enifed, requireModule, eriuqer, requirejs, Ember;
var mainContext = this;
@@ -3772,12 +3772,14 @@
/**
@private
*/
setupEventDispatcher: function () {
var dispatcher = this.container.lookup('event_dispatcher:main');
- dispatcher.setup(this.customEvents, this.rootElement);
+ var applicationCustomEvents = _emberMetalProperty_get.get(this.application, 'customEvents');
+ dispatcher.setup(applicationCustomEvents, this.rootElement);
+
return dispatcher;
},
/**
@private
@@ -4059,11 +4061,11 @@
@method buildInstance
@return {Ember.Container} the configured container
*/
buildInstance: function () {
return _emberApplicationSystemApplicationInstance["default"].create({
- customEvents: _emberMetalProperty_get.get(this, 'customEvents'),
+ application: this,
rootElement: _emberMetalProperty_get.get(this, 'rootElement'),
applicationRegistry: this.registry
});
},
@@ -4494,11 +4496,17 @@
Application.reopenClass({
initializers: _emberMetalPlatformCreate["default"](null),
instanceInitializers: _emberMetalPlatformCreate["default"](null),
/**
- Initializer receives an object which has the following attributes:
+ The goal of initializers should be to register dependencies and injections.
+ This phase runs once. Because these initializers may load code, they are
+ allowed to defer application readiness and advance it. If you need to access
+ the container or store you should use an InstanceInitializer that will be run
+ after all initializers and therefore after all code is loaded and the app is
+ ready.
+ Initializer receives an object which has the following attributes:
`name`, `before`, `after`, `initialize`. The only required attribute is
`initialize`, all others are optional.
* `name` allows you to specify under which name the initializer is registered.
This must be a unique name, as trying to register two initializers with the
same name will result in an error.
@@ -4569,10 +4577,11 @@
and `application` on which you can operate.
Example of using `container` to preload data into the store:
```javascript
Ember.Application.initializer({
name: 'preload-data',
+ after: 'ember-data', // ember-data must be loaded before we can access store
initialize: function(container, application) {
var store = container.lookup('store:main');
store.pushPayload(preloadedData);
}
});
@@ -4587,11 +4596,66 @@
});
```
@method initializer
@param initializer {Object}
@public
- */
+ */
+
+ /**
+ InstanceInitializers run after all initializers have run. Because
+ instanceInitializers run after the app is fully set up. We have access
+ to the store, container, and other items. However, these initializers run
+ after code has loaded and are not allowed to defer readiness.
+ InstanceInitializer receives an object which has the following attributes:
+ `name`, `before`, `after`, `initialize`. The only required attribute is
+ `initialize`, all others are optional.
+ * `name` allows you to specify under which name the instanceInitializer is
+ registered. This must be a unique name, as trying to register two
+ instanceInitializer with the same name will result in an error.
+ ```javascript
+ Ember.Application.instanceInitializer({
+ name: 'namedinstanceInitializer',
+ initialize: function(application) {
+ Ember.debug('Running namedInitializer!');
+ }
+ });
+ ```
+ * `before` and `after` are used to ensure that this initializer is ran prior
+ or after the one identified by the value. This value can be a single string
+ or an array of strings, referencing the `name` of other initializers.
+ * See Ember.Application.initializer for discussion on the usage of before
+ and after.
+ Example instanceInitializer to preload data into the store.
+ ```javascript
+ Ember.Application.initializer({
+ name: 'preload-data',
+ initialize: function(application) {
+ var userConfig, userConfigEncoded, store;
+ // We have a HTML escaped JSON representation of the user's basic
+ // configuration generated server side and stored in the DOM of the main
+ // index.html file. This allows the app to have access to a set of data
+ // without making any additional remote calls. Good for basic data that is
+ // needed for immediate rendering of the page. Keep in mind, this data,
+ // like all local models and data can be manipulated by the user, so it
+ // should not be relied upon for security or authorization.
+ //
+ // Grab the encoded data from the meta tag
+ userConfigEncoded = Ember.$('head meta[name=app-user-config]').attr('content');
+ // Unescape the text, then parse the resulting JSON into a real object
+ userConfig = JSON.parse(unescape(userConfigEncoded));
+ // Lookup the store
+ store = application.container.lookup('service:store');
+ // Push the encoded JSON into the store
+ store.pushPayload(userConfig);
+ }
+ });
+ ```
+ @method instanceInitializer
+ @param instanceInitializer
+ @public
+ */
+
initializer: buildInitializerMethod('initializers', 'initializer'),
/**
This creates a registry with the default Ember naming conventions.
It also configures the registry:
@@ -8335,10 +8399,12 @@
case 'unless':
case 'if':
params[0] = shouldDisplay(params[0]);break;
case 'each':
params[0] = eachParam(params[0]);break;
+ case '@content-helper':
+ break;
default:
helper = _emberHtmlbarsSystemLookupHelper.findHelper(path, env.view, env);
if (helper && helper.isHandlebarsCompat && params[0]) {
params[0] = processHandlebarsCompatDepKeys(params[0], helper._dependentKeys);
@@ -8612,15 +8678,139 @@
exports["default"] = keywords;
});
enifed("ember-htmlbars/keywords/collection", ["exports", "ember-views/streams/utils", "ember-views/views/collection_view", "ember-htmlbars/node-managers/view-node-manager", "ember-metal/keys", "ember-metal/merge"], function (exports, _emberViewsStreamsUtils, _emberViewsViewsCollection_view, _emberHtmlbarsNodeManagersViewNodeManager, _emberMetalKeys, _emberMetalMerge) {
/**
@module ember
- @submodule ember-htmlbars
+ @submodule ember-templates
*/
"use strict";
+ /**
+ `{{collection}}` is a template helper for adding instances of
+ `Ember.CollectionView` to a template. See [Ember.CollectionView](/api/classes/Ember.CollectionView.html)
+ for additional information on how a `CollectionView` functions.
+
+ `{{collection}}`'s primary use is as a block helper with a `contentBinding`
+ option pointing towards an `Ember.Array`-compatible object. An `Ember.View`
+ instance will be created for each item in its `content` property. Each view
+ will have its own `content` property set to the appropriate item in the
+ collection.
+
+ The provided block will be applied as the template for each item's view.
+
+ Given an empty `<body>` the following template:
+
+ ```handlebars
+ {{! application.hbs }}
+ {{#collection content=model}}
+ Hi {{view.content.name}}
+ {{/collection}}
+ ```
+
+ And the following application code
+
+ ```javascript
+ App = Ember.Application.create();
+ App.ApplicationRoute = Ember.Route.extend({
+ model: function() {
+ return [{name: 'Yehuda'},{name: 'Tom'},{name: 'Peter'}];
+ }
+ });
+ ```
+
+ The following HTML will result:
+
+ ```html
+ <div class="ember-view">
+ <div class="ember-view">Hi Yehuda</div>
+ <div class="ember-view">Hi Tom</div>
+ <div class="ember-view">Hi Peter</div>
+ </div>
+ ```
+
+ ### Non-block version of collection
+
+ If you provide an `itemViewClass` option that has its own `template` you may
+ omit the block.
+
+ The following template:
+
+ ```handlebars
+ {{! application.hbs }}
+ {{collection content=model itemViewClass="an-item"}}
+ ```
+
+ And application code
+
+ ```javascript
+ App = Ember.Application.create();
+ App.ApplicationRoute = Ember.Route.extend({
+ model: function() {
+ return [{name: 'Yehuda'},{name: 'Tom'},{name: 'Peter'}];
+ }
+ });
+
+ App.AnItemView = Ember.View.extend({
+ template: Ember.Handlebars.compile("Greetings {{view.content.name}}")
+ });
+ ```
+
+ Will result in the HTML structure below
+
+ ```html
+ <div class="ember-view">
+ <div class="ember-view">Greetings Yehuda</div>
+ <div class="ember-view">Greetings Tom</div>
+ <div class="ember-view">Greetings Peter</div>
+ </div>
+ ```
+
+ ### Specifying a CollectionView subclass
+
+ By default the `{{collection}}` helper will create an instance of
+ `Ember.CollectionView`. You can supply a `Ember.CollectionView` subclass to
+ the helper by passing it as the first argument:
+
+ ```handlebars
+ {{#collection "my-custom-collection" content=model}}
+ Hi {{view.content.name}}
+ {{/collection}}
+ ```
+
+ This example would look for the class `App.MyCustomCollection`.
+
+ ### Forwarded `item.*`-named Options
+
+ As with the `{{view}}`, helper options passed to the `{{collection}}` will be
+ set on the resulting `Ember.CollectionView` as properties. Additionally,
+ options prefixed with `item` will be applied to the views rendered for each
+ item (note the camelcasing):
+
+ ```handlebars
+ {{#collection content=model
+ itemTagName="p"
+ itemClassNames="greeting"}}
+ Howdy {{view.content.name}}
+ {{/collection}}
+ ```
+
+ Will result in the following HTML structure:
+
+ ```html
+ <div class="ember-view">
+ <p class="ember-view greeting">Howdy Yehuda</p>
+ <p class="ember-view greeting">Howdy Tom</p>
+ <p class="ember-view greeting">Howdy Peter</p>
+ </div>
+ ```
+
+ @method collection
+ @for Ember.Templates.helpers
+ @deprecated Use `{{each}}` helper instead.
+ @public
+ */
exports["default"] = {
setupState: function (state, env, scope, params, hash) {
var read = env.hooks.getValue;
return _emberMetalMerge.assign({}, state, {
@@ -8897,12 +9087,163 @@
return false;
}
});
enifed("ember-htmlbars/keywords/input", ["exports", "ember-metal/core", "ember-metal/merge"], function (exports, _emberMetalCore, _emberMetalMerge) {
+ /**
+ @module ember
+ @submodule ember-templates
+ */
+
"use strict";
+ /**
+ The `{{input}}` helper lets you create an HTML `<input />` component.
+ It causes an `Ember.TextField` component to be rendered. For more info,
+ see the [Ember.TextField](/api/classes/Ember.TextField.html) docs and
+ the [templates guide](http://emberjs.com/guides/templates/input-helpers/).
+
+ ```handlebars
+ {{input value="987"}}
+ ```
+
+ renders as:
+
+ ```HTML
+ <input type="text" value="987" />
+ ```
+
+ ### Text field
+
+ If no `type` option is specified, a default of type 'text' is used.
+
+ Many of the standard HTML attributes may be passed to this helper.
+
+ <table>
+ <tr><td>`readonly`</td><td>`required`</td><td>`autofocus`</td></tr>
+ <tr><td>`value`</td><td>`placeholder`</td><td>`disabled`</td></tr>
+ <tr><td>`size`</td><td>`tabindex`</td><td>`maxlength`</td></tr>
+ <tr><td>`name`</td><td>`min`</td><td>`max`</td></tr>
+ <tr><td>`pattern`</td><td>`accept`</td><td>`autocomplete`</td></tr>
+ <tr><td>`autosave`</td><td>`formaction`</td><td>`formenctype`</td></tr>
+ <tr><td>`formmethod`</td><td>`formnovalidate`</td><td>`formtarget`</td></tr>
+ <tr><td>`height`</td><td>`inputmode`</td><td>`multiple`</td></tr>
+ <tr><td>`step`</td><td>`width`</td><td>`form`</td></tr>
+ <tr><td>`selectionDirection`</td><td>`spellcheck`</td><td> </td></tr>
+ </table>
+
+
+ When set to a quoted string, these values will be directly applied to the HTML
+ element. When left unquoted, these values will be bound to a property on the
+ template's current rendering context (most typically a controller instance).
+
+
+ A very common use of this helper is to bind the `value` of an input to an Object's attribute:
+
+ ```handlebars
+ Search:
+ {{input value=searchWord}}
+ ```
+
+ In this example, the inital value in the `<input />` will be set to the value of `searchWord`.
+ If the user changes the text, the value of `searchWord` will also be updated.
+
+ ### Actions
+ The helper can send multiple actions based on user events.
+ The action property defines the action which is sent when
+ the user presses the return key.
+
+ ```handlebars
+ {{input action="submit"}}
+ ```
+
+ The helper allows some user events to send actions.
+
+ * `enter`
+ * `insert-newline`
+ * `escape-press`
+ * `focus-in`
+ * `focus-out`
+ * `key-press`
+ * `key-up`
+
+
+ For example, if you desire an action to be sent when the input is blurred,
+ you only need to setup the action name to the event name property.
+
+ ```handlebars
+ {{input focus-in="alertMessage"}}
+ ```
+
+ See more about [Text Support Actions](/api/classes/Ember.TextField.html)
+
+
+ ### Extending `Ember.TextField`
+
+ Internally, `{{input type="text"}}` creates an instance of `Ember.TextField`, passing
+ arguments from the helper to `Ember.TextField`'s `create` method. You can extend the
+ capabilities of text inputs in your applications by reopening this class. For example,
+ if you are building a Bootstrap project where `data-*` attributes are used, you
+ can add one to the `TextField`'s `attributeBindings` property:
+
+
+ ```javascript
+ Ember.TextField.reopen({
+ attributeBindings: ['data-error']
+ });
+ ```
+
+ Keep in mind when writing `Ember.TextField` subclasses that `Ember.TextField`
+ itself extends `Ember.Component`. Expect isolated component semantics, not
+ legacy 1.x view semantics (like `controller` being present).
+
+ See more about [Ember components](/api/classes/Ember.Component.html)
+
+
+ ### Checkbox
+
+ Checkboxes are special forms of the `{{input}}` helper. To create a `<checkbox />`:
+
+ ```handlebars
+ Emberize Everything:
+ {{input type="checkbox" name="isEmberized" checked=isEmberized}}
+ ```
+
+ This will bind checked state of this checkbox to the value of `isEmberized` -- if either one changes,
+ it will be reflected in the other.
+
+
+ The following HTML attributes can be set via the helper:
+
+ * `checked`
+ * `disabled`
+ * `tabindex`
+ * `indeterminate`
+ * `name`
+ * `autofocus`
+ * `form`
+
+
+ ### Extending `Ember.Checkbox`
+
+ Internally, `{{input type="checkbox"}}` creates an instance of `Ember.Checkbox`, passing
+ arguments from the helper to `Ember.Checkbox`'s `create` method. You can extend the
+ capablilties of checkbox inputs in your applications by reopening this class. For example,
+ if you wanted to add a css class to all checkboxes in your application:
+
+ ```javascript
+ Ember.Checkbox.reopen({
+ classNames: ['my-app-checkbox']
+ });
+ ```
+
+
+ @method input
+ @for Ember.Templates.helpers
+ @param {Hash} options
+ @public
+ */
exports["default"] = {
setupState: function (lastState, env, scope, params, hash) {
var type = env.hooks.getValue(hash.type);
var componentName = componentNameMap[type] || defaultComponentName;
@@ -8969,11 +9310,11 @@
var MUTABLE_REFERENCE = _emberMetalUtils.symbol("MUTABLE_REFERENCE");
exports.MUTABLE_REFERENCE = MUTABLE_REFERENCE;
/**
The `mut` helper lets you __clearly specify__ that a child `Component` can update the
- (mutable) value passed to it, which will __change the value of the parent compnent__.
+ (mutable) value passed to it, which will __change the value of the parent component__.
This is very helpful for passing mutable values to a `Component` of any size, but
critical to understanding the logic of a large/complex `Component`.
To specify that a parameter is mutable, when invoking the child `Component`:
@@ -9150,15 +9491,56 @@
};
});
enifed("ember-htmlbars/keywords/partial", ["exports", "ember-views/system/lookup_partial", "htmlbars-runtime"], function (exports, _emberViewsSystemLookup_partial, _htmlbarsRuntime) {
/**
@module ember
- @submodule ember-htmlbars
+ @submodule ember-templates
*/
"use strict";
+ /**
+ The `partial` helper renders another template without
+ changing the template context:
+
+ ```handlebars
+ {{foo}}
+ {{partial "nav"}}
+ ```
+
+ The above example template will render a template named
+ "_nav", which has the same context as the parent template
+ it's rendered into, so if the "_nav" template also referenced
+ `{{foo}}`, it would print the same thing as the `{{foo}}`
+ in the above example.
+
+ If a "_nav" template isn't found, the `partial` helper will
+ fall back to a template named "nav".
+
+ ### Bound template names
+
+ The parameter supplied to `partial` can also be a path
+ to a property containing a template name, e.g.:
+
+ ```handlebars
+ {{partial someTemplateName}}
+ ```
+
+ The above example will look up the value of `someTemplateName`
+ on the template context (e.g. a controller) and use that
+ value as the name of the template to render. If the resolved
+ value is falsy, nothing will be rendered. If `someTemplateName`
+ changes, the partial will be re-rendered using the new template
+ name.
+
+
+ @method partial
+ @for Ember.Templates.helpers
+ @param {String} partialName the name of the template to render minus the leading underscore
+ @public
+ */
+
exports["default"] = {
setupState: function (state, env, scope, params, hash) {
return { partialName: env.hooks.getValue(params[0]) };
},
@@ -9176,13 +9558,18 @@
options.templates.template.yield();
});
}
};
});
-enifed("ember-htmlbars/keywords/readonly", ["exports", "ember-htmlbars/keywords/mut"], function (exports, _emberHtmlbarsKeywordsMut) {
- "use strict";
+enifed('ember-htmlbars/keywords/readonly', ['exports', 'ember-htmlbars/keywords/mut'], function (exports, _emberHtmlbarsKeywordsMut) {
+ /**
+ @module ember
+ @submodule ember-templates
+ */
+ 'use strict';
+
exports["default"] = readonly;
function readonly(morph, env, scope, originalParams, hash, template, inverse) {
// If `morph` is `null` the keyword is being invoked as a subexpression.
if (morph === null) {
@@ -9202,11 +9589,11 @@
@submodule ember-htmlbars
*/
"use strict";
- _emberHtmlbarsTemplatesTopLevelView["default"].meta.revision = 'Ember@1.13.7';
+ _emberHtmlbarsTemplatesTopLevelView["default"].meta.revision = 'Ember@1.13.8';
exports["default"] = {
willRender: function (renderNode, env) {
env.view.ownerView._outlets.push(renderNode);
},
@@ -9327,13 +9714,199 @@
}
});
enifed('ember-htmlbars/keywords/textarea', ['exports'], function (exports) {
/**
@module ember
- @submodule ember-htmlbars
+ @submodule ember-templates
*/
+ /**
+ `{{textarea}}` inserts a new instance of `<textarea>` tag into the template.
+ The attributes of `{{textarea}}` match those of the native HTML tags as
+ closely as possible.
+
+ The following HTML attributes can be set:
+
+ * `value`
+ * `name`
+ * `rows`
+ * `cols`
+ * `placeholder`
+ * `disabled`
+ * `maxlength`
+ * `tabindex`
+ * `selectionEnd`
+ * `selectionStart`
+ * `selectionDirection`
+ * `wrap`
+ * `readonly`
+ * `autofocus`
+ * `form`
+ * `spellcheck`
+ * `required`
+
+ When set to a quoted string, these value will be directly applied to the HTML
+ element. When left unquoted, these values will be bound to a property on the
+ template's current rendering context (most typically a controller instance).
+
+ Unbound:
+
+ ```handlebars
+ {{textarea value="Lots of static text that ISN'T bound"}}
+ ```
+
+ Would result in the following HTML:
+
+ ```html
+ <textarea class="ember-text-area">
+ Lots of static text that ISN'T bound
+ </textarea>
+ ```
+
+ Bound:
+
+ In the following example, the `writtenWords` property on `App.ApplicationController`
+ will be updated live as the user types 'Lots of text that IS bound' into
+ the text area of their browser's window.
+
+ ```javascript
+ App.ApplicationController = Ember.Controller.extend({
+ writtenWords: "Lots of text that IS bound"
+ });
+ ```
+
+ ```handlebars
+ {{textarea value=writtenWords}}
+ ```
+
+ Would result in the following HTML:
+
+ ```html
+ <textarea class="ember-text-area">
+ Lots of text that IS bound
+ </textarea>
+ ```
+
+ If you wanted a one way binding between the text area and a div tag
+ somewhere else on your screen, you could use `Ember.computed.oneWay`:
+
+ ```javascript
+ App.ApplicationController = Ember.Controller.extend({
+ writtenWords: "Lots of text that IS bound",
+ outputWrittenWords: Ember.computed.oneWay("writtenWords")
+ });
+ ```
+
+ ```handlebars
+ {{textarea value=writtenWords}}
+
+ <div>
+ {{outputWrittenWords}}
+ </div>
+ ```
+
+ Would result in the following HTML:
+
+ ```html
+ <textarea class="ember-text-area">
+ Lots of text that IS bound
+ </textarea>
+
+ <-- the following div will be updated in real time as you type -->
+
+ <div>
+ Lots of text that IS bound
+ </div>
+ ```
+
+ Finally, this example really shows the power and ease of Ember when two
+ properties are bound to eachother via `Ember.computed.alias`. Type into
+ either text area box and they'll both stay in sync. Note that
+ `Ember.computed.alias` costs more in terms of performance, so only use it when
+ your really binding in both directions:
+
+ ```javascript
+ App.ApplicationController = Ember.Controller.extend({
+ writtenWords: "Lots of text that IS bound",
+ twoWayWrittenWords: Ember.computed.alias("writtenWords")
+ });
+ ```
+
+ ```handlebars
+ {{textarea value=writtenWords}}
+ {{textarea value=twoWayWrittenWords}}
+ ```
+
+ ```html
+ <textarea id="ember1" class="ember-text-area">
+ Lots of text that IS bound
+ </textarea>
+
+ <-- both updated in real time -->
+
+ <textarea id="ember2" class="ember-text-area">
+ Lots of text that IS bound
+ </textarea>
+ ```
+
+ ### Actions
+
+ The helper can send multiple actions based on user events.
+
+ The action property defines the action which is send when
+ the user presses the return key.
+
+ ```handlebars
+ {{input action="submit"}}
+ ```
+
+ The helper allows some user events to send actions.
+
+ * `enter`
+ * `insert-newline`
+ * `escape-press`
+ * `focus-in`
+ * `focus-out`
+ * `key-press`
+
+ For example, if you desire an action to be sent when the input is blurred,
+ you only need to setup the action name to the event name property.
+
+ ```handlebars
+ {{textarea focus-in="alertMessage"}}
+ ```
+
+ See more about [Text Support Actions](/api/classes/Ember.TextArea.html)
+
+ ### Extension
+
+ Internally, `{{textarea}}` creates an instance of `Ember.TextArea`, passing
+ arguments from the helper to `Ember.TextArea`'s `create` method. You can
+ extend the capabilities of text areas in your application by reopening this
+ class. For example, if you are building a Bootstrap project where `data-*`
+ attributes are used, you can globally add support for a `data-*` attribute
+ on all `{{textarea}}`s' in your app by reopening `Ember.TextArea` or
+ `Ember.TextSupport` and adding it to the `attributeBindings` concatenated
+ property:
+
+ ```javascript
+ Ember.TextArea.reopen({
+ attributeBindings: ['data-error']
+ });
+ ```
+
+ Keep in mind when writing `Ember.TextArea` subclasses that `Ember.TextArea`
+ itself extends `Ember.Component`. Expect isolated component semantics, not
+ legacy 1.x view semantics (like `controller` being present).
+
+ See more about [Ember components](/api/classes/Ember.Component.html)
+
+ @method textarea
+ @for Ember.Templates.helpers
+ @param {Hash} options
+ @public
+ */
'use strict';
exports["default"] = textarea;
function textarea(morph, env, scope, originalParams, hash, template, inverse, visitor) {
@@ -9425,15 +9998,193 @@
});
});
enifed("ember-htmlbars/keywords/view", ["exports", "ember-views/streams/utils", "ember-views/views/view", "ember-htmlbars/node-managers/view-node-manager", "ember-metal/keys"], function (exports, _emberViewsStreamsUtils, _emberViewsViewsView, _emberHtmlbarsNodeManagersViewNodeManager, _emberMetalKeys) {
/**
@module ember
- @submodule ember-htmlbars
+ @submodule ember-templates
*/
"use strict";
+ /**
+ `{{view}}` inserts a new instance of an `Ember.View` into a template passing its
+ options to the `Ember.View`'s `create` method and using the supplied block as
+ the view's own template.
+
+ An empty `<body>` and the following template:
+
+ ```handlebars
+ A span:
+ {{#view tagName="span"}}
+ hello.
+ {{/view}}
+ ```
+
+ Will result in HTML structure:
+
+ ```html
+ <body>
+ <!-- Note: the handlebars template script
+ also results in a rendered Ember.View
+ which is the outer <div> here -->
+
+ <div class="ember-view">
+ A span:
+ <span id="ember1" class="ember-view">
+ Hello.
+ </span>
+ </div>
+ </body>
+ ```
+
+ ### `parentView` setting
+
+ The `parentView` property of the new `Ember.View` instance created through
+ `{{view}}` will be set to the `Ember.View` instance of the template where
+ `{{view}}` was called.
+
+ ```javascript
+ aView = Ember.View.create({
+ template: Ember.Handlebars.compile("{{#view}} my parent: {{parentView.elementId}} {{/view}}")
+ });
+
+ aView.appendTo('body');
+ ```
+
+ Will result in HTML structure:
+
+ ```html
+ <div id="ember1" class="ember-view">
+ <div id="ember2" class="ember-view">
+ my parent: ember1
+ </div>
+ </div>
+ ```
+
+ ### Setting CSS id and class attributes
+
+ The HTML `id` attribute can be set on the `{{view}}`'s resulting element with
+ the `id` option. This option will _not_ be passed to `Ember.View.create`.
+
+ ```handlebars
+ {{#view tagName="span" id="a-custom-id"}}
+ hello.
+ {{/view}}
+ ```
+
+ Results in the following HTML structure:
+
+ ```html
+ <div class="ember-view">
+ <span id="a-custom-id" class="ember-view">
+ hello.
+ </span>
+ </div>
+ ```
+
+ The HTML `class` attribute can be set on the `{{view}}`'s resulting element
+ with the `class` or `classNameBindings` options. The `class` option will
+ directly set the CSS `class` attribute and will not be passed to
+ `Ember.View.create`. `classNameBindings` will be passed to `create` and use
+ `Ember.View`'s class name binding functionality:
+
+ ```handlebars
+ {{#view tagName="span" class="a-custom-class"}}
+ hello.
+ {{/view}}
+ ```
+
+ Results in the following HTML structure:
+
+ ```html
+ <div class="ember-view">
+ <span id="ember2" class="ember-view a-custom-class">
+ hello.
+ </span>
+ </div>
+ ```
+
+ ### Supplying a different view class
+
+ `{{view}}` can take an optional first argument before its supplied options to
+ specify a path to a custom view class.
+
+ ```handlebars
+ {{#view "custom"}}{{! will look up App.CustomView }}
+ hello.
+ {{/view}}
+ ```
+
+ The first argument can also be a relative path accessible from the current
+ context.
+
+ ```javascript
+ MyApp = Ember.Application.create({});
+ MyApp.OuterView = Ember.View.extend({
+ innerViewClass: Ember.View.extend({
+ classNames: ['a-custom-view-class-as-property']
+ }),
+ template: Ember.Handlebars.compile('{{#view view.innerViewClass}} hi {{/view}}')
+ });
+
+ MyApp.OuterView.create().appendTo('body');
+ ```
+
+ Will result in the following HTML:
+
+ ```html
+ <div id="ember1" class="ember-view">
+ <div id="ember2" class="ember-view a-custom-view-class-as-property">
+ hi
+ </div>
+ </div>
+ ```
+
+ ### Blockless use
+
+ If you supply a custom `Ember.View` subclass that specifies its own template
+ or provide a `templateName` option to `{{view}}` it can be used without
+ supplying a block. Attempts to use both a `templateName` option and supply a
+ block will throw an error.
+
+ ```javascript
+ var App = Ember.Application.create();
+ App.WithTemplateDefinedView = Ember.View.extend({
+ templateName: 'defined-template'
+ });
+ ```
+
+ ```handlebars
+ {{! application.hbs }}
+ {{view 'with-template-defined'}}
+ ```
+
+ ```handlebars
+ {{! defined-template.hbs }}
+ Some content for the defined template view.
+ ```
+
+ ### `viewName` property
+
+ You can supply a `viewName` option to `{{view}}`. The `Ember.View` instance
+ will be referenced as a property of its parent view by this name.
+
+ ```javascript
+ aView = Ember.View.create({
+ template: Ember.Handlebars.compile('{{#view viewName="aChildByName"}} hi {{/view}}')
+ });
+
+ aView.appendTo('body');
+ aView.get('aChildByName') // the instance of Ember.View created by {{view}} helper
+ ```
+
+ @method view
+ @for Ember.Templates.helpers
+ @public
+ @deprecated
+ */
+
exports["default"] = {
setupState: function (state, env, scope, params, hash) {
var read = env.hooks.getValue;
var targetObject = read(scope.self);
var viewClassOrInstance = state.viewClassOrInstance;
@@ -9534,10 +10285,15 @@
return newHash;
}
});
enifed('ember-htmlbars/keywords/with', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'htmlbars-runtime', 'ember-metal/streams/utils'], function (exports, _emberMetalCore, _emberMetalProperty_get, _htmlbarsRuntime, _emberMetalStreamsUtils) {
+ /**
+ @module ember
+ @submodule ember-templates
+ */
+
'use strict';
exports["default"] = {
setupState: function (state, env, scope, params, hash) {
var controller = hash.controller;
@@ -15154,11 +15910,11 @@
cross-platform libraries such as jQuery. For more details, see
[Ember-Runtime](http://emberjs.com/api/modules/ember-runtime.html).
@class Ember
@static
- @version 1.13.7
+ @version 1.13.8
@public
*/
'use strict';
@@ -15188,15 +15944,15 @@
/**
The semantic version.
@property VERSION
@type String
- @default '1.13.7'
+ @default '1.13.8'
@static
@public
*/
- Ember.VERSION = '1.13.7';
+ Ember.VERSION = '1.13.8';
/**
The hash of environment variables used to control various configuration
settings. To specify your own or override default settings, add the
desired properties to a global hash named `EmberENV` (or `ENV` for
@@ -22101,10 +22857,13 @@
@param {Object} obj any object, string, number, Element, or primitive
@return {String} the unique guid for this instance.
*/
function guidFor(obj) {
+ if (obj && obj[GUID_KEY]) {
+ return obj[GUID_KEY];
+ }
// special cases where we don't want to add a key to object
if (obj === undefined) {
return "(undefined)";
}
@@ -22138,14 +22897,10 @@
case 'boolean':
return obj ? '(true)' : '(false)';
default:
- if (obj[GUID_KEY]) {
- return obj[GUID_KEY];
- }
-
if (obj === Object) {
return '(Object)';
}
if (obj === Array) {
@@ -23762,10 +24517,39 @@
```
To override this option for your entire application, see
"Overriding Application-wide Defaults".
+ ### Keeping a link active for other routes
+
+ If you need a link to be 'active' even when it doesn't match
+ the current route, you can use the the `current-when`
+ argument.
+
+ ```handlebars
+ {{#link-to 'photoGallery' current-when='photos'}}
+ Photo Gallery
+ {{/link-to}}
+ ```
+
+ This may be helpful for keeping links active for:
+
+ * non-nested routes that are logically related
+ * some secondary menu approaches
+ * 'top navigation' with 'sub navigation' scenarios
+
+ A link will be active if `current-when` is `true` or the current
+ route is the route this link would transition to.
+
+ To match multiple routes 'space-separate' the routes:
+
+ ```handlebars
+ {{#link-to 'gallery' current-when='photos drawings paintings'}}
+ Art Gallery
+ {{/link-to}}
+ ```
+
### Supplying a model
An optional model argument can be used for routes whose
paths contain dynamic segments. This argument will become
the model context of the linked route:
@@ -24184,11 +24968,11 @@
@submodule ember-routing-views
*/
"use strict";
- _emberHtmlbarsTemplatesLinkTo["default"].meta.revision = 'Ember@1.13.7';
+ _emberHtmlbarsTemplatesLinkTo["default"].meta.revision = 'Ember@1.13.8';
var linkComponentClassNameBindings = ['active', 'loading', 'disabled'];
linkComponentClassNameBindings = ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut'];
@@ -24481,11 +25265,17 @@
var targetAttribute2 = this.attrs.target;
if (targetAttribute2 && targetAttribute2 !== '_self') {
return false;
}
- _emberMetalProperty_get.get(this, '_routing').transitionTo(_emberMetalProperty_get.get(this, 'targetRouteName'), _emberMetalProperty_get.get(this, 'models'), _emberMetalProperty_get.get(this, 'queryParams.values'), _emberMetalProperty_get.get(this, 'attrs.replace'));
+ var routing = _emberMetalProperty_get.get(this, '_routing');
+ var targetRouteName = this._handleOnlyQueryParamsSupplied(_emberMetalProperty_get.get(this, 'targetRouteName'));
+ var models = _emberMetalProperty_get.get(this, 'models');
+ var queryParamValues = _emberMetalProperty_get.get(this, 'queryParams.values');
+ var shouldReplace = _emberMetalProperty_get.get(this, 'attrs.replace');
+
+ routing.transitionTo(targetRouteName, models, queryParamValues, shouldReplace);
},
queryParams: null,
/**
@@ -24717,11 +25507,11 @@
@submodule ember-routing-views
*/
"use strict";
- _emberHtmlbarsTemplatesTopLevelView["default"].meta.revision = 'Ember@1.13.7';
+ _emberHtmlbarsTemplatesTopLevelView["default"].meta.revision = 'Ember@1.13.8';
var CoreOutletView = _emberViewsViewsView["default"].extend({
defaultTemplate: _emberHtmlbarsTemplatesTopLevelView["default"],
init: function () {
@@ -24930,15 +25720,17 @@
var suffixes = '';
for (var i = 0, len = parts.length; i < len; ++i) {
var part = parts[i];
var cacheValuePrefix = _calculateCacheValuePrefix(prefix, part);
var value;
- if (cacheValuePrefix && cacheValuePrefix in values) {
- var partRemovedPrefix = part.indexOf(cacheValuePrefix) === 0 ? part.substr(cacheValuePrefix.length + 1) : part;
- value = _emberMetalProperty_get.get(values[cacheValuePrefix], partRemovedPrefix);
- } else {
- value = _emberMetalProperty_get.get(values, part);
+ if (values) {
+ if (cacheValuePrefix && cacheValuePrefix in values) {
+ var partRemovedPrefix = part.indexOf(cacheValuePrefix) === 0 ? part.substr(cacheValuePrefix.length + 1) : part;
+ value = _emberMetalProperty_get.get(values[cacheValuePrefix], partRemovedPrefix);
+ } else {
+ value = _emberMetalProperty_get.get(values, part);
+ }
}
suffixes += '::' + part + ':' + value;
}
return prefix + suffixes.replace(ALL_PERIODS_REGEX, '-');
},
@@ -27193,11 +27985,11 @@
});
```
@property controller
@type Ember.Controller
@since 1.6.0
- @private
+ @public
*/
_actions: {
queryParamsDidChange: function (changed, totalPresent, removed) {
@@ -41713,11 +42505,11 @@
}
options.plugins = plugins;
options.buildMeta = function buildMeta(program) {
return {
- revision: 'Ember@1.13.7',
+ revision: 'Ember@1.13.8',
loc: program.loc,
moduleName: options.moduleName
};
};
@@ -43118,17 +43910,20 @@
val.update(value);
},
_propagateAttrsToThis: function () {
var attrs = this.attrs;
- var values = {};
+
for (var prop in attrs) {
- if (prop !== 'attrs') {
- values[prop] = this.getAttr(prop);
+ if (prop !== 'attrs' &&
+ // These list of properties are concatenated and merged properties of
+ // Ember.View / Ember.Component. Setting them here results in them being
+ // completely stomped and not handled properly, BAIL OUT!
+ prop !== 'actions' && prop !== 'classNames' && prop !== 'classNameBindings' && prop !== 'attributeBindings') {
+ this.set(prop, this.getAttr(prop));
}
}
- this.setProperties(values);
},
initializeShape: _emberMetalEvents.on('init', function () {
this._isDispatchingAttrs = false;
}),
@@ -43148,11 +43943,12 @@
var attrs = this.attrs;
if (attrs && key in attrs) {
// do not deprecate accessing `this[key]` at this time.
// add this back when we have a proper migration path
- var possibleCell = attrs.key;
+ // Ember.deprecate(deprecation(key), { id: 'ember-views.', until: '3.0.0' });
+ var possibleCell = attrs[key];
if (possibleCell && possibleCell[MUTABLE_CELL]) {
return possibleCell.value;
}
@@ -46936,10 +47732,10 @@
});
// Ember.assert, Ember.Handlebars
enifed("ember-views/views/container_view", ["exports", "ember-metal/core", "ember-runtime/mixins/mutable_array", "ember-views/views/view", "ember-metal/property_get", "ember-metal/property_set", "ember-metal/enumerable_utils", "ember-metal/mixin", "ember-metal/events", "ember-htmlbars/templates/container-view"], function (exports, _emberMetalCore, _emberRuntimeMixinsMutable_array, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalEnumerable_utils, _emberMetalMixin, _emberMetalEvents, _emberHtmlbarsTemplatesContainerView) {
"use strict";
- _emberHtmlbarsTemplatesContainerView["default"].meta.revision = 'Ember@1.13.7';
+ _emberHtmlbarsTemplatesContainerView["default"].meta.revision = 'Ember@1.13.8';
/**
@module ember
@submodule ember-views
*/
\ No newline at end of file