mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
2231dd84c2
no issue
Ember is migrating to `<AngleBracketSyntax />` for component invocation, see https://github.com/emberjs/rfcs/blob/master/text/0311-angle-bracket-invocation.md
We were in a half-way situation where some templates used angle bracket syntax in some places, this PR updates templates to use the syntax everywhere.
This simplifies the rules for what template code is referring to...
`<Component>` = a component
`{{helper}}` = a helper (or locally assigned handlebars variable)
`{{this.foo}}` = data on the template backing context (a component/controller)
`{{@foo}}` = a named argument passed into the component that the component backing class has not modified (note: this commit does not introduce any named arguments)
- ran codemod https://github.com/ember-codemods/ember-angle-brackets-codemod on the following directories:
- `app/templates`
- `lib/koenig-editor/addon/templates`
- removed positional params from components as angle bracket syntax does not support them
- `gh-feature-flag`
- `gh-tour-item`
- `gh-cm-editor`
- `gh-fullscreen-modal`
- `gh-task-button`
- updates some code that was missed in 3c851293c1
to use explicit this
60 lines
1.4 KiB
JavaScript
60 lines
1.4 KiB
JavaScript
import Component from '@ember/component';
|
|
import RSVP from 'rsvp';
|
|
import {computed} from '@ember/object';
|
|
import {A as emberA} from '@ember/array';
|
|
import {isBlank} from '@ember/utils';
|
|
import {run} from '@ember/runloop';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
const FullScreenModalComponent = Component.extend({
|
|
dropdown: service(),
|
|
|
|
model: null,
|
|
modifier: null,
|
|
|
|
modalPath: computed('modal', function () {
|
|
return `modal-${this.modal || 'unknown'}`;
|
|
}),
|
|
|
|
modalClasses: computed('modifiers', function () {
|
|
let modalClass = 'fullscreen-modal';
|
|
let modifiers = (this.modifier || '').split(' ');
|
|
let modalClasses = emberA([modalClass]);
|
|
|
|
modifiers.forEach((modifier) => {
|
|
if (!isBlank(modifier)) {
|
|
let className = `${modalClass}-${modifier}`;
|
|
modalClasses.push(className);
|
|
}
|
|
});
|
|
|
|
return modalClasses.join(' ');
|
|
}),
|
|
|
|
didInsertElement() {
|
|
run.schedule('afterRender', this, function () {
|
|
this.dropdown.closeDropdowns();
|
|
});
|
|
},
|
|
|
|
actions: {
|
|
close() {
|
|
return this.close();
|
|
},
|
|
|
|
confirm() {
|
|
return this.confirm();
|
|
},
|
|
|
|
clickOverlay() {
|
|
this.send('close');
|
|
}
|
|
},
|
|
|
|
// Allowed actions
|
|
close: () => RSVP.resolve(),
|
|
confirm: () => RSVP.resolve()
|
|
});
|
|
|
|
export default FullScreenModalComponent;
|