diff --git a/features.json b/features.json index 5c4ee8a2222..d9caf942b7a 100644 --- a/features.json +++ b/features.json @@ -35,10 +35,10 @@ "ember-views.render-double-modify": "2.0.0", "ember-routing.router-resource": "2.0.0", "ember-routing.top-level-render-helper": "2.11.0", + "ember-runtime.controller-content": "2.16.0", "ember-runtime.controller-proxy": "2.0.0", "ember-runtime.action-handler-_actions": "2.0.0", "ember-runtime.enumerable-contains": "2.7.0", - "ember-runtime.will-merge-mixin": "2.0.0", "ember-runtime.frozen-copy": "2.0.0", "ember-runtime.freezable-init": "2.0.0", "ember-string-utils.fmt": "2.0.0", diff --git a/packages/ember-runtime/lib/mixins/controller.js b/packages/ember-runtime/lib/mixins/controller.js index c5363b6d4ff..bf7dd073ff4 100644 --- a/packages/ember-runtime/lib/mixins/controller.js +++ b/packages/ember-runtime/lib/mixins/controller.js @@ -1,6 +1,6 @@ import { Mixin, alias } from 'ember-metal'; +import { deprecatingAlias } from 'ember-runtime'; import ActionHandler from './action_handler'; -import ControllerContentModelAliasDeprecation from './controller_content_model_alias_deprecation'; /** @class ControllerMixin @@ -8,7 +8,7 @@ import ControllerContentModelAliasDeprecation from './controller_content_model_a @uses Ember.ActionHandler @private */ -export default Mixin.create(ActionHandler, ControllerContentModelAliasDeprecation, { +export default Mixin.create(ActionHandler, { /* ducktype as a controller */ isController: true, @@ -38,12 +38,15 @@ export default Mixin.create(ActionHandler, ControllerContentModelAliasDeprecatio @property model @public - */ + */ model: null, /** @private */ - content: alias('model') - + content: deprecatingAlias('model', { + id: 'ember-runtime.controller.content-alias', + until: '2.16.0', + url: 'https://emberjs.com/deprecations/v2.x#toc_controller-content-alias' + }) }); diff --git a/packages/ember-runtime/lib/mixins/controller_content_model_alias_deprecation.js b/packages/ember-runtime/lib/mixins/controller_content_model_alias_deprecation.js deleted file mode 100644 index 4f59c8fa383..00000000000 --- a/packages/ember-runtime/lib/mixins/controller_content_model_alias_deprecation.js +++ /dev/null @@ -1,49 +0,0 @@ -import { Mixin } from 'ember-metal'; -import { deprecate } from 'ember-debug'; - -/* - The ControllerContentModelAliasDeprecation mixin is used to provide a useful - deprecation warning when specifying `content` directly on a `Ember.Controller` - (without also specifying `model`). - - Ember versions prior to 1.7 used `model` as an alias of `content`, but due to - much confusion this alias was reversed (so `content` is now an alias of `model). - - This change reduces many caveats with model/content, and also sets a - simple ground rule: Never set a controllers content, rather always set - its model and ember will do the right thing. - - Used internally by Ember in `Ember.Controller`. -*/ -export default Mixin.create({ - /** - @private - - Moves `content` to `model` at extend time if a `model` is not also specified. - - Note that this currently modifies the mixin themselves, which is technically - dubious but is practically of little consequence. This may change in the - future. - - @method willMergeMixin - @since 1.4.0 - */ - willMergeMixin(props) { - // Calling super is only OK here since we KNOW that - // there is another Mixin loaded first. - this._super(...arguments); - - let modelSpecified = !!props.model; - - if (props.content && !modelSpecified) { - props.model = props.content; - delete props['content']; - - deprecate( - 'Do not specify `content` on a Controller, use `model` instead.', - false, - { id: 'ember-runtime.will-merge-mixin', until: '3.0.0' } - ); - } - } -});