Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] deprecate view and controller keywords #11401

Merged
merged 1 commit into from
Jun 11, 2015

Conversation

mixonic
Copy link
Member

@mixonic mixonic commented Jun 10, 2015

Using {{view}} and {{controller}} is deprecated.

TODO:

  • Rewrite a failing assertion in ember-routing-htmlbars

@mixonic mixonic force-pushed the deprecate-ember-view-keyword branch from f70d4ce to 9e47c10 Compare June 10, 2015 20:49
@rwjblue
Copy link
Member

rwjblue commented Jun 10, 2015

Could you also perhaps make a deprecation test for {{each controller as |thing|}} (or {{each thing in controller}})?

@mixonic mixonic force-pushed the deprecate-ember-view-keyword branch from 9e47c10 to bc7eead Compare June 10, 2015 20:54
}

function deprecatePath(path) {
Ember.deprecate(`Using {{${path && path.type === 'PathExpression' && path.parts[0]}}} or any path based on it has been deprecated. Please review the deprecation guide for further details.`, !(path && path.type === 'PathExpression' && (path.parts[0] === 'view' || path.parts[0] === 'controller')), { url: 'http://emberjs.com/deprecations/v1.x#toc_view-and-controller-template-keywords' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the location info in this message (otherwise is it extremely hard to track down and fix). You can use https://github.com/emberjs/ember.js/blob/master/packages/ember-template-compiler/lib/system/calculate-location-display.js to build up the the same string as the other AST transforms.

Take a look at https://github.com/emberjs/ember.js/blob/master/packages/ember-template-compiler/lib/plugins/transform-input-on-to-onEvent.js#L50-L59 for an example of how you would interpolate it.

@mixonic mixonic force-pushed the deprecate-ember-view-keyword branch from bc7eead to 6bbd3b7 Compare June 10, 2015 21:11
@mixonic
Copy link
Member Author

mixonic commented Jun 10, 2015

w/ Robert's feedback addressed.

@rwjblue
Copy link
Member

rwjblue commented Jun 10, 2015

👍 - Fire when Travis is happy.

@mixonic mixonic force-pushed the deprecate-ember-view-keyword branch from 0e7367c to 917e465 Compare June 11, 2015 22:42
mixonic added a commit that referenced this pull request Jun 11, 2015
[BUGFIX beta] deprecate view and controller keywords
@mixonic mixonic merged commit 3a7878f into emberjs:master Jun 11, 2015
@mixonic mixonic deleted the deprecate-ember-view-keyword branch June 11, 2015 23:35
bantic added a commit to bantic/ember.js that referenced this pull request Jun 12, 2015
…lect"}}

Use a template-compiler plugin to detect `{{view "string"}}` at compile-time
and issue a deprecation with location information. Has a special case
deprecation when the string === "select".

Removes a test from the view helper tests that was checking for the
deprecation at runtime (and removes the associated code in
the ember-htmlbars package's `keywords/view`).

Note: This does not catch a deprecation when the path is not a string,
e.g., `{{view view.someProperty}}`, however emberjs#11401 would catch and issue
a deprecation message for that case (at runtime).

Also a few changes to deprecations:

  * document `id` param to `Ember.deprecate`
  * include deprecation id in log/error message
  * Use dot-namespaced deprecation ids (more similar to how `instrument` works and paves the way to in the future changing deprecation log levels by paths ie `"view.*"`)
  * globally silence view-related deprecations in tests to avoid overflowing travis ci's log
  * update ember-dev dep in bower (pr: emberjs/ember-dev#153) to `a064f0cd2f4c225ffd023b63d4cb31a79db04aaf`
  * change the view-and-controller-path template compiler plugin to always deprecate `{{controller}}`
  * change the view-and-controller-path template compiler plugin to skip deprecating `{{view}}` when `Ember.ENV._ENABLE_LEGACY_VIW_SUPPORT` is true

refs emberjs#11377
rwjblue pushed a commit that referenced this pull request Jun 13, 2015
…lect"}}

Use a template-compiler plugin to detect `{{view "string"}}` at compile-time
and issue a deprecation with location information. Has a special case
deprecation when the string === "select".

Removes a test from the view helper tests that was checking for the
deprecation at runtime (and removes the associated code in
the ember-htmlbars package's `keywords/view`).

Note: This does not catch a deprecation when the path is not a string,
e.g., `{{view view.someProperty}}`, however #11401 would catch and issue
a deprecation message for that case (at runtime).

Also a few changes to deprecations:

  * document `id` param to `Ember.deprecate`
  * include deprecation id in log/error message
  * Use dot-namespaced deprecation ids (more similar to how `instrument` works and paves the way to in the future changing deprecation log levels by paths ie `"view.*"`)
  * globally silence view-related deprecations in tests to avoid overflowing travis ci's log
  * update ember-dev dep in bower (pr: emberjs/ember-dev#153) to `a064f0cd2f4c225ffd023b63d4cb31a79db04aaf`
  * change the view-and-controller-path template compiler plugin to always deprecate `{{controller}}`
  * change the view-and-controller-path template compiler plugin to skip deprecating `{{view}}` when `Ember.ENV._ENABLE_LEGACY_VIW_SUPPORT` is true

refs #11377

(cherry picked from commit c2bcc86)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants