mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
5cce6138e5
closes https://github.com/TryGhost/members.js/issues/80 - This adds the link/attribute switcher and chooser directly to Admin in Portal preview area - Thinks links/attributes section was previously shown as a Portal page
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
import Component from '@ember/component';
|
|
import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard';
|
|
import {computed} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {task, timeout} from 'ember-concurrency';
|
|
|
|
export default Component.extend({
|
|
config: service(),
|
|
tagName: '',
|
|
isLink: true,
|
|
|
|
toggleValue: computed('isLink', function () {
|
|
return this.isLink ? 'Show Data Attributes' : 'Show Links';
|
|
}),
|
|
|
|
sectionHeaderLabel: computed('isLink', function () {
|
|
return this.isLink ? 'Link' : 'Data Attribute';
|
|
}),
|
|
|
|
init() {
|
|
this._super(...arguments);
|
|
this.siteUrl = this.config.get('blogUrl');
|
|
},
|
|
|
|
actions: {
|
|
toggleShowLinks() {
|
|
this.toggleProperty('isLink');
|
|
}
|
|
},
|
|
copyDefault: task(function* (data) {
|
|
copyTextToClipboard(data);
|
|
yield timeout(this.isTesting ? 50 : 3000);
|
|
}),
|
|
copySignup: task(function* (data) {
|
|
copyTextToClipboard(data);
|
|
yield timeout(this.isTesting ? 50 : 3000);
|
|
}),
|
|
copySignin: task(function* (data) {
|
|
copyTextToClipboard(data);
|
|
yield timeout(this.isTesting ? 50 : 3000);
|
|
}),
|
|
copyAccountHome: task(function* (data) {
|
|
copyTextToClipboard(data);
|
|
yield timeout(this.isTesting ? 50 : 3000);
|
|
}),
|
|
copyAccountPlans: task(function* (data) {
|
|
copyTextToClipboard(data);
|
|
yield timeout(this.isTesting ? 50 : 3000);
|
|
}),
|
|
copyAccountProfile: task(function* (data) {
|
|
copyTextToClipboard(data);
|
|
yield timeout(this.isTesting ? 50 : 3000);
|
|
})
|
|
});
|