0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

minor refactors for recent/up-coming deprecations

This commit is contained in:
Kevin Ansfield 2017-01-10 11:49:15 +00:00
parent ffec98a6d7
commit 6bc5fe14a2
3 changed files with 11 additions and 8 deletions

View file

@ -2,7 +2,6 @@ import RSVP from 'rsvp';
import injectService from 'ember-service/inject'; import injectService from 'ember-service/inject';
import {A as emberA} from 'ember-array/utils'; import {A as emberA} from 'ember-array/utils';
import {isBlank} from 'ember-utils'; import {isBlank} from 'ember-utils';
import on from 'ember-evented/on';
import run from 'ember-runloop'; import run from 'ember-runloop';
import {invokeAction} from 'ember-invoke-action'; import {invokeAction} from 'ember-invoke-action';
import computed from 'ember-computed'; import computed from 'ember-computed';
@ -34,11 +33,11 @@ const FullScreenModalComponent = Component.extend({
return modalClasses.join(' '); return modalClasses.join(' ');
}), }),
closeDropdowns: on('didInsertElement', function () { didInsertElement() {
run.schedule('afterRender', this, function () { run.schedule('afterRender', this, function () {
this.get('dropdown').closeDropdowns(); this.get('dropdown').closeDropdowns();
}); });
}), },
actions: { actions: {
close() { close() {

View file

@ -54,9 +54,9 @@ export default Component.extend({
} }
}, },
didReceiveAttrs(attrs) { didReceiveAttrs() {
this._super(...arguments); this._super(...arguments);
let timeout = parseInt(attrs.newAttrs.throttle || this.get('debounce')); let timeout = parseInt(this.get('throttle') || this.get('debounce'));
run.debounce(this, 'trySetValidEmail', timeout); run.debounce(this, 'trySetValidEmail', timeout);
}, },

View file

@ -2,7 +2,6 @@
import Component from 'ember-component'; import Component from 'ember-component';
import Ember from 'ember'; import Ember from 'ember';
import computed, {reads} from 'ember-computed'; import computed, {reads} from 'ember-computed';
import get from 'ember-metal/get';
import injectService from 'ember-service/inject'; import injectService from 'ember-service/inject';
import {htmlSafe} from 'ember-string'; import {htmlSafe} from 'ember-string';
@ -86,12 +85,17 @@ export default Component.extend({
return metaDescription; return metaDescription;
}), }),
didReceiveAttrs(attrs) { didReceiveAttrs() {
this._super(...arguments); this._super(...arguments);
if (get(attrs, 'newAttrs.tag.value.id') !== get(attrs, 'oldAttrs.tag.value.id')) { let oldTagId = this._oldTagId;
let newTagId = this.get('tag.id');
if (newTagId !== oldTagId) {
this.reset(); this.reset();
} }
this._oldTagId = newTagId;
}, },
reset() { reset() {