mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
ae4d15d237
no issue - `init()` methods that do nothing but call `super()` aren't adding anything but add noise to class/object definitions
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
/* eslint-disable ghost/ember/alias-model-in-controller */
|
|
import Controller from '@ember/controller';
|
|
import {computed} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default Controller.extend({
|
|
ajax: service(),
|
|
config: service(),
|
|
feature: service(),
|
|
ghostPaths: service(),
|
|
notifications: service(),
|
|
session: service(),
|
|
settings: service(),
|
|
|
|
importErrors: null,
|
|
importSuccessful: false,
|
|
showDeleteAllModal: false,
|
|
submitting: false,
|
|
uploadButtonText: 'Import',
|
|
|
|
importMimeType: null,
|
|
jsonExtension: null,
|
|
jsonMimeType: null,
|
|
yamlExtension: null,
|
|
yamlMimeType: null,
|
|
|
|
yamlAccept: null,
|
|
|
|
blogDomain: computed('config.blogDomain', function () {
|
|
let blogDomain = this.config.blogDomain || '';
|
|
const domainExp = blogDomain.replace('https://', '').replace('http://', '').match(new RegExp('^([^/:?#]+)(?:[/:?#]|$)', 'i'));
|
|
return (domainExp && domainExp[1]) || '';
|
|
}),
|
|
|
|
actions: {
|
|
setDefaultContentVisibility(value) {
|
|
this.set('settings.defaultContentVisibility', value);
|
|
},
|
|
|
|
setStripeConnectIntegrationTokenSetting(stripeConnectIntegrationToken) {
|
|
this.set('settings.stripeConnectIntegrationToken', stripeConnectIntegrationToken);
|
|
}
|
|
},
|
|
|
|
saveSettings: task(function* () {
|
|
const response = yield this.settings.save();
|
|
// Reset from address value on save
|
|
return response;
|
|
}).drop(),
|
|
|
|
reset() {
|
|
// stripeConnectIntegrationToken is not a persisted value so we don't want
|
|
// to keep it around across transitions
|
|
this.settings.set('stripeConnectIntegrationToken', undefined);
|
|
}
|
|
});
|