Skip to content

Commit

Permalink
Merge pull request #11840 from martndemus/add-deprecation-ids-ember-h…
Browse files Browse the repository at this point in the history
…tmlbars

[DOCS beta] Update `Ember.deprecate` and `Ember.warn` calls in ember-htmlbars with required options
  • Loading branch information
rwjblue committed Jul 21, 2015
2 parents 816f75c + 2412da4 commit b5025c7
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/compat/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function HandlebarsCompatibleHelper(fn) {
fnResult = fn.apply(this, args);

if (options.element) {
Ember.deprecate('Returning a string of attributes from a helper inside an element is deprecated.');
Ember.deprecate('Returning a string of attributes from a helper inside an element is deprecated.', false, { id: 'ember-htmlbars.handlebars-compat-helper', until: '3.0.0' });
applyAttributes(env.dom, options.element, fnResult);
} else if (!options.template.yield) {
return fnResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function legacyEachWithControllerHelper(params, hash, blocks) {
var self;

if (blocks.template.arity === 0) {
Ember.deprecate(deprecation);
Ember.deprecate(deprecation, false, { id: 'ember-htmlbars.each-with-controller-helper', until: '3.0.0' });
self = normalizeSelf(item);
self = bindController(self, true);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/helpers/each.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function eachHelper(params, hash, blocks) {
var keyPath = hash.key;

if (blocks.template.arity === 0) {
Ember.deprecate(deprecation);
Ember.deprecate(deprecation, false, { id: 'ember-htmlbars.each-helper-arity', until: '3.0.0' });
}

if (shouldDisplay(list)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/hooks/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function emberElement(morph, env, scope, path, params, hash, visi

var value = env.hooks.getValue(result);
if (value) {
Ember.deprecate('Returning a string of attributes from a helper inside an element is deprecated.');
Ember.deprecate('Returning a string of attributes from a helper inside an element is deprecated.', false, { id: 'ember-htmlbars.ember-element-value', until: '3.0.0' });
updateElementAttributesFromString(morph.element, value);
}
}
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/hooks/get-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function getKey(scope, key) {
}

function getGlobal(name) {
Ember.deprecate('Global lookup of ' + name + ' from a Handlebars template is deprecated.');
Ember.deprecate('Global lookup of ' + name + ' from a Handlebars template is deprecated.', false, { id: 'ember-htmlbars.get-global', until: '3.0.0' });

// This stream should be memoized, but this path is deprecated and
// will be removed soon so it's not worth the trouble.
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/keywords/outlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { keyword } from 'htmlbars-runtime/hooks';

export default function(morph, env, scope, params, hash, template, inverse, visitor) {
if (hash.hasOwnProperty('view') || hash.hasOwnProperty('viewClass')) {
Ember.deprecate('Passing `view` or `viewClass` to {{outlet}} is deprecated.');
Ember.deprecate('Passing `view` or `viewClass` to {{outlet}} is deprecated.', false, { id: 'ember-htmlbars.pass-view-to-outlet', until: '3.0.0' });
keyword('@customized_outlet', morph, env, scope, params, hash, template, inverse, visitor);
} else {
keyword('@real_outlet', morph, env, scope, params, hash, template, inverse, visitor);
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/keywords/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Ember from 'ember-metal/core';
export let deprecation = 'The `template` helper has been deprecated in favor of the `partial` helper.';

export default function templateKeyword(morph, env, scope, params, hash, template, inverse, visitor) {
Ember.deprecate(deprecation);
Ember.deprecate(deprecation, false, { id: 'ember-htmlbars.template-keyword', until: '3.0.0' });
env.hooks.keyword('partial', morph, env, scope, params, hash, template, inverse, visitor);
return true;
}
3 changes: 2 additions & 1 deletion packages/ember-htmlbars/lib/morphs/attr-morph.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ proto._deprecateEscapedStyle = function EmberAttrMorph_deprecateEscapedStyle(val
}

return !escaped;
}(this.attrName, value, this.escaped))
}(this.attrName, value, this.escaped)),
{ id: 'ember-htmlbars.style-xss-warning' }
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function extractComponentTemplates(component, _templates) {
// as the layout.
layout = componentTemplate;
templates = _templates;
Ember.deprecate('Using deprecated `template` property on a Component.');
Ember.deprecate('Using deprecated `template` property on a Component.', false, { id: 'ember-htmlbars.extract-component-templates', until: '3.0.0' });
}

return { layout, templates };
Expand All @@ -160,7 +160,7 @@ function extractLegacyTemplate(_templates, componentTemplate) {
// There is no block template provided but the component has a
// `template` property.
if ((!_templates || !_templates.default) && componentTemplate) {
Ember.deprecate('Using deprecated `template` property on a Component.');
Ember.deprecate('Using deprecated `template` property on a Component.', false, { id: 'ember-htmlbars.extract-legacy-template', until: '3.0.0' });
templates = { default: componentTemplate.raw };
} else {
templates = _templates;
Expand Down Expand Up @@ -279,7 +279,7 @@ export function createComponent(_component, isAngleBracket, _props, renderNode,

if (!isAngleBracket) {
let hasSuppliedController = 'controller' in attrs; // 2.0TODO remove
Ember.deprecate('controller= is deprecated', !hasSuppliedController);
Ember.deprecate('controller= is deprecated', !hasSuppliedController, { id: 'ember-htmlbars.create-component', until: '3.0.0' });

let snapshot = takeSnapshot(attrs);
props.attrs = snapshot;
Expand Down Expand Up @@ -347,7 +347,7 @@ function mergeBindings(target, attrs) {
// set `"blah"` to the root of the target because
// that would replace all attrs with `attrs.attrs`
if (prop === 'attrs') {
Ember.warn(`Invoking a component with a hash attribute named \`attrs\` is not supported. Please refactor usage of ${target} to avoid passing \`attrs\` as a hash parameter.`);
Ember.warn(`Invoking a component with a hash attribute named \`attrs\` is not supported. Please refactor usage of ${target} to avoid passing \`attrs\` as a hash parameter.`, false, { id: 'ember-htmlbars.component-unsupported-attrs' });
continue;
}
let value = attrs[prop];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ViewNodeManager.create = function(renderNode, env, attrs, found, parentView, pat
let template = getTemplate(component);

if (template) {
Ember.deprecate('Using deprecated `template` property on a ' + (component.isView ? 'View' : 'Component') + '.');
Ember.deprecate('Using deprecated `template` property on a ' + (component.isView ? 'View' : 'Component') + '.', false, { id: 'ember-htmlbars.view-node-manager-create', until: '3.0.0' });
contentTemplate = template.raw;
}
}
Expand Down Expand Up @@ -240,7 +240,7 @@ function mergeBindings(target, attrs) {
// set `"blah"` to the root of the target because
// that would replace all attrs with `attrs.attrs`
if (prop === 'attrs') {
Ember.warn(`Invoking a component with a hash attribute named \`attrs\` is not supported. Please refactor usage of ${target} to avoid passing \`attrs\` as a hash parameter.`);
Ember.warn(`Invoking a component with a hash attribute named \`attrs\` is not supported. Please refactor usage of ${target} to avoid passing \`attrs\` as a hash parameter.`, false, { id: 'ember-htmlbars.view-unsupported-attrs' });
continue;
}
let value = attrs[prop];
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/system/lookup-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function findHelper(name, view, env) {
if (container._registry.has(helperName)) {
helper = container.lookupFactory(helperName);
if (isLegacyBareHelper(helper)) {
Ember.deprecate(`The helper "${name}" is a deprecated bare function helper. Please use Ember.Helper.build to wrap helper functions.`);
Ember.deprecate(`The helper "${name}" is a deprecated bare function helper. Please use Ember.Helper.build to wrap helper functions.`, false, { id: 'ember-htmlbars.legacy-bare-helper', until: '3.0.0' });
helper = new HandlebarsCompatibleHelper(helper);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/utils/decode-each-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function decodeEachKey(item, keyPath, index) {
key = String(key);
}

Ember.deprecate(`Using '${deprecatedSpecialKey}' with the {{each}} helper, is deprecated. Switch to '@identity' or remove 'key=' from your template.`, !deprecatedSpecialKey);
Ember.deprecate(`Using '${deprecatedSpecialKey}' with the {{each}} helper, is deprecated. Switch to '@identity' or remove 'key=' from your template.`, !deprecatedSpecialKey, { id: 'ember-htmlbars.deprecated-special-each-key', until: '3.0.0' });

return key;
}

0 comments on commit b5025c7

Please sign in to comment.