"));
});
var router = app.__container__.lookup('router:main');
@@ -177,9 +174,7 @@ QUnit.test("ApplicationView is inserted into the page", function() {
});
app.ApplicationView = View.extend({
- render(buffer) {
- buffer.push("
Hello!
");
- }
+ template: compile("
Hello!
")
});
app.ApplicationController = Controller.extend();
diff --git a/packages/ember-application/tests/system/dependency_injection/custom_resolver_test.js b/packages/ember-application/tests/system/dependency_injection/custom_resolver_test.js
index 98b9199dd43..c366bad870e 100644
--- a/packages/ember-application/tests/system/dependency_injection/custom_resolver_test.js
+++ b/packages/ember-application/tests/system/dependency_injection/custom_resolver_test.js
@@ -2,12 +2,13 @@ import jQuery from "ember-views/system/jquery";
import run from "ember-metal/run_loop";
import Application from "ember-application/system/application";
import DefaultResolver from "ember-application/system/resolver";
+import compile from "ember-template-compiler/system/compile";
var application;
QUnit.module("Ember.Application Dependency Injection – customResolver", {
setup() {
- function fallbackTemplate() { return "
Fallback
"; }
+ var fallbackTemplate = compile("
Fallback
");
var Resolver = DefaultResolver.extend({
resolveTemplate(resolvable) {
diff --git a/packages/ember-application/tests/system/initializers_test.js b/packages/ember-application/tests/system/initializers_test.js
index 49e080a32ae..8ff48557857 100644
--- a/packages/ember-application/tests/system/initializers_test.js
+++ b/packages/ember-application/tests/system/initializers_test.js
@@ -237,6 +237,7 @@ QUnit.test("initializers set on Application subclasses should not be shared betw
var firstInitializerRunCount = 0;
var secondInitializerRunCount = 0;
var FirstApp = Application.extend();
+ var firstApp, secondApp;
FirstApp.initializer({
name: 'first',
initialize(registry) {
@@ -252,7 +253,7 @@ QUnit.test("initializers set on Application subclasses should not be shared betw
});
jQuery('#qunit-fixture').html('');
run(function() {
- FirstApp.create({
+ firstApp = FirstApp.create({
router: false,
rootElement: '#qunit-fixture #first'
});
@@ -260,19 +261,24 @@ QUnit.test("initializers set on Application subclasses should not be shared betw
equal(firstInitializerRunCount, 1, 'first initializer only was run');
equal(secondInitializerRunCount, 0, 'first initializer only was run');
run(function() {
- SecondApp.create({
+ secondApp = SecondApp.create({
router: false,
rootElement: '#qunit-fixture #second'
});
});
equal(firstInitializerRunCount, 1, 'second initializer only was run');
equal(secondInitializerRunCount, 1, 'second initializer only was run');
+ run(function() {
+ firstApp.destroy();
+ secondApp.destroy();
+ });
});
QUnit.test("initializers are concatenated", function() {
var firstInitializerRunCount = 0;
var secondInitializerRunCount = 0;
var FirstApp = Application.extend();
+ var firstApp, secondApp;
FirstApp.initializer({
name: 'first',
initialize(registry) {
@@ -290,7 +296,7 @@ QUnit.test("initializers are concatenated", function() {
jQuery('#qunit-fixture').html('');
run(function() {
- FirstApp.create({
+ firstApp = FirstApp.create({
router: false,
rootElement: '#qunit-fixture #first'
});
@@ -299,13 +305,17 @@ QUnit.test("initializers are concatenated", function() {
equal(secondInitializerRunCount, 0, 'first initializer only was run when base class created');
firstInitializerRunCount = 0;
run(function() {
- SecondApp.create({
+ secondApp = SecondApp.create({
router: false,
rootElement: '#qunit-fixture #second'
});
});
equal(firstInitializerRunCount, 1, 'first initializer was run when subclass created');
equal(secondInitializerRunCount, 1, 'second initializers was run when subclass created');
+ run(function() {
+ firstApp.destroy();
+ secondApp.destroy();
+ });
});
QUnit.test("initializers are per-app", function() {
diff --git a/packages/ember-application/tests/system/instance_initializers_test.js b/packages/ember-application/tests/system/instance_initializers_test.js
index d357e38f63f..02731bce6c9 100644
--- a/packages/ember-application/tests/system/instance_initializers_test.js
+++ b/packages/ember-application/tests/system/instance_initializers_test.js
@@ -241,6 +241,8 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
var firstInitializerRunCount = 0;
var secondInitializerRunCount = 0;
var FirstApp = Application.extend();
+ var firstApp, secondApp;
+
FirstApp.instanceInitializer({
name: 'first',
initialize(registry) {
@@ -256,7 +258,7 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
});
jQuery('#qunit-fixture').html('');
run(function() {
- FirstApp.create({
+ firstApp = FirstApp.create({
router: false,
rootElement: '#qunit-fixture #first'
});
@@ -264,19 +266,26 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
equal(firstInitializerRunCount, 1, 'first initializer only was run');
equal(secondInitializerRunCount, 0, 'first initializer only was run');
run(function() {
- SecondApp.create({
+ secondApp = SecondApp.create({
router: false,
rootElement: '#qunit-fixture #second'
});
});
equal(firstInitializerRunCount, 1, 'second initializer only was run');
equal(secondInitializerRunCount, 1, 'second initializer only was run');
+ run(function() {
+ firstApp.destroy();
+ secondApp.destroy();
+ });
+
});
QUnit.test("initializers are concatenated", function() {
var firstInitializerRunCount = 0;
var secondInitializerRunCount = 0;
var FirstApp = Application.extend();
+ var firstApp, secondApp;
+
FirstApp.instanceInitializer({
name: 'first',
initialize(registry) {
@@ -294,7 +303,7 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
jQuery('#qunit-fixture').html('');
run(function() {
- FirstApp.create({
+ firstApp = FirstApp.create({
router: false,
rootElement: '#qunit-fixture #first'
});
@@ -303,13 +312,17 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
equal(secondInitializerRunCount, 0, 'first initializer only was run when base class created');
firstInitializerRunCount = 0;
run(function() {
- SecondApp.create({
+ secondApp = SecondApp.create({
router: false,
rootElement: '#qunit-fixture #second'
});
});
equal(firstInitializerRunCount, 1, 'first initializer was run when subclass created');
equal(secondInitializerRunCount, 1, 'second initializers was run when subclass created');
+ run(function() {
+ firstApp.destroy();
+ secondApp.destroy();
+ });
});
QUnit.test("initializers are per-app", function() {
diff --git a/packages/ember-application/tests/system/logging_test.js b/packages/ember-application/tests/system/logging_test.js
index 2baf7f9068d..4afe0aff202 100644
--- a/packages/ember-application/tests/system/logging_test.js
+++ b/packages/ember-application/tests/system/logging_test.js
@@ -212,12 +212,12 @@ QUnit.test("log which view is used with a template", function() {
}
App.register('template:application', compile('{{outlet}}'));
- App.register('template:foo', function() { return 'Template with custom view'; });
+ App.register('template:foo', compile('Template with custom view'));
App.register('view:posts', View.extend({ templateName: 'foo' }));
run(App, 'advanceReadiness');
visit('/posts').then(function() {
- equal(logs['view:application'], 1, 'expected: Should log use of default view');
+ equal(logs['view:application'], 1, 'toplevel view always get an element');
equal(logs['view:index'], undefined, 'expected: Should not log when index is not present.');
equal(logs['view:posts'], 1, 'expected: Rendering posts with PostsView.');
});
diff --git a/packages/ember-htmlbars/lib/compat/handlebars-get.js b/packages/ember-htmlbars/lib/compat/handlebars-get.js
index 10745f304f1..8c7b4dcca4b 100644
--- a/packages/ember-htmlbars/lib/compat/handlebars-get.js
+++ b/packages/ember-htmlbars/lib/compat/handlebars-get.js
@@ -18,5 +18,5 @@
export default function handlebarsGet(root, path, options) {
Ember.deprecate('Usage of Ember.Handlebars.get is deprecated, use a Component or Ember.Handlebars.makeBoundHelper instead.');
- return options.data.view.getStream(path).value();
+ return options.legacyGetPath(path);
}
diff --git a/packages/ember-htmlbars/lib/compat/helper.js b/packages/ember-htmlbars/lib/compat/helper.js
index da4f9696574..333fb47267c 100644
--- a/packages/ember-htmlbars/lib/compat/helper.js
+++ b/packages/ember-htmlbars/lib/compat/helper.js
@@ -3,13 +3,13 @@
@submodule ember-htmlbars
*/
-import merge from "ember-metal/merge";
import helpers from "ember-htmlbars/helpers";
import View from "ember-views/views/view";
import Component from "ember-views/views/component";
import makeViewHelper from "ember-htmlbars/system/make-view-helper";
import makeBoundHelper from "ember-htmlbars/compat/make-bound-helper";
import { isStream } from "ember-metal/streams/utils";
+import { registerKeyword } from "ember-htmlbars/keywords";
var slice = [].slice;
@@ -23,6 +23,21 @@ function calculateCompatType(item) {
}
}
+function pathFor(param) {
+ if (isStream(param)) {
+ // param arguments to helpers may have their path prefixes with self. For
+ // example {{box-thing foo}} may have a param path of `self.foo` depending
+ // on scope.
+ if (param.source && param.source.dependee && param.source.dependee.label === 'self') {
+ return param.path.slice(5);
+ } else {
+ return param.path;
+ }
+ } else {
+ return param;
+ }
+}
+
/**
Wraps an Handlebars helper with an HTMLBars helper for backwards compatibility.
@@ -31,61 +46,61 @@ function calculateCompatType(item) {
@private
*/
function HandlebarsCompatibleHelper(fn) {
- this.helperFunction = function helperFunc(params, hash, options, env) {
- var param, blockResult, fnResult;
- var context = env.data.view;
+ this.helperFunction = function helperFunc(params, hash, options, env, scope) {
+ var param, fnResult;
+ var hasBlock = options.template && options.template.yield;
+
var handlebarsOptions = {
hash: { },
types: new Array(params.length),
hashTypes: { }
};
- merge(handlebarsOptions, options);
- merge(handlebarsOptions, env);
-
handlebarsOptions.hash = {};
- if (options.isBlock) {
+ if (hasBlock) {
handlebarsOptions.fn = function() {
- blockResult = options.template.render(context, env, options.morph.contextualElement);
+ options.template.yield();
};
- if (options.inverse) {
+ if (options.inverse.yield) {
handlebarsOptions.inverse = function() {
- blockResult = options.inverse.render(context, env, options.morph.contextualElement);
+ options.inverse.yield();
};
}
}
for (var prop in hash) {
param = hash[prop];
-
handlebarsOptions.hashTypes[prop] = calculateCompatType(param);
-
- if (isStream(param)) {
- handlebarsOptions.hash[prop] = param._label;
- } else {
- handlebarsOptions.hash[prop] = param;
- }
+ handlebarsOptions.hash[prop] = pathFor(param);
}
var args = new Array(params.length);
for (var i = 0, l = params.length; i < l; i++) {
param = params[i];
-
handlebarsOptions.types[i] = calculateCompatType(param);
-
- if (isStream(param)) {
- args[i] = param._label;
- } else {
- args[i] = param;
- }
+ args[i] = pathFor(param);
}
+
+ handlebarsOptions.legacyGetPath = function(path) {
+ return env.hooks.get(env, scope, path).value();
+ };
+
+ handlebarsOptions.data = {
+ view: env.view
+ };
+
args.push(handlebarsOptions);
fnResult = fn.apply(this, args);
- return options.isBlock ? blockResult : fnResult;
+ if (options.element) {
+ Ember.deprecate("Returning a string of attributes from a helper inside an element is deprecated.");
+ applyAttributes(env.dom, options.element, fnResult);
+ } else if (!options.template.yield) {
+ return fnResult;
+ }
};
this.isHTMLBars = true;
@@ -96,6 +111,17 @@ HandlebarsCompatibleHelper.prototype = {
};
export function registerHandlebarsCompatibleHelper(name, value) {
+ if (value && value.isLegacyViewHelper) {
+ registerKeyword(name, function(morph, env, scope, params, hash, template, inverse, visitor) {
+ Ember.assert("You can only pass attributes (such as name=value) not bare " +
+ "values to a helper for a View found in '" + value.viewClass + "'", params.length === 0);
+
+ env.hooks.keyword('view', morph, env, scope, [value.viewClass], hash, template, inverse, visitor);
+ return true;
+ });
+ return;
+ }
+
var helper;
if (value && value.isHTMLBars) {
@@ -121,4 +147,15 @@ export function handlebarsHelper(name, value) {
}
}
+function applyAttributes(dom, element, innerString) {
+ var string = "<" + element.tagName + " " + innerString + ">";
+ var fragment = dom.parseHTML(string, dom.createElement(element.tagName));
+
+ var attrs = fragment.firstChild.attributes;
+
+ for (var i=0, l=attrs.length; i 0) {
- var firstParam = params[0];
- // Only bother with subscriptions if the first argument
- // is a stream itself, and not a primitive.
- if (isStream(firstParam)) {
- var onDependentKeyNotify = function onDependentKeyNotify(stream) {
- stream.value();
- lazyValue.notify();
- };
- for (i = 0; i < dependentKeys.length; i++) {
- var childParam = firstParam.get(dependentKeys[i]);
- childParam.value();
- childParam.subscribe(onDependentKeyNotify);
- }
- }
- }
-
- return lazyValue;
- } else {
- return valueFn();
- }
- }
-
- return new Helper(helperFunc);
+ };
}
diff --git a/packages/ember-htmlbars/lib/env.js b/packages/ember-htmlbars/lib/env.js
index afcb199bc22..4da6565f368 100644
--- a/packages/ember-htmlbars/lib/env.js
+++ b/packages/ember-htmlbars/lib/env.js
@@ -1,36 +1,106 @@
import environment from "ember-metal/environment";
-import DOMHelper from "dom-helper";
+import { hooks } from "htmlbars-runtime";
+import merge from "ember-metal/merge";
-import inline from "ember-htmlbars/hooks/inline";
-import content from "ember-htmlbars/hooks/content";
-import component from "ember-htmlbars/hooks/component";
-import block from "ember-htmlbars/hooks/block";
-import element from "ember-htmlbars/hooks/element";
import subexpr from "ember-htmlbars/hooks/subexpr";
-import attribute from "ember-htmlbars/hooks/attribute";
import concat from "ember-htmlbars/hooks/concat";
-import get from "ember-htmlbars/hooks/get";
-import set from "ember-htmlbars/hooks/set";
+import linkRenderNode from "ember-htmlbars/hooks/link-render-node";
+import createFreshScope from "ember-htmlbars/hooks/create-fresh-scope";
+import bindShadowScope from "ember-htmlbars/hooks/bind-shadow-scope";
+import bindSelf from "ember-htmlbars/hooks/bind-self";
+import bindScope from "ember-htmlbars/hooks/bind-scope";
+import bindLocal from "ember-htmlbars/hooks/bind-local";
+import updateSelf from "ember-htmlbars/hooks/update-self";
+import getRoot from "ember-htmlbars/hooks/get-root";
+import getChild from "ember-htmlbars/hooks/get-child";
+import getValue from "ember-htmlbars/hooks/get-value";
+import getCellOrValue from "ember-htmlbars/hooks/get-cell-or-value";
+import cleanupRenderNode from "ember-htmlbars/hooks/cleanup-render-node";
+import destroyRenderNode from "ember-htmlbars/hooks/destroy-render-node";
+import willCleanupTree from "ember-htmlbars/hooks/will-cleanup-tree";
+import didCleanupTree from "ember-htmlbars/hooks/did-cleanup-tree";
+import classify from "ember-htmlbars/hooks/classify";
+import component from "ember-htmlbars/hooks/component";
+import lookupHelper from "ember-htmlbars/hooks/lookup-helper";
+import hasHelper from "ember-htmlbars/hooks/has-helper";
+import invokeHelper from "ember-htmlbars/hooks/invoke-helper";
+import element from "ember-htmlbars/hooks/element";
import helpers from "ember-htmlbars/helpers";
+import keywords, { registerKeyword } from "ember-htmlbars/keywords";
-export default {
- hooks: {
- get: get,
- set: set,
- inline: inline,
- content: content,
- block: block,
- element: element,
- subexpr: subexpr,
- component: component,
- attribute: attribute,
- concat: concat
- },
+import DOMHelper from "ember-htmlbars/system/dom-helper";
- helpers: helpers,
+var emberHooks = merge({}, hooks);
+emberHooks.keywords = keywords;
+merge(emberHooks, {
+ linkRenderNode: linkRenderNode,
+ createFreshScope: createFreshScope,
+ bindShadowScope: bindShadowScope,
+ bindSelf: bindSelf,
+ bindScope: bindScope,
+ bindLocal: bindLocal,
+ updateSelf: updateSelf,
+ getRoot: getRoot,
+ getChild: getChild,
+ getValue: getValue,
+ getCellOrValue: getCellOrValue,
+ subexpr: subexpr,
+ concat: concat,
+ cleanupRenderNode: cleanupRenderNode,
+ destroyRenderNode: destroyRenderNode,
+ willCleanupTree: willCleanupTree,
+ didCleanupTree: didCleanupTree,
+ classify: classify,
+ component: component,
+ lookupHelper: lookupHelper,
+ hasHelper: hasHelper,
+ invokeHelper: invokeHelper,
+ element: element
+});
+
+import debuggerKeyword from "ember-htmlbars/keywords/debugger";
+import withKeyword from "ember-htmlbars/keywords/with";
+import outlet from "ember-htmlbars/keywords/outlet";
+import realOutlet from "ember-htmlbars/keywords/real_outlet";
+import customizedOutlet from "ember-htmlbars/keywords/customized_outlet";
+import unbound from "ember-htmlbars/keywords/unbound";
+import view from "ember-htmlbars/keywords/view";
+import componentKeyword from "ember-htmlbars/keywords/component";
+import partial from "ember-htmlbars/keywords/partial";
+import input from "ember-htmlbars/keywords/input";
+import textarea from "ember-htmlbars/keywords/textarea";
+import collection from "ember-htmlbars/keywords/collection";
+import templateKeyword from "ember-htmlbars/keywords/template";
+import legacyYield from "ember-htmlbars/keywords/legacy-yield";
+import mut, { privateMut } from "ember-htmlbars/keywords/mut";
+import each from "ember-htmlbars/keywords/each";
+import readonly from "ember-htmlbars/keywords/readonly";
+
+registerKeyword('debugger', debuggerKeyword);
+registerKeyword('with', withKeyword);
+registerKeyword('outlet', outlet);
+registerKeyword('@real_outlet', realOutlet);
+registerKeyword('@customized_outlet', customizedOutlet);
+registerKeyword('unbound', unbound);
+registerKeyword('view', view);
+registerKeyword('component', componentKeyword);
+registerKeyword('partial', partial);
+registerKeyword('template', templateKeyword);
+registerKeyword('input', input);
+registerKeyword('textarea', textarea);
+registerKeyword('collection', collection);
+registerKeyword('legacy-yield', legacyYield);
+registerKeyword('mut', mut);
+registerKeyword('@mut', privateMut);
+registerKeyword('each', each);
+registerKeyword('readonly', readonly);
+
+export default {
+ hooks: emberHooks,
+ helpers: helpers,
useFragmentCache: true
};
diff --git a/packages/ember-htmlbars/lib/helpers.js b/packages/ember-htmlbars/lib/helpers.js
index 084f40a5577..3c44b14be41 100644
--- a/packages/ember-htmlbars/lib/helpers.js
+++ b/packages/ember-htmlbars/lib/helpers.js
@@ -16,8 +16,6 @@ var helpers = o_create(null);
@submodule ember-htmlbars
*/
-import Helper from "ember-htmlbars/system/helper";
-
/**
@private
@method _registerHelper
@@ -26,15 +24,7 @@ import Helper from "ember-htmlbars/system/helper";
@param {Object|Function} helperFunc the helper function to add
*/
export function registerHelper(name, helperFunc) {
- var helper;
-
- if (helperFunc && helperFunc.isHelper) {
- helper = helperFunc;
- } else {
- helper = new Helper(helperFunc);
- }
-
- helpers[name] = helper;
+ helpers[name] = helperFunc;
}
export default helpers;
diff --git a/packages/ember-htmlbars/lib/helpers/-bind-attr-class.js b/packages/ember-htmlbars/lib/helpers/-bind-attr-class.js
new file mode 100644
index 00000000000..7ac22c08766
--- /dev/null
+++ b/packages/ember-htmlbars/lib/helpers/-bind-attr-class.js
@@ -0,0 +1,23 @@
+/**
+@module ember
+@submodule ember-htmlbars
+*/
+
+import { get } from 'ember-metal/property_get';
+import { isArray } from "ember-metal/utils";
+
+export default function bindAttrClassHelper(params) {
+ var value = params[0];
+
+ if (isArray(value)) {
+ value = get(value, 'length') !== 0;
+ }
+
+ if (value === true) {
+ return params[1];
+ } if (value === false || value === undefined || value === null) {
+ return "";
+ } else {
+ return value;
+ }
+}
diff --git a/packages/ember-htmlbars/lib/helpers/-concat.js b/packages/ember-htmlbars/lib/helpers/-concat.js
new file mode 100644
index 00000000000..a5c2b90d74c
--- /dev/null
+++ b/packages/ember-htmlbars/lib/helpers/-concat.js
@@ -0,0 +1,7 @@
+/** @private
+ This private helper is used by the legacy class bindings AST transformer
+ to concatenate class names together.
+*/
+export default function concat(params, hash) {
+ return params.join(hash.separator);
+}
diff --git a/packages/ember-htmlbars/lib/helpers/-join-classes.js b/packages/ember-htmlbars/lib/helpers/-join-classes.js
new file mode 100644
index 00000000000..85f2669e9ed
--- /dev/null
+++ b/packages/ember-htmlbars/lib/helpers/-join-classes.js
@@ -0,0 +1,18 @@
+/** @private
+ this private helper is used to join and compact a list of class names
+*/
+
+export default function joinClasses(classNames) {
+ var result = [];
+
+ for (var i=0, l=classNames.length; i` 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
-
-
Hi Yehuda
-
Hi Tom
-
Hi Peter
-
- ```
-
- ### 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
-
-
Greetings Yehuda
-
Greetings Tom
-
Greetings Peter
-
- ```
-
- ### 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
-
-
Howdy Yehuda
-
Howdy Tom
-
Howdy Peter
-
- ```
-
- @method collection
- @for Ember.Handlebars.helpers
- @deprecated Use `{{each}}` helper instead.
-*/
-export function collectionHelper(params, hash, options, env) {
- var path = params[0];
-
- Ember.deprecate("Using the {{collection}} helper without specifying a class has been" +
- " deprecated as the {{each}} helper now supports the same functionality.", path !== 'collection');
-
- Ember.assert("You cannot pass more than one argument to the collection helper", params.length <= 1);
-
- var data = env.data;
- var template = options.template;
- var inverse = options.inverse;
- var view = data.view;
-
- // This should be deterministic, and should probably come from a
- // parent view and not the controller.
- var controller = get(view, 'controller');
- var container = (controller && controller.container ? controller.container : view.container);
-
- // If passed a path string, convert that into an object.
- // Otherwise, just default to the standard class.
- var collectionClass;
- if (path) {
- collectionClass = readViewFactory(path, container);
- Ember.assert(fmt("%@ #collection: Could not find collection class %@", [data.view, path]), !!collectionClass);
- } else {
- collectionClass = CollectionView;
- }
-
- var itemHash = {};
- var match;
-
- // Extract item view class if provided else default to the standard class
- var collectionPrototype = collectionClass.proto();
- var itemViewClass;
-
- if (hash.itemView) {
- itemViewClass = readViewFactory(hash.itemView, container);
- } else if (hash.itemViewClass) {
- itemViewClass = readViewFactory(hash.itemViewClass, container);
- } else {
- itemViewClass = collectionPrototype.itemViewClass;
- }
-
- if (typeof itemViewClass === 'string') {
- itemViewClass = container.lookupFactory('view:'+itemViewClass);
- }
-
- Ember.assert(fmt("%@ #collection: Could not find itemViewClass %@", [data.view, itemViewClass]), !!itemViewClass);
-
- delete hash.itemViewClass;
- delete hash.itemView;
-
- // Go through options passed to the {{collection}} helper and extract options
- // that configure item views instead of the collection itself.
- for (var prop in hash) {
- if (prop === 'itemController' || prop === 'itemClassBinding') {
- continue;
- }
- if (hash.hasOwnProperty(prop)) {
- match = prop.match(/^item(.)(.*)$/);
- if (match) {
- var childProp = match[1].toLowerCase() + match[2];
-
- if (IS_BINDING.test(prop)) {
- itemHash[childProp] = view._getBindingForStream(hash[prop]);
- } else {
- itemHash[childProp] = hash[prop];
- }
- delete hash[prop];
- }
- }
- }
-
- if (template) {
- itemHash.template = template;
- delete options.template;
- }
-
- var emptyViewClass;
- if (inverse) {
- emptyViewClass = get(collectionPrototype, 'emptyViewClass');
- emptyViewClass = emptyViewClass.extend({
- template: inverse,
- tagName: itemHash.tagName
- });
- } else if (hash.emptyViewClass) {
- emptyViewClass = readViewFactory(hash.emptyViewClass, container);
- }
- if (emptyViewClass) { hash.emptyView = emptyViewClass; }
-
- var viewOptions = mergeViewBindings(view, {}, itemHash);
-
- if (hash.itemClassBinding) {
- var itemClassBindings = hash.itemClassBinding.split(' ');
- viewOptions.classNameBindings = map(itemClassBindings, function(classBinding) {
- return streamifyClassNameBinding(view, classBinding);
- });
- }
-
- hash.itemViewClass = itemViewClass;
- hash._itemViewProps = viewOptions;
-
- options.helperName = options.helperName || 'collection';
-
- return env.helpers.view.helperFunction.call(this, [collectionClass], hash, options, env);
-}
diff --git a/packages/ember-htmlbars/lib/helpers/component.js b/packages/ember-htmlbars/lib/helpers/component.js
deleted file mode 100644
index cf3d0d278e3..00000000000
--- a/packages/ember-htmlbars/lib/helpers/component.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
-@module ember
-@submodule ember-htmlbars
-*/
-import Ember from "ember-metal/core"; // Ember.warn, Ember.assert
-import { isStream, read } from "ember-metal/streams/utils";
-import { readComponentFactory } from "ember-views/streams/utils";
-import EmberError from "ember-metal/error";
-import BoundComponentView from "ember-views/views/bound_component_view";
-import mergeViewBindings from "ember-htmlbars/system/merge-view-bindings";
-import appendTemplatedView from "ember-htmlbars/system/append-templated-view";
-
-/**
- The `{{component}}` helper lets you add instances of `Ember.Component` to a
- template. See [Ember.Component](/api/classes/Ember.Component.html) for
- additional information on how a `Component` functions.
-
- `{{component}}`'s primary use is for cases where you want to dynamically
- change which type of component is rendered as the state of your application
- changes.
-
- The provided block will be applied as the template for the component.
-
- Given an empty `` the following template:
-
- ```handlebars
- {{! application.hbs }}
- {{component infographicComponentName}}
- ```
-
- And the following application code
-
- ```javascript
- App = Ember.Application.create();
- App.ApplicationController = Ember.Controller.extend({
- infographicComponentName: function() {
- if (this.get('isMarketOpen')) {
- return "live-updating-chart";
- } else {
- return "market-close-summary";
- }
- }.property('isMarketOpen')
- });
- ```
-
- The `live-updating-chart` component will be appended when `isMarketOpen` is
- `true`, and the `market-close-summary` component will be appended when
- `isMarketOpen` is `false`. If the value changes while the app is running,
- the component will be automatically swapped out accordingly.
-
- Note: You should not use this helper when you are consistently rendering the same
- component. In that case, use standard component syntax, for example:
-
- ```handlebars
- {{! application.hbs }}
- {{live-updating-chart}}
- ```
-
- @method component
- @since 1.11.0
- @for Ember.Handlebars.helpers
-*/
-export function componentHelper(params, hash, options, env) {
- Ember.assert(
- "The `component` helper expects exactly one argument, plus name/property values.",
- params.length === 1
- );
-
- var view = env.data.view;
- var componentNameParam = params[0];
- var container = view.container || read(view._keywords.view).container;
-
- var props = {
- helperName: options.helperName || 'component'
- };
- if (options.template) {
- props.template = options.template;
- }
-
- var viewClass;
- if (isStream(componentNameParam)) {
- viewClass = BoundComponentView;
- props = { _boundComponentOptions: Ember.merge(hash, props) };
- props._boundComponentOptions.componentNameStream = componentNameParam;
- } else {
- viewClass = readComponentFactory(componentNameParam, container);
- if (!viewClass) {
- throw new EmberError('HTMLBars error: Could not find component named "' + componentNameParam + '".');
- }
- mergeViewBindings(view, props, hash);
- }
-
- appendTemplatedView(view, options.morph, viewClass, props);
-}
diff --git a/packages/ember-htmlbars/lib/helpers/each.js b/packages/ember-htmlbars/lib/helpers/each.js
index a0b312ddffc..2def1e411b1 100644
--- a/packages/ember-htmlbars/lib/helpers/each.js
+++ b/packages/ember-htmlbars/lib/helpers/each.js
@@ -1,193 +1,27 @@
-
-/**
-@module ember
-@submodule ember-htmlbars
-*/
-import Ember from "ember-metal/core"; // Ember.assert;
-import EachView from "ember-views/views/each";
-
-/**
- The `{{#each}}` helper loops over elements in a collection. It is an extension
- of the base Handlebars `{{#each}}` helper.
-
- The default behavior of `{{#each}}` is to yield its inner block once for every
- item in an array.
-
- ```javascript
- var developers = [{name: 'Yehuda'},{name: 'Tom'}, {name: 'Paul'}];
- ```
-
- ```handlebars
- {{#each person in developers}}
- {{person.name}}
- {{! `this` is whatever it was outside the #each }}
- {{/each}}
- ```
-
- The same rules apply to arrays of primitives, but the items may need to be
- references with `{{this}}`.
-
- ```javascript
- var developerNames = ['Yehuda', 'Tom', 'Paul']
- ```
-
- ```handlebars
- {{#each name in developerNames}}
- {{name}}
- {{/each}}
- ```
-
- ### {{else}} condition
-
- `{{#each}}` can have a matching `{{else}}`. The contents of this block will render
- if the collection is empty.
-
- ```
- {{#each person in developers}}
- {{person.name}}
- {{else}}
-
Sorry, nobody is available for this task.
- {{/each}}
- ```
-
- ### Specifying an alternative view for each item
-
- `itemViewClass` can control which view will be used during the render of each
- item's template.
-
- The following template:
-
- ```handlebars
-
- ```
-
- Will use the following view for each item
-
- ```javascript
- App.PersonView = Ember.View.extend({
- tagName: 'li'
- });
- ```
-
- Resulting in HTML output that looks like the following:
-
- ```html
-
-
Yehuda
-
Tom
-
Paul
-
- ```
-
- `itemViewClass` also enables a non-block form of `{{each}}`. The view
- must {{#crossLink "Ember.View/toc_templates"}}provide its own template{{/crossLink}},
- and then the block should be dropped. An example that outputs the same HTML
- as the previous one:
-
- ```javascript
- App.PersonView = Ember.View.extend({
- tagName: 'li',
- template: '{{developer.name}}'
- });
- ```
-
- ```handlebars
-
- {{each developer in developers itemViewClass="person"}}
-
- ```
-
- ### Specifying an alternative view for no items (else)
-
- The `emptyViewClass` option provides the same flexibility to the `{{else}}`
- case of the each helper.
-
- ```javascript
- App.NoPeopleView = Ember.View.extend({
- tagName: 'li',
- template: 'No person is available, sorry'
- });
- ```
-
- ```handlebars
-
- {{#each developer in developers emptyViewClass="no-people"}}
-
{{developer.name}}
- {{/each}}
-
- ```
-
- ### Wrapping each item in a controller
-
- Controllers in Ember manage state and decorate data. In many cases,
- providing a controller for each item in a list can be useful.
- Specifically, an {{#crossLink "Ember.ObjectController"}}Ember.ObjectController{{/crossLink}}
- should probably be used. Item controllers are passed the item they
- will present as a `model` property, and an object controller will
- proxy property lookups to `model` for us.
-
- This allows state and decoration to be added to the controller
- while any other property lookups are delegated to the model. An example:
-
- ```javascript
- App.RecruitController = Ember.ObjectController.extend({
- isAvailableForHire: function() {
- return !this.get('isEmployed') && this.get('isSeekingWork');
- }.property('isEmployed', 'isSeekingWork')
- })
- ```
-
- ```handlebars
- {{#each person in developers itemController="recruit"}}
- {{person.name}} {{#if person.isAvailableForHire}}Hire me!{{/if}}
- {{/each}}
- ```
-
- @method each
- @for Ember.Handlebars.helpers
- @param [name] {String} name for item (used with `in`)
- @param [path] {String} path
- @param [options] {Object} Handlebars key/value pairs of options
- @param [options.itemViewClass] {String} a path to a view class used for each item
- @param [options.emptyViewClass] {String} a path to a view class used for each item
- @param [options.itemController] {String} name of a controller to be created for each item
-*/
-function eachHelper(params, hash, options, env) {
- var view = env.data.view;
- var helperName = 'each';
- var path = params[0] || view.getStream('');
-
- Ember.assert(
- "If you pass more than one argument to the each helper, " +
- "it must be in the form {{#each foo in bar}}",
- params.length <= 1
- );
-
- var blockParams = options.template && options.template.blockParams;
-
- if (blockParams) {
- hash.keyword = true;
- hash.blockParams = blockParams;
+import { get } from "ember-metal/property_get";
+import { forEach } from "ember-metal/enumerable_utils";
+import normalizeSelf from "ember-htmlbars/utils/normalize-self";
+
+export default function eachHelper(params, hash, blocks) {
+ var list = params[0];
+ var keyPath = hash.key;
+
+ // TODO: Correct falsy semantics
+ if (!list || get(list, 'length') === 0) {
+ if (blocks.inverse.yield) { blocks.inverse.yield(); }
+ return;
}
- Ember.deprecate(
- "Using the context switching form of {{each}} is deprecated. " +
- "Please use the block param form (`{{#each bar as |foo|}}`) instead.",
- hash.keyword === true || typeof hash.keyword === 'string',
- { url: 'http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope' }
- );
+ forEach(list, function(item, i) {
+ var self;
+ if (blocks.template.arity === 0) {
+ Ember.deprecate(deprecation);
+ self = normalizeSelf(item);
+ }
- hash.dataSource = path;
- options.helperName = options.helperName || helperName;
-
- return env.helpers.collection.helperFunction.call(this, [EachView], hash, options, env);
+ var key = keyPath ? get(item, keyPath) : String(i);
+ blocks.template.yieldItem(key, [item, i], self);
+ });
}
-export {
- EachView,
- eachHelper
-};
+export var deprecation = "Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each items as |item|}}`) instead.";
diff --git a/packages/ember-htmlbars/lib/helpers/if_unless.js b/packages/ember-htmlbars/lib/helpers/if_unless.js
index 7658d6ce948..e5554655386 100644
--- a/packages/ember-htmlbars/lib/helpers/if_unless.js
+++ b/packages/ember-htmlbars/lib/helpers/if_unless.js
@@ -4,94 +4,51 @@
*/
import Ember from "ember-metal/core"; // Ember.assert
-import conditional from "ember-metal/streams/conditional";
import shouldDisplay from "ember-views/streams/should_display";
-import { get } from "ember-metal/property_get";
-import { isStream } from "ember-metal/streams/utils";
-import BoundIfView from "ember-views/views/bound_if_view";
-import emptyTemplate from "ember-htmlbars/templates/empty";
/**
@method if
@for Ember.Handlebars.helpers
*/
-function ifHelper(params, hash, options, env) {
- var helperName = options.helperName || 'if';
- return appendConditional(false, helperName, params, hash, options, env);
+function ifHelper(params, hash, options) {
+ return ifUnless(params, hash, options, shouldDisplay(params[0]));
}
/**
@method unless
@for Ember.Handlebars.helpers
*/
-function unlessHelper(params, hash, options, env) {
- var helperName = options.helperName || 'unless';
- return appendConditional(true, helperName, params, hash, options, env);
+function unlessHelper(params, hash, options) {
+ return ifUnless(params, hash, options, !shouldDisplay(params[0]));
}
-
-function assertInlineIfNotEnabled() {
- Ember.assert(
- "To use the inline forms of the `if` and `unless` helpers you must " +
- "enable the `ember-htmlbars-inline-if-helper` feature flag."
- );
-}
-
-function appendConditional(inverted, helperName, params, hash, options, env) {
- var view = env.data.view;
-
- if (options.isBlock) {
- return appendBlockConditional(view, inverted, helperName, params, hash, options, env);
- } else {
- if (Ember.FEATURES.isEnabled('ember-htmlbars-inline-if-helper')) {
- return appendInlineConditional(view, inverted, helperName, params, hash, options, env);
- } else {
- assertInlineIfNotEnabled();
- }
- }
-}
-
-function appendBlockConditional(view, inverted, helperName, params, hash, options, env) {
+function ifUnless(params, hash, options, truthy) {
Ember.assert(
"The block form of the `if` and `unless` helpers expect exactly one " +
"argument, e.g. `{{#if newMessages}} You have new messages. {{/if}}.`",
- params.length === 1
+ !options.template.yield || params.length === 1
);
- var condition = shouldDisplay(params[0]);
- var truthyTemplate = (inverted ? options.inverse : options.template) || emptyTemplate;
- var falsyTemplate = (inverted ? options.template : options.inverse) || emptyTemplate;
-
- if (isStream(condition)) {
- view.appendChild(BoundIfView, {
- _morph: options.morph,
- _context: get(view, 'context'),
- conditionStream: condition,
- truthyTemplate: truthyTemplate,
- falsyTemplate: falsyTemplate,
- helperName: helperName
- });
- } else {
- var template = condition ? truthyTemplate : falsyTemplate;
- if (template) {
- return template.render(view, env, options.morph.contextualElement);
- }
- }
-}
-
-function appendInlineConditional(view, inverted, helperName, params) {
Ember.assert(
"The inline form of the `if` and `unless` helpers expect two or " +
"three arguments, e.g. `{{if trialExpired 'Expired' expiryDate}}` " +
"or `{{unless isFirstLogin 'Welcome back!'}}`.",
- params.length === 2 || params.length === 3
+ !!options.template.yield || params.length === 2 || params.length === 3
);
- return conditional(
- shouldDisplay(params[0]),
- inverted ? params[2] : params[1],
- inverted ? params[1] : params[2]
- );
+ if (truthy) {
+ if (options.template.yield) {
+ options.template.yield();
+ } else {
+ return params[1];
+ }
+ } else {
+ if (options.inverse.yield) {
+ options.inverse.yield();
+ } else {
+ return params[2];
+ }
+ }
}
export {
diff --git a/packages/ember-htmlbars/lib/helpers/input.js b/packages/ember-htmlbars/lib/helpers/input.js
deleted file mode 100644
index 1247e74524e..00000000000
--- a/packages/ember-htmlbars/lib/helpers/input.js
+++ /dev/null
@@ -1,210 +0,0 @@
-import Checkbox from "ember-views/views/checkbox";
-import TextField from "ember-views/views/text_field";
-import { read } from "ember-metal/streams/utils";
-
-import Ember from "ember-metal/core"; // Ember.assert
-
-/**
-@module ember
-@submodule ember-htmlbars
-*/
-
-/**
-
- The `{{input}}` helper inserts an HTML `` tag into the template,
- with a `type` value of either `text` or `checkbox`. If no `type` is provided,
- `text` will be the default value applied. The attributes of `{{input}}`
- match those of the native HTML tag as closely as possible for these two types.
-
- ## Use as text field
- An `{{input}}` with no `type` or a `type` of `text` will render an HTML text input.
- The following HTML attributes can be set via the helper:
-
-
-
`readonly`
`required`
`autofocus`
-
`value`
`placeholder`
`disabled`
-
`size`
`tabindex`
`maxlength`
-
`name`
`min`
`max`
-
`pattern`
`accept`
`autocomplete`
-
`autosave`
`formaction`
`formenctype`
-
`formmethod`
`formnovalidate`
`formtarget`
-
`height`
`inputmode`
`multiple`
-
`step`
`width`
`form`
-
`selectionDirection`
`spellcheck`
-
-
-
- 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).
-
- ## Unbound:
-
- ```handlebars
- {{input value="http://www.facebook.com"}}
- ```
-
-
- ```html
-
- ```
-
- ## Bound:
-
- ```javascript
- App.ApplicationController = Ember.Controller.extend({
- firstName: "Stanley",
- entryNotAllowed: true
- });
- ```
-
-
- ```handlebars
- {{input type="text" value=firstName disabled=entryNotAllowed size="50"}}
- ```
-
-
- ```html
-
- ```
-
- ## 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)
-
- ## Extension
-
- 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`, meaning that it does NOT inherit
- the `controller` of the parent view.
-
- See more about [Ember components](/api/classes/Ember.Component.html)
-
-
- ## Use as checkbox
-
- An `{{input}}` with a `type` of `checkbox` will render an HTML checkbox input.
- The following HTML attributes can be set via the helper:
-
-* `checked`
-* `disabled`
-* `tabindex`
-* `indeterminate`
-* `name`
-* `autofocus`
-* `form`
-
-
- 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).
-
- ## Unbound:
-
- ```handlebars
- {{input type="checkbox" name="isAdmin"}}
- ```
-
- ```html
-
- ```
-
- ## Bound:
-
- ```javascript
- App.ApplicationController = Ember.Controller.extend({
- isAdmin: true
- });
- ```
-
-
- ```handlebars
- {{input type="checkbox" checked=isAdmin }}
- ```
-
-
- ```html
-
- ```
-
- ## Extension
-
- 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.Handlebars.helpers
- @param {Hash} options
-*/
-export function inputHelper(params, hash, options, env) {
- Ember.assert('You can only pass attributes to the `input` helper, not arguments', params.length === 0);
-
- var onEvent = hash.on;
- var inputType;
-
- inputType = read(hash.type);
-
- if (inputType === 'checkbox') {
- delete hash.type;
-
- Ember.assert("{{input type='checkbox'}} does not support setting `value=someBooleanValue`;" +
- " you must use `checked=someBooleanValue` instead.", !hash.hasOwnProperty('value'));
-
- env.helpers.view.helperFunction.call(this, [Checkbox], hash, options, env);
- } else {
- delete hash.on;
-
- hash.onEvent = onEvent || 'enter';
- env.helpers.view.helperFunction.call(this, [TextField], hash, options, env);
- }
-}
diff --git a/packages/ember-htmlbars/lib/helpers/loc.js b/packages/ember-htmlbars/lib/helpers/loc.js
index e3264cbdb89..b0c5333dcf1 100644
--- a/packages/ember-htmlbars/lib/helpers/loc.js
+++ b/packages/ember-htmlbars/lib/helpers/loc.js
@@ -1,6 +1,4 @@
-import Ember from 'ember-metal/core';
import { loc } from 'ember-runtime/system/string';
-import { isStream } from "ember-metal/streams/utils";
/**
@module ember
@@ -10,44 +8,29 @@ import { isStream } from "ember-metal/streams/utils";
/**
Calls [Ember.String.loc](/api/classes/Ember.String.html#method_loc) with the
provided string.
-
This is a convenient way to localize text within a template:
-
```javascript
Ember.STRINGS = {
'_welcome_': 'Bonjour'
};
```
-
```handlebars
{{loc '_welcome_'}}
```
-
```html
Bonjour
```
-
See [Ember.String.loc](/api/classes/Ember.String.html#method_loc) for how to
set up localized string references.
-
@method loc
@for Ember.Handlebars.helpers
@param {String} str The string to format
@see {Ember.String#loc}
*/
-export function locHelper(params, hash, options, env) {
- Ember.assert('You cannot pass bindings to `loc` helper', (function ifParamsContainBindings() {
- for (var i = 0, l = params.length; i < l; i++) {
- if (isStream(params[i])) {
- return false;
- }
- }
- return true;
- })());
-
- return loc.apply(env.data.view, params);
+export default function locHelper(params) {
+ return loc.apply(null, params);
}
diff --git a/packages/ember-htmlbars/lib/helpers/log.js b/packages/ember-htmlbars/lib/helpers/log.js
index 2ffd8540714..2e6624559e3 100644
--- a/packages/ember-htmlbars/lib/helpers/log.js
+++ b/packages/ember-htmlbars/lib/helpers/log.js
@@ -2,28 +2,19 @@
@module ember
@submodule ember-htmlbars
*/
+
import Logger from "ember-metal/logger";
-import { read } from "ember-metal/streams/utils";
/**
`log` allows you to output the value of variables in the current rendering
context. `log` also accepts primitive types such as strings or numbers.
-
```handlebars
{{log "myVariable:" myVariable }}
```
-
@method log
@for Ember.Handlebars.helpers
@param {String} property
*/
-export function logHelper(params, hash, options, env) {
- var logger = Logger.log;
- var values = [];
-
- for (var i = 0; i < params.length; i++) {
- values.push(read(params[i]));
- }
-
- logger.apply(logger, values);
+export default function logHelper(values) {
+ Logger.log.apply(null, values);
}
diff --git a/packages/ember-htmlbars/lib/helpers/partial.js b/packages/ember-htmlbars/lib/helpers/partial.js
deleted file mode 100644
index c3c32a874a9..00000000000
--- a/packages/ember-htmlbars/lib/helpers/partial.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import { get } from "ember-metal/property_get";
-import { isStream } from "ember-metal/streams/utils";
-import BoundPartialView from "ember-views/views/bound_partial_view";
-import lookupPartial from "ember-views/system/lookup_partial";
-
-/**
-@module ember
-@submodule ember-htmlbars
-*/
-
-/**
- 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.Handlebars.helpers
- @param {String} partialName the name of the template to render minus the leading underscore
-*/
-
-export function partialHelper(params, hash, options, env) {
- var view = env.data.view;
- var templateName = params[0];
-
- if (isStream(templateName)) {
- view.appendChild(BoundPartialView, {
- _morph: options.morph,
- _context: get(view, 'context'),
- templateNameStream: templateName,
- helperName: options.helperName || 'partial'
- });
- } else {
- var template = lookupPartial(view, templateName);
- return template.render(view, env, options.morph.contextualElement);
- }
-}
diff --git a/packages/ember-htmlbars/lib/helpers/template.js b/packages/ember-htmlbars/lib/helpers/template.js
deleted file mode 100644
index 8adc98b6dd5..00000000000
--- a/packages/ember-htmlbars/lib/helpers/template.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import Ember from "ember-metal/core"; // Ember.deprecate;
-
-/**
-@module ember
-@submodule ember-htmlbars
-*/
-
-/**
- @deprecated
- @method template
- @for Ember.Handlebars.helpers
- @param {String} templateName the template to render
-*/
-export function templateHelper(params, hash, options, env) {
- Ember.deprecate("The `template` helper has been deprecated in favor of the `partial` helper." +
- " Please use `partial` instead, which will work the same way.");
-
- options.helperName = options.helperName || 'template';
-
- return env.helpers.partial.helperFunction.call(this, params, hash, options, env);
-}
diff --git a/packages/ember-htmlbars/lib/helpers/text_area.js b/packages/ember-htmlbars/lib/helpers/text_area.js
deleted file mode 100644
index decc68b24f7..00000000000
--- a/packages/ember-htmlbars/lib/helpers/text_area.js
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
-@module ember
-@submodule ember-htmlbars
-*/
-
-import Ember from "ember-metal/core"; // Ember.assert
-import TextArea from "ember-views/views/text_area";
-
-/**
- `{{textarea}}` inserts a new instance of `