mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 10:59:30 +03:00
cleanup usage of Ember.inject
This commit is contained in:
parent
366b6d71e0
commit
250e7a3b8b
@ -3,7 +3,9 @@ import DS from 'ember-data';
|
||||
import ghostPaths from 'ghost/utils/ghost-paths';
|
||||
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
|
||||
|
||||
const {inject} = Ember;
|
||||
const {
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {RESTAdapter} = DS;
|
||||
|
||||
export default RESTAdapter.extend(DataAdapterMixin, {
|
||||
@ -12,7 +14,7 @@ export default RESTAdapter.extend(DataAdapterMixin, {
|
||||
host: window.location.origin,
|
||||
namespace: ghostPaths().apiRoot.slice(1),
|
||||
|
||||
session: inject.service('session'),
|
||||
session: service(),
|
||||
|
||||
shouldBackgroundReloadRecord() {
|
||||
return false;
|
||||
|
@ -1,11 +1,14 @@
|
||||
import Ember from 'ember';
|
||||
import Authenticator from 'ember-simple-auth/authenticators/oauth2-password-grant';
|
||||
|
||||
const {computed, inject} = Ember;
|
||||
const {
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Authenticator.extend({
|
||||
config: inject.service(),
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
config: service(),
|
||||
ghostPaths: service(),
|
||||
|
||||
serverTokenEndpoint: computed('ghostPaths.apiRoot', function () {
|
||||
return `${this.get('ghostPaths.apiRoot')}/authentication/token`;
|
||||
|
@ -1,13 +1,17 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: 'article',
|
||||
classNames: ['gh-alert'],
|
||||
classNameBindings: ['typeClass'],
|
||||
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
typeClass: computed('message.type', function () {
|
||||
let type = this.get('message.type');
|
||||
|
@ -1,13 +1,18 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject, observer} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service},
|
||||
observer
|
||||
} = Ember;
|
||||
const {alias} = computed;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: 'aside',
|
||||
classNames: 'gh-alerts',
|
||||
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
messages: alias('notifications.alerts'),
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: '',
|
||||
|
||||
config: inject.service()
|
||||
config: service()
|
||||
});
|
||||
|
@ -1,11 +1,15 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: 'section',
|
||||
classNames: ['gh-view', 'content-view-container'],
|
||||
|
||||
mediaQueries: inject.service(),
|
||||
mediaQueries: service(),
|
||||
previewIsHidden: computed.reads('mediaQueries.maxWidth900')
|
||||
});
|
||||
|
@ -1,7 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
import DropdownMixin from 'ghost/mixins/dropdown-mixin';
|
||||
|
||||
const {Component, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend(DropdownMixin, {
|
||||
tagName: 'button',
|
||||
@ -11,7 +14,7 @@ export default Component.extend(DropdownMixin, {
|
||||
// matches with the dropdown this button toggles
|
||||
dropdownName: null,
|
||||
|
||||
dropdown: inject.service(),
|
||||
dropdown: service(),
|
||||
|
||||
// Notify dropdown service this dropdown should be toggled
|
||||
click(event) {
|
||||
|
@ -1,7 +1,11 @@
|
||||
import Ember from 'ember';
|
||||
import DropdownMixin from 'ghost/mixins/dropdown-mixin';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend(DropdownMixin, {
|
||||
classNames: 'dropdown',
|
||||
@ -21,7 +25,7 @@ export default Component.extend(DropdownMixin, {
|
||||
return this.get('isOpen') && !this.get('closing');
|
||||
}),
|
||||
|
||||
dropdown: inject.service(),
|
||||
dropdown: service(),
|
||||
|
||||
open() {
|
||||
this.set('isOpen', true);
|
||||
|
@ -1,10 +1,15 @@
|
||||
import Ember from 'ember';
|
||||
import uploader from 'ghost/assets/lib/uploader';
|
||||
|
||||
const {$, Component, inject, run} = Ember;
|
||||
const {
|
||||
$,
|
||||
Component,
|
||||
inject: {service},
|
||||
run
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
config: inject.service(),
|
||||
config: service(),
|
||||
|
||||
_scrollWrapper: null,
|
||||
|
||||
|
@ -1,7 +1,13 @@
|
||||
import Ember from 'ember';
|
||||
import LiquidTether from 'liquid-tether/components/liquid-tether';
|
||||
|
||||
const {RSVP, isBlank, on, run} = Ember;
|
||||
const {
|
||||
RSVP: {Promise},
|
||||
inject: {service},
|
||||
isBlank,
|
||||
on,
|
||||
run
|
||||
} = Ember;
|
||||
const emberA = Ember.A;
|
||||
|
||||
const FullScreenModalComponent = LiquidTether.extend({
|
||||
@ -14,7 +20,7 @@ const FullScreenModalComponent = LiquidTether.extend({
|
||||
overlayClass: 'fullscreen-modal-background',
|
||||
modalPath: 'unknown',
|
||||
|
||||
dropdown: Ember.inject.service(),
|
||||
dropdown: service(),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
@ -48,7 +54,7 @@ const FullScreenModalComponent = LiquidTether.extend({
|
||||
return this.attrs.close();
|
||||
}
|
||||
|
||||
return new RSVP.Promise((resolve) => {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
@ -58,7 +64,7 @@ const FullScreenModalComponent = LiquidTether.extend({
|
||||
return this.attrs.confirm();
|
||||
}
|
||||
|
||||
return new RSVP.Promise((resolve) => {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
|
@ -1,6 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
/*
|
||||
This cute little component has two jobs.
|
||||
@ -15,7 +19,7 @@ const {Component, computed, inject} = Ember;
|
||||
export default Component.extend({
|
||||
classNames: ['gh-menu-toggle'],
|
||||
|
||||
mediaQueries: inject.service(),
|
||||
mediaQueries: service(),
|
||||
isMobile: computed.reads('mediaQueries.isMobile'),
|
||||
maximise: false,
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: 'nav',
|
||||
@ -9,8 +12,8 @@ export default Component.extend({
|
||||
|
||||
open: false,
|
||||
|
||||
config: inject.service(),
|
||||
session: inject.service(),
|
||||
config: service(),
|
||||
session: service(),
|
||||
|
||||
mouseEnter() {
|
||||
this.sendAction('onMouseEnter');
|
||||
|
@ -2,14 +2,15 @@ import Ember from 'ember';
|
||||
import ValidationStateMixin from 'ghost/mixins/validation-state';
|
||||
|
||||
const {Component, computed} = Ember;
|
||||
const {readOnly} = computed;
|
||||
|
||||
export default Component.extend(ValidationStateMixin, {
|
||||
classNames: 'gh-blognav-item',
|
||||
classNameBindings: ['errorClass'],
|
||||
|
||||
attributeBindings: ['order:data-order'],
|
||||
order: computed.readOnly('navItem.order'),
|
||||
errors: computed.readOnly('navItem.errors'),
|
||||
order: readOnly('navItem.order'),
|
||||
errors: readOnly('navItem.errors'),
|
||||
|
||||
errorClass: computed('hasError', function () {
|
||||
if (this.get('hasError')) {
|
||||
|
@ -1,6 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: 'article',
|
||||
@ -9,7 +13,7 @@ export default Component.extend({
|
||||
|
||||
message: null,
|
||||
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
typeClass: computed('message.type', function () {
|
||||
let type = this.get('message.type');
|
||||
|
@ -1,13 +1,17 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {alias} = computed;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: 'aside',
|
||||
classNames: 'gh-notifications',
|
||||
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
messages: alias('notifications.notifications')
|
||||
});
|
||||
|
@ -1,14 +1,16 @@
|
||||
import Ember from 'ember';
|
||||
import DropdownButton from 'ghost/components/gh-dropdown-button';
|
||||
|
||||
const {inject} = Ember;
|
||||
const {
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
function K() {
|
||||
return this;
|
||||
}
|
||||
|
||||
export default DropdownButton.extend({
|
||||
dropdown: inject.service(),
|
||||
dropdown: service(),
|
||||
|
||||
click: K,
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
import Ember from 'ember';
|
||||
import GhostDropdown from 'ghost/components/gh-dropdown';
|
||||
|
||||
const {inject} = Ember;
|
||||
const {
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default GhostDropdown.extend({
|
||||
classNames: 'ghost-popover',
|
||||
dropdown: inject.service()
|
||||
dropdown: service()
|
||||
});
|
||||
|
@ -1,7 +1,12 @@
|
||||
import Ember from 'ember';
|
||||
import ActiveLinkWrapper from 'ghost/mixins/active-link-wrapper';
|
||||
|
||||
const {$, Component, computed, inject} = Ember;
|
||||
const {
|
||||
$,
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {alias, equal} = computed;
|
||||
|
||||
export default Component.extend(ActiveLinkWrapper, {
|
||||
@ -15,7 +20,7 @@ export default Component.extend(ActiveLinkWrapper, {
|
||||
isPage: alias('post.page'),
|
||||
isPublished: equal('post.status', 'published'),
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
ghostPaths: service(),
|
||||
|
||||
authorName: computed('post.author.name', 'post.author.email', function () {
|
||||
return this.get('post.author.name') || this.get('post.author.email');
|
||||
|
@ -1,6 +1,11 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject, run} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service},
|
||||
run
|
||||
} = Ember;
|
||||
const {notEmpty} = computed;
|
||||
|
||||
/**
|
||||
@ -26,7 +31,7 @@ export default Component.extend({
|
||||
hasUploadedImage: false,
|
||||
fileStorage: true,
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
ghostPaths: service(),
|
||||
displayGravatar: notEmpty('validEmail'),
|
||||
|
||||
init() {
|
||||
|
@ -2,7 +2,14 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
import Ember from 'ember';
|
||||
|
||||
const {$, Component, RSVP, computed, inject, observer} = Ember;
|
||||
const {
|
||||
$,
|
||||
Component,
|
||||
RSVP,
|
||||
computed,
|
||||
inject: {service},
|
||||
observer
|
||||
} = Ember;
|
||||
const {filterBy} = computed;
|
||||
|
||||
export default Component.extend({
|
||||
@ -18,9 +25,9 @@ export default Component.extend({
|
||||
users: filterBy('content', 'category', 'Users'),
|
||||
tags: filterBy('content', 'category', 'Tags'),
|
||||
|
||||
_store: inject.service('store'),
|
||||
_routing: inject.service('-routing'),
|
||||
ajax: inject.service(),
|
||||
_store: service('store'),
|
||||
_routing: service('-routing'),
|
||||
ajax: service(),
|
||||
|
||||
_selectize: computed(function () {
|
||||
return this.$('select')[0].selectize;
|
||||
|
@ -2,7 +2,14 @@
|
||||
import Ember from 'ember';
|
||||
import boundOneWay from 'ghost/utils/bound-one-way';
|
||||
|
||||
const {Component, Handlebars, computed, get, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
Handlebars,
|
||||
computed,
|
||||
get,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {reads} = computed;
|
||||
|
||||
export default Component.extend({
|
||||
|
||||
@ -16,10 +23,10 @@ export default Component.extend({
|
||||
|
||||
isViewingSubview: false,
|
||||
|
||||
config: inject.service(),
|
||||
config: service(),
|
||||
mediaQueries: service(),
|
||||
|
||||
mediaQueries: Ember.inject.service(),
|
||||
isMobile: Ember.computed.reads('mediaQueries.maxWidth600'),
|
||||
isMobile: reads('mediaQueries.maxWidth600'),
|
||||
|
||||
title: computed('tag.isNew', function () {
|
||||
if (this.get('tag.isNew')) {
|
||||
|
@ -1,13 +1,20 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject, isBlank, observer, run} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service},
|
||||
isBlank,
|
||||
observer,
|
||||
run
|
||||
} = Ember;
|
||||
const {equal, reads} = computed;
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ['view-container'],
|
||||
classNameBindings: ['isMobile'],
|
||||
|
||||
mediaQueries: inject.service(),
|
||||
mediaQueries: service(),
|
||||
|
||||
tags: null,
|
||||
selectedTag: null,
|
||||
|
@ -1,12 +1,19 @@
|
||||
import Ember from 'ember';
|
||||
import uploader from 'ghost/assets/lib/uploader';
|
||||
|
||||
const {Component, computed, get, inject, isEmpty, run} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
get,
|
||||
inject: {service},
|
||||
isEmpty,
|
||||
run
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ['image-uploader', 'js-post-image-upload'],
|
||||
|
||||
config: inject.service(),
|
||||
config: service(),
|
||||
|
||||
imageSource: computed('image', function () {
|
||||
return this.get('image') || '';
|
||||
|
@ -1,6 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
/*
|
||||
Example usage:
|
||||
@ -11,7 +15,7 @@ export default Component.extend({
|
||||
prefix: null,
|
||||
slug: null,
|
||||
|
||||
config: inject.service(),
|
||||
config: service(),
|
||||
|
||||
url: computed('slug', function () {
|
||||
// Get the blog URL and strip the scheme
|
||||
|
@ -1,13 +1,17 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: '',
|
||||
|
||||
user: null,
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
ghostPaths: service(),
|
||||
|
||||
userDefault: computed('ghostPaths', function () {
|
||||
return this.get('ghostPaths.url').asset('/shared/img/user-image.png');
|
||||
|
@ -1,6 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Component, computed, inject} = Ember;
|
||||
const {
|
||||
Component,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
tagName: '',
|
||||
@ -8,7 +12,7 @@ export default Component.extend({
|
||||
user: null,
|
||||
isSending: false,
|
||||
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
createdAt: computed('user.created_at', function () {
|
||||
let createdAt = this.get('user.created_at');
|
||||
|
@ -1,16 +1,18 @@
|
||||
import Ember from 'ember';
|
||||
import ModalComponent from 'ghost/components/modals/base';
|
||||
|
||||
const {inject} = Ember;
|
||||
const {
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default ModalComponent.extend({
|
||||
|
||||
submitting: false,
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
notifications: inject.service(),
|
||||
store: inject.service(),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
notifications: service(),
|
||||
store: service(),
|
||||
ajax: service(),
|
||||
|
||||
_deleteAll() {
|
||||
let deleteUrl = this.get('ghostPaths.url').api('db');
|
||||
|
@ -1,7 +1,11 @@
|
||||
import Ember from 'ember';
|
||||
import ModalComponent from 'ghost/components/modals/base';
|
||||
|
||||
const {computed, inject} = Ember;
|
||||
const {
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
const {alias} = computed;
|
||||
|
||||
export default ModalComponent.extend({
|
||||
@ -10,8 +14,8 @@ export default ModalComponent.extend({
|
||||
|
||||
post: alias('model'),
|
||||
|
||||
notifications: inject.service(),
|
||||
routing: inject.service('-routing'),
|
||||
notifications: service(),
|
||||
routing: service('-routing'),
|
||||
|
||||
_deletePost() {
|
||||
let post = this.get('post');
|
||||
|
@ -2,7 +2,11 @@ import Ember from 'ember';
|
||||
import ModalComponent from 'ghost/components/modals/base';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {RSVP, inject, run} = Ember;
|
||||
const {
|
||||
RSVP: {Promise},
|
||||
inject: {service},
|
||||
run
|
||||
} = Ember;
|
||||
const emberA = Ember.A;
|
||||
|
||||
export default ModalComponent.extend(ValidationEngine, {
|
||||
@ -15,8 +19,8 @@ export default ModalComponent.extend(ValidationEngine, {
|
||||
|
||||
validationType: 'inviteUser',
|
||||
|
||||
notifications: inject.service(),
|
||||
store: inject.service(),
|
||||
notifications: service(),
|
||||
store: service(),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
@ -49,7 +53,7 @@ export default ModalComponent.extend(ValidationEngine, {
|
||||
|
||||
// TODO: either the validator should check the email's existence or
|
||||
// the API should return an appropriate error when attempting to save
|
||||
return new RSVP.Promise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return this._super().then(() => {
|
||||
this.get('store').findAll('user', {reload: true}).then((result) => {
|
||||
let invitedUser = result.findBy('email', email);
|
||||
|
@ -2,7 +2,11 @@ import Ember from 'ember';
|
||||
import ModalComponent from 'ghost/components/modals/base';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {$, computed, inject} = Ember;
|
||||
const {
|
||||
$,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default ModalComponent.extend(ValidationEngine, {
|
||||
validationType: 'signin',
|
||||
@ -10,8 +14,8 @@ export default ModalComponent.extend(ValidationEngine, {
|
||||
submitting: false,
|
||||
authenticationError: null,
|
||||
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
|
||||
identification: computed('session.user.email', function () {
|
||||
return this.get('session.user.email');
|
||||
|
@ -1,7 +1,6 @@
|
||||
import ModalComponent from 'ghost/components/modals/base';
|
||||
|
||||
export default ModalComponent.extend({
|
||||
|
||||
user: null,
|
||||
submitting: false,
|
||||
|
||||
|
@ -3,16 +3,19 @@ import ModalComponent from 'ghost/components/modals/base';
|
||||
import upload from 'ghost/assets/lib/uploader';
|
||||
import cajaSanitizers from 'ghost/utils/caja-sanitizers';
|
||||
|
||||
const {computed, inject, isEmpty} = Ember;
|
||||
const {
|
||||
computed,
|
||||
inject: {service},
|
||||
isEmpty
|
||||
} = Ember;
|
||||
|
||||
export default ModalComponent.extend({
|
||||
|
||||
acceptEncoding: 'image/*',
|
||||
model: null,
|
||||
submitting: false,
|
||||
|
||||
config: inject.service(),
|
||||
notifications: inject.service(),
|
||||
config: service(),
|
||||
notifications: service(),
|
||||
|
||||
imageUrl: computed('model.model', 'model.imageProperty', {
|
||||
get() {
|
||||
|
@ -1,9 +1,13 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Controller, computed, inject} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend({
|
||||
dropdown: inject.service(),
|
||||
dropdown: service(),
|
||||
|
||||
signedOut: computed.match('currentPath', /(signin|signup|setup|reset)/),
|
||||
|
||||
|
@ -4,7 +4,21 @@ import SettingsMenuMixin from 'ghost/mixins/settings-menu-controller';
|
||||
import boundOneWay from 'ghost/utils/bound-one-way';
|
||||
import isNumber from 'ghost/utils/isNumber';
|
||||
|
||||
const {$, ArrayProxy, Controller, Handlebars, PromiseProxyMixin, RSVP, computed, guidFor, inject, isArray, isBlank, observer, run} = Ember;
|
||||
const {
|
||||
$,
|
||||
ArrayProxy,
|
||||
Controller,
|
||||
Handlebars,
|
||||
PromiseProxyMixin,
|
||||
RSVP,
|
||||
computed,
|
||||
guidFor,
|
||||
inject: {service, controller},
|
||||
isArray,
|
||||
isBlank,
|
||||
observer,
|
||||
run
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend(SettingsMenuMixin, {
|
||||
debounceId: null,
|
||||
@ -12,12 +26,12 @@ export default Controller.extend(SettingsMenuMixin, {
|
||||
selectedAuthor: null,
|
||||
uploaderReference: null,
|
||||
|
||||
application: inject.controller(),
|
||||
config: inject.service(),
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
slugGenerator: inject.service('slug-generator'),
|
||||
application: controller(),
|
||||
config: service(),
|
||||
ghostPaths: service(),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
slugGenerator: service(),
|
||||
|
||||
initializeSelectedAuthor: observer('model', function () {
|
||||
return this.get('model.author').then((author) => {
|
||||
|
@ -1,7 +1,11 @@
|
||||
import Ember from 'ember';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {Controller, computed, inject} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend(ValidationEngine, {
|
||||
newPassword: '',
|
||||
@ -12,10 +16,10 @@ export default Controller.extend(ValidationEngine, {
|
||||
|
||||
validationType: 'reset',
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
ajax: service(),
|
||||
|
||||
email: computed('token', function () {
|
||||
// The token base64 encodes the email (and some other stuff),
|
||||
|
@ -1,10 +1,13 @@
|
||||
import Ember from 'ember';
|
||||
import SettingsSaveMixin from 'ghost/mixins/settings-save';
|
||||
|
||||
const {Controller, inject} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend(SettingsSaveMixin, {
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
save() {
|
||||
let notifications = this.get('notifications');
|
||||
|
@ -2,15 +2,20 @@ import Ember from 'ember';
|
||||
import SettingsSaveMixin from 'ghost/mixins/settings-save';
|
||||
import randomPassword from 'ghost/utils/random-password';
|
||||
|
||||
const {Controller, computed, inject, observer} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
computed,
|
||||
inject: {service},
|
||||
observer
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend(SettingsSaveMixin, {
|
||||
|
||||
showUploadLogoModal: false,
|
||||
showUploadCoverModal: false,
|
||||
|
||||
notifications: inject.service(),
|
||||
config: inject.service(),
|
||||
notifications: service(),
|
||||
config: service(),
|
||||
|
||||
selectedTheme: computed('model.activeTheme', 'themes', function () {
|
||||
let activeTheme = this.get('model.activeTheme');
|
||||
|
@ -1,6 +1,12 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {$, Controller, computed, inject, isArray} = Ember;
|
||||
const {
|
||||
$,
|
||||
Controller,
|
||||
computed,
|
||||
inject: {service, controller},
|
||||
isArray
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend({
|
||||
uploadButtonText: 'Import',
|
||||
@ -8,11 +14,11 @@ export default Controller.extend({
|
||||
submitting: false,
|
||||
showDeleteAllModal: false,
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
feature: inject.controller(),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
feature: controller(),
|
||||
ajax: service(),
|
||||
|
||||
labsJSON: computed('model.labs', function () {
|
||||
return JSON.parse(this.get('model.labs') || {});
|
||||
|
@ -3,7 +3,14 @@ import DS from 'ember-data';
|
||||
import SettingsSaveMixin from 'ghost/mixins/settings-save';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {Controller, RSVP, computed, inject, isBlank, observer} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
RSVP,
|
||||
computed,
|
||||
inject: {service},
|
||||
isBlank,
|
||||
observer
|
||||
} = Ember;
|
||||
const {Errors} = DS;
|
||||
const emberA = Ember.A;
|
||||
|
||||
@ -26,8 +33,8 @@ export const NavItem = Ember.Object.extend(ValidationEngine, {
|
||||
});
|
||||
|
||||
export default Controller.extend(SettingsSaveMixin, {
|
||||
config: inject.service(),
|
||||
notifications: inject.service(),
|
||||
config: service(),
|
||||
notifications: service(),
|
||||
|
||||
blogUrl: computed('config.blogUrl', function () {
|
||||
let url = this.get('config.blogUrl');
|
||||
|
@ -1,11 +1,14 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {computed, inject} = Ember;
|
||||
const {
|
||||
computed,
|
||||
inject: {controller}
|
||||
} = Ember;
|
||||
const {alias, equal, sort} = computed;
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
|
||||
tagController: inject.controller('settings.tags.tag'),
|
||||
tagController: controller('settings.tags.tag'),
|
||||
|
||||
selectedTag: alias('tagController.tag'),
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Controller, computed, inject} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
computed,
|
||||
inject: {service, controller}
|
||||
} = Ember;
|
||||
const {alias} = computed;
|
||||
|
||||
export default Controller.extend({
|
||||
@ -10,9 +14,9 @@ export default Controller.extend({
|
||||
tag: alias('model'),
|
||||
isMobile: alias('tagsController.isMobile'),
|
||||
|
||||
applicationController: inject.controller('application'),
|
||||
tagsController: inject.controller('settings.tags'),
|
||||
notifications: inject.service(),
|
||||
applicationController: controller('application'),
|
||||
tagsController: controller('settings.tags'),
|
||||
notifications: service(),
|
||||
|
||||
_saveTagProperty(propKey, newValue) {
|
||||
let tag = this.get('tag');
|
||||
|
@ -1,11 +1,16 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Controller, computed, get, inject} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
computed,
|
||||
get,
|
||||
inject: {service, controller}
|
||||
} = Ember;
|
||||
const {match} = computed;
|
||||
|
||||
export default Controller.extend({
|
||||
appController: inject.controller('application'),
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
appController: controller('application'),
|
||||
ghostPaths: service(),
|
||||
|
||||
showBackLink: match('appController.currentRouteName', /^setup\.(two|three)$/),
|
||||
|
||||
|
@ -1,14 +1,20 @@
|
||||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
|
||||
const {Controller, RSVP, computed, inject, run} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
RSVP,
|
||||
computed,
|
||||
inject: {service, controller},
|
||||
run
|
||||
} = Ember;
|
||||
const {Errors} = DS;
|
||||
const {alias} = computed;
|
||||
const emberA = Ember.A;
|
||||
|
||||
export default Controller.extend({
|
||||
notifications: inject.service(),
|
||||
two: inject.controller('setup/two'),
|
||||
notifications: service(),
|
||||
two: controller('setup/two'),
|
||||
|
||||
errors: Errors.create(),
|
||||
hasValidated: emberA(),
|
||||
|
@ -1,7 +1,12 @@
|
||||
import Ember from 'ember';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {Controller, RSVP, inject, isArray} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
RSVP: {Promise},
|
||||
inject: {service, controller},
|
||||
isArray
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend(ValidationEngine, {
|
||||
size: 90,
|
||||
@ -14,12 +19,12 @@ export default Controller.extend(ValidationEngine, {
|
||||
submitting: false,
|
||||
flowErrors: '',
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
notifications: inject.service(),
|
||||
application: inject.controller(),
|
||||
config: inject.service(),
|
||||
session: inject.service(),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
notifications: service(),
|
||||
application: controller(),
|
||||
config: service(),
|
||||
session: service(),
|
||||
ajax: service(),
|
||||
|
||||
// ValidationEngine settings
|
||||
validationType: 'setup',
|
||||
@ -32,7 +37,7 @@ export default Controller.extend(ValidationEngine, {
|
||||
sendImage(user) {
|
||||
let image = this.get('image');
|
||||
|
||||
return new RSVP.Promise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
image.formData = {};
|
||||
image.submit()
|
||||
.success((response) => {
|
||||
|
@ -1,18 +1,23 @@
|
||||
import Ember from 'ember';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {$, Controller, inject, isArray} = Ember;
|
||||
const {
|
||||
$,
|
||||
Controller,
|
||||
inject: {service, controller},
|
||||
isArray
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend(ValidationEngine, {
|
||||
submitting: false,
|
||||
loggingIn: false,
|
||||
authProperties: ['identification', 'password'],
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
application: inject.controller(),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
application: controller(),
|
||||
ajax: service(),
|
||||
flowErrors: '',
|
||||
|
||||
// ValidationEngine settings
|
||||
|
@ -1,7 +1,12 @@
|
||||
import Ember from 'ember';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {Controller, RSVP, inject, isArray} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
RSVP: {Promise},
|
||||
inject: {service},
|
||||
isArray
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend(ValidationEngine, {
|
||||
// ValidationEngine settings
|
||||
@ -11,17 +16,17 @@ export default Controller.extend(ValidationEngine, {
|
||||
flowErrors: '',
|
||||
image: null,
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
config: inject.service(),
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
config: service(),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
ajax: service(),
|
||||
|
||||
sendImage() {
|
||||
let image = this.get('image');
|
||||
|
||||
this.get('session.user').then((user) => {
|
||||
return new RSVP.Promise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
image.formData = {};
|
||||
image.submit()
|
||||
.success((response) => {
|
||||
|
@ -1,6 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Controller, computed, inject} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {alias, filter} = computed;
|
||||
|
||||
export default Controller.extend({
|
||||
@ -9,7 +13,7 @@ export default Controller.extend({
|
||||
|
||||
users: alias('model'),
|
||||
|
||||
session: inject.service(),
|
||||
session: service(),
|
||||
|
||||
activeUsers: filter('users', function (user) {
|
||||
return /^active|warn-[1-4]|locked$/.test(user.get('status'));
|
||||
|
@ -3,7 +3,13 @@ import isNumber from 'ghost/utils/isNumber';
|
||||
import boundOneWay from 'ghost/utils/bound-one-way';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {Controller, RSVP, computed, inject, isArray} = Ember;
|
||||
const {
|
||||
Controller,
|
||||
RSVP,
|
||||
computed,
|
||||
inject: {service},
|
||||
isArray
|
||||
} = Ember;
|
||||
const {alias, and, not, or, readOnly} = computed;
|
||||
|
||||
export default Controller.extend(ValidationEngine, {
|
||||
@ -16,12 +22,12 @@ export default Controller.extend(ValidationEngine, {
|
||||
showUploadCoverModal: false,
|
||||
showUplaodImageModal: false,
|
||||
|
||||
ajax: inject.service(),
|
||||
dropdown: inject.service(),
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
slugGenerator: inject.service('slug-generator'),
|
||||
ajax: service(),
|
||||
dropdown: service(),
|
||||
ghostPaths: service(),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
slugGenerator: service(),
|
||||
|
||||
user: alias('model'),
|
||||
currentUser: alias('session.user'),
|
||||
|
@ -2,7 +2,14 @@ import Ember from 'ember';
|
||||
import PostModel from 'ghost/models/post';
|
||||
import boundOneWay from 'ghost/utils/bound-one-way';
|
||||
|
||||
const {Mixin, RSVP, computed, inject, observer, run} = Ember;
|
||||
const {
|
||||
Mixin,
|
||||
RSVP: {resolve},
|
||||
computed,
|
||||
inject: {service, controller},
|
||||
observer,
|
||||
run
|
||||
} = Ember;
|
||||
const {alias} = computed;
|
||||
|
||||
// this array will hold properties we need to watch
|
||||
@ -21,8 +28,8 @@ export default Mixin.create({
|
||||
showLeaveEditorModal: false,
|
||||
showReAuthenticateModal: false,
|
||||
|
||||
postSettingsMenuController: inject.controller('post-settings-menu'),
|
||||
notifications: inject.service(),
|
||||
postSettingsMenuController: controller('post-settings-menu'),
|
||||
notifications: service(),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
@ -312,7 +319,7 @@ export default Mixin.create({
|
||||
psmController.generateAndSetSlug('model.slug');
|
||||
}
|
||||
|
||||
promise = RSVP.resolve(psmController.get('lastPromise')).then(() => {
|
||||
promise = resolve(psmController.get('lastPromise')).then(() => {
|
||||
return this.get('model').save(options).then((model) => {
|
||||
if (!options.silent) {
|
||||
this.showSaveNotification(prevStatus, model.get('status'), isNew ? true : false);
|
||||
|
@ -1,7 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
import getRequestErrorMessage from 'ghost/utils/ajax';
|
||||
|
||||
const {Mixin, inject} = Ember;
|
||||
const {
|
||||
Mixin,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
let defaultPaginationSettings = {
|
||||
page: 1,
|
||||
@ -9,7 +12,7 @@ let defaultPaginationSettings = {
|
||||
};
|
||||
|
||||
export default Mixin.create({
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
paginationModel: null,
|
||||
paginationSettings: null,
|
||||
|
@ -1,9 +1,13 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Mixin, computed, inject} = Ember;
|
||||
const {
|
||||
Mixin,
|
||||
computed,
|
||||
inject: {controller}
|
||||
} = Ember;
|
||||
|
||||
export default Mixin.create({
|
||||
application: inject.controller(),
|
||||
application: controller(),
|
||||
|
||||
isViewingSubview: computed('application.showSettingsMenu', {
|
||||
get() {
|
||||
|
@ -3,7 +3,10 @@ import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {computed, inject} = Ember;
|
||||
const {
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {equal} = computed;
|
||||
const {Model, attr, belongsTo, hasMany} = DS;
|
||||
|
||||
@ -36,8 +39,8 @@ export default Model.extend(ValidationEngine, {
|
||||
}),
|
||||
url: attr('string'),
|
||||
|
||||
config: inject.service(),
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
config: service(),
|
||||
ghostPaths: service(),
|
||||
|
||||
absoluteUrl: computed('url', 'ghostPaths.url', 'config.blogUrl', function () {
|
||||
let blogUrl = this.get('config.blogUrl');
|
||||
|
@ -3,7 +3,10 @@ import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
const {computed, inject} = Ember;
|
||||
const {
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {equal, empty} = computed;
|
||||
const {Model, attr, hasMany} = DS;
|
||||
|
||||
@ -35,8 +38,8 @@ export default Model.extend(ValidationEngine, {
|
||||
}),
|
||||
count: DS.attr('raw'),
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
ajax: service(),
|
||||
|
||||
// TODO: Once client-side permissions are in place,
|
||||
// remove the hard role check.
|
||||
|
@ -3,13 +3,16 @@ import ghostPaths from 'ghost/utils/ghost-paths';
|
||||
import documentTitle from 'ghost/utils/document-title';
|
||||
import config from './config/environment';
|
||||
|
||||
const {inject, on} = Ember;
|
||||
const {
|
||||
inject: {service},
|
||||
on
|
||||
} = Ember;
|
||||
|
||||
let Router = Ember.Router.extend({
|
||||
location: config.locationType, // use HTML5 History API instead of hash-tag based URLs
|
||||
rootURL: ghostPaths().adminRoot, // admin interface lives under sub-directory /ghost
|
||||
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
displayDelayedNotifications: on('didTransition', function () {
|
||||
this.get('notifications').displayDelayed();
|
||||
|
@ -2,15 +2,17 @@ import Ember from 'ember';
|
||||
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
||||
import styleBody from 'ghost/mixins/style-body';
|
||||
|
||||
const {inject} = Ember;
|
||||
const {
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default AuthenticatedRoute.extend(styleBody, {
|
||||
titleToken: 'About',
|
||||
|
||||
classNames: ['view-about'],
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
ajax: service(),
|
||||
|
||||
cachedConfig: false,
|
||||
|
||||
|
@ -5,7 +5,10 @@ import ShortcutsRoute from 'ghost/mixins/shortcuts-route';
|
||||
import ctrlOrCmd from 'ghost/utils/ctrl-or-cmd';
|
||||
import windowProxy from 'ghost/utils/window-proxy';
|
||||
|
||||
const {Route, inject} = Ember;
|
||||
const {
|
||||
Route,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
function K() {
|
||||
return this;
|
||||
@ -19,9 +22,9 @@ shortcuts[`${ctrlOrCmd}+s`] = {action: 'save', scope: 'all'};
|
||||
export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||
shortcuts,
|
||||
|
||||
config: inject.service(),
|
||||
dropdown: inject.service(),
|
||||
notifications: inject.service(),
|
||||
config: service(),
|
||||
dropdown: service(),
|
||||
notifications: service(),
|
||||
|
||||
afterModel(model, transition) {
|
||||
if (this.get('session.isAuthenticated')) {
|
||||
|
@ -1,15 +1,21 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {Route, addObserver, inject, removeObserver} = Ember;
|
||||
const {
|
||||
Route,
|
||||
addObserver,
|
||||
inject: {service},
|
||||
removeObserver,
|
||||
K
|
||||
} = Ember;
|
||||
|
||||
// Routes that extend MobileIndexRoute need to implement
|
||||
// desktopTransition, a function which is called when
|
||||
// the user resizes to desktop levels.
|
||||
export default Route.extend({
|
||||
desktopTransition: Ember.K,
|
||||
desktopTransition: K,
|
||||
_callDesktopTransition: null,
|
||||
|
||||
mediaQueries: inject.service(),
|
||||
mediaQueries: service(),
|
||||
|
||||
activate() {
|
||||
this._super(...arguments);
|
||||
|
@ -2,13 +2,16 @@ import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
import MobileIndexRoute from 'ghost/routes/mobile-index-route';
|
||||
|
||||
const {computed, inject} = Ember;
|
||||
const {
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {reads} = computed;
|
||||
|
||||
export default MobileIndexRoute.extend(AuthenticatedRouteMixin, {
|
||||
noPosts: false,
|
||||
|
||||
mediaQueries: inject.service(),
|
||||
mediaQueries: service(),
|
||||
isMobile: reads('mediaQueries.isMobile'),
|
||||
|
||||
// Transition to a specific post if we're not on mobile
|
||||
|
@ -2,13 +2,16 @@ import Ember from 'ember';
|
||||
import Configuration from 'ember-simple-auth/configuration';
|
||||
import styleBody from 'ghost/mixins/style-body';
|
||||
|
||||
const {Route, inject} = Ember;
|
||||
const {
|
||||
Route,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(styleBody, {
|
||||
classNames: ['ghost-reset'],
|
||||
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
|
||||
beforeModel() {
|
||||
this._super(...arguments);
|
||||
|
@ -1,11 +1,12 @@
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
||||
|
||||
const {inject} = Ember;
|
||||
const {
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default AuthenticatedRoute.extend({
|
||||
|
||||
mediaQueries: inject.service(),
|
||||
mediaQueries: service(),
|
||||
|
||||
beforeModel() {
|
||||
let firstTag = this.modelFor('settings.tags').get('firstObject');
|
||||
|
@ -2,16 +2,19 @@ import Ember from 'ember';
|
||||
import Configuration from 'ember-simple-auth/configuration';
|
||||
import styleBody from 'ghost/mixins/style-body';
|
||||
|
||||
const {Route, inject} = Ember;
|
||||
const {
|
||||
Route,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(styleBody, {
|
||||
titleToken: 'Setup',
|
||||
|
||||
classNames: ['ghost-setup'],
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
session: inject.service(),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service('ghost-paths'),
|
||||
session: service(),
|
||||
ajax: service(),
|
||||
|
||||
// use the beforeModel hook to check to see whether or not setup has been
|
||||
// previously completed. If it has, stop the transition into the setup page.
|
||||
|
@ -1,7 +1,11 @@
|
||||
import Ember from 'ember';
|
||||
import AjaxService from 'ember-ajax/services/ajax';
|
||||
|
||||
const {Route, inject, run} = Ember;
|
||||
const {
|
||||
Route,
|
||||
inject: {service},
|
||||
run
|
||||
} = Ember;
|
||||
|
||||
let DownloadCountPoller = Ember.Object.extend({
|
||||
url: null,
|
||||
@ -45,7 +49,7 @@ let DownloadCountPoller = Ember.Object.extend({
|
||||
});
|
||||
|
||||
export default Route.extend({
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
ghostPaths: service('ghost-paths'),
|
||||
|
||||
model() {
|
||||
return DownloadCountPoller.create({url: this.get('ghostPaths.count')});
|
||||
|
@ -3,7 +3,10 @@ import styleBody from 'ghost/mixins/style-body';
|
||||
import Configuration from 'ember-simple-auth/configuration';
|
||||
import DS from 'ember-data';
|
||||
|
||||
const {Route, inject} = Ember;
|
||||
const {
|
||||
Route,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {Errors} = DS;
|
||||
|
||||
export default Route.extend(styleBody, {
|
||||
@ -11,7 +14,7 @@ export default Route.extend(styleBody, {
|
||||
|
||||
classNames: ['ghost-login'],
|
||||
|
||||
session: inject.service(),
|
||||
session: service(),
|
||||
|
||||
beforeModel() {
|
||||
this._super(...arguments);
|
||||
|
@ -2,14 +2,17 @@ import Ember from 'ember';
|
||||
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
||||
import styleBody from 'ghost/mixins/style-body';
|
||||
|
||||
const {canInvoke, inject} = Ember;
|
||||
const {
|
||||
canInvoke,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default AuthenticatedRoute.extend(styleBody, {
|
||||
titleToken: 'Sign Out',
|
||||
|
||||
classNames: ['ghost-signout'],
|
||||
|
||||
notifications: inject.service(),
|
||||
notifications: service(),
|
||||
|
||||
afterModel(model, transition) {
|
||||
this.get('notifications').clearAll();
|
||||
|
@ -3,16 +3,20 @@ import DS from 'ember-data';
|
||||
import Configuration from 'ember-simple-auth/configuration';
|
||||
import styleBody from 'ghost/mixins/style-body';
|
||||
|
||||
const {Route, RSVP, inject} = Ember;
|
||||
const {
|
||||
Route,
|
||||
RSVP: {Promise},
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
const {Errors} = DS;
|
||||
|
||||
export default Route.extend(styleBody, {
|
||||
classNames: ['ghost-signup'],
|
||||
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
notifications: inject.service(),
|
||||
session: inject.service(),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service('ghost-paths'),
|
||||
notifications: service(),
|
||||
session: service(),
|
||||
ajax: service(),
|
||||
|
||||
beforeModel() {
|
||||
this._super(...arguments);
|
||||
@ -29,7 +33,7 @@ export default Route.extend(styleBody, {
|
||||
let email,
|
||||
tokenText;
|
||||
|
||||
return new RSVP.Promise((resolve) => {
|
||||
return new Promise((resolve) => {
|
||||
if (!re.test(params.token)) {
|
||||
this.get('notifications').showAlert('Invalid token.', {type: 'error', delayed: true, key: 'signup.create.invalid-token'});
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
import Ember from 'ember';
|
||||
import SessionService from 'ember-simple-auth/services/session';
|
||||
|
||||
const {computed, inject} = Ember;
|
||||
const {
|
||||
computed,
|
||||
inject: {service}
|
||||
} = Ember;
|
||||
|
||||
export default SessionService.extend({
|
||||
store: inject.service(),
|
||||
store: service(),
|
||||
|
||||
user: computed(function () {
|
||||
return this.get('store').findRecord('user', 'me');
|
||||
|
@ -1,16 +1,20 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
const {RSVP, inject, Service} = Ember;
|
||||
const {
|
||||
RSVP: {resolve},
|
||||
inject: {service},
|
||||
Service
|
||||
} = Ember;
|
||||
|
||||
export default Service.extend({
|
||||
ghostPaths: inject.service('ghost-paths'),
|
||||
ajax: inject.service(),
|
||||
ghostPaths: service(),
|
||||
ajax: service(),
|
||||
|
||||
generateSlug(slugType, textToSlugify) {
|
||||
let url;
|
||||
|
||||
if (!textToSlugify) {
|
||||
return RSVP.resolve('');
|
||||
return resolve('');
|
||||
}
|
||||
|
||||
url = this.get('ghostPaths.url').api('slugs', slugType, encodeURIComponent(textToSlugify));
|
||||
|
Loading…
Reference in New Issue
Block a user