mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 08:54:36 +03:00
b8a1036a43
closes TryGhost/Ghost#8107 - replaces all icons in Ghost-Admin with SVGs by using our new helper {{inline-svg}}. - removes all ghosticon fonts. This is the second and final batch of the refactor.
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import Component from 'ember-component';
|
|
import injectService from 'ember-service/inject';
|
|
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
|
import {formatDate} from 'ghost-admin/utils/date-formatting';
|
|
import {InvokeActionMixin} from 'ember-invoke-action';
|
|
import moment from 'moment';
|
|
|
|
export default Component.extend(InvokeActionMixin, {
|
|
tagName: 'span',
|
|
classNames: 'gh-input-icon gh-icon-calendar',
|
|
|
|
datetime: boundOneWay('value'),
|
|
inputClass: null,
|
|
inputId: null,
|
|
inputName: null,
|
|
settings: injectService(),
|
|
|
|
didReceiveAttrs() {
|
|
let datetime = this.get('datetime') || moment.utc();
|
|
let blogTimezone = this.get('settings.activeTimezone');
|
|
|
|
if (!this.get('update')) {
|
|
throw new Error(`You must provide an \`update\` action to \`{{${this.templateName}}}\`.`);
|
|
}
|
|
|
|
this.set('datetime', formatDate(datetime || moment.utc(), blogTimezone));
|
|
},
|
|
|
|
focusOut() {
|
|
let datetime = this.get('datetime');
|
|
|
|
this.invokeAction('update', datetime);
|
|
}
|
|
});
|