Skip to content

Commit

Permalink
Deprecate reliance on parentView
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobq committed Jan 25, 2018
1 parent 008c81f commit 5f88a03
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
26 changes: 21 additions & 5 deletions addon/components/md-card-content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Component from '@ember/component';
import { computed } from '@ember/object';
import layout from '../templates/components/md-card-content';
import { deprecate } from '@ember/application/deprecations';

export default Component.extend({
layout,
Expand All @@ -9,15 +10,30 @@ export default Component.extend({

classNameBindings: ['class'],

title: computed(function() {
title: computed('parentView.title', function() {
deprecate('Using md-card-content without passing it a "title" property (relying on parentView.title) is deprecated.',
true, {

This comment has been minimized.

Copy link
@jacobq

jacobq Jan 26, 2018

Author Collaborator

Oops, I just realized that I did not implement these deprecations properly. They should have false instead of true and have a url pointing to a relevant issue/commit/discussion :/

id: 'ember-cli-materialize.deprecate-parentView',
until: '1.0.0'
});
return this.get('parentView.title');
}).volatile(),
}),

titleClass: computed(function() {
titleClass: computed('parentView.titleClass', function() {
deprecate('Using md-card-content without passing it a "titleClass" property (relying on parentView.titleClass) is deprecated.',
true, {
id: 'ember-cli-materialize.deprecate-parentView',
until: '1.0.0'
});
return this.get('parentView.titleClass');
}).volatile(),
}),

activator: computed(function() {
activator: computed('parentView.activator', function() {
deprecate('Using md-card-content without passing it an "activator" property (relying on parentView.activator) is deprecated.',
true, {
id: 'ember-cli-materialize.deprecate-parentView',
until: '1.0.0'
});
return this.get('parentView.activator');
}),

Expand Down
20 changes: 18 additions & 2 deletions addon/components/md-card-reveal.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import Component from '@ember/component';
import { alias } from '@ember/object/computed';
import { computed } from '@ember/object';
import layout from '../templates/components/md-card-reveal';
import { deprecate } from '@ember/application/deprecations';

export default Component.extend({
layout,
tagName: 'div',

classNames: ['card-reveal'],
classNameBindings: ['class'],
activator: alias('parentView.activator')
title: computed('parentView.title', function() {
deprecate('Using md-card-reveal without passing it a "title" property (relying on parentView.title) is deprecated.',
true, {
id: 'ember-cli-materialize.deprecate-parentView',
until: '1.0.0'
});
return this.get('parentView.title');
}),
activator: computed('parentView.activator', function() {
deprecate('Using md-card-reveal without passing it an "activator" property (relying on parentView.activator) is deprecated.',
true, {
id: 'ember-cli-materialize.deprecate-parentView',
until: '1.0.0'
});
return this.get('parentView.activator');
})
});
2 changes: 1 addition & 1 deletion addon/templates/components/md-card-reveal.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<span class="card-title grey-text text-darken-4 {{if activator 'activator'}}">
{{parentView.title}} <i class="material-icons right">close</i>
{{title}} <i class="material-icons right">close</i>
</span>
<p>{{yield}}</p>

0 comments on commit 5f88a03

Please sign in to comment.