mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Wired admin bulk email settings UI to read/write setting
no issue
This commit is contained in:
parent
0e43505db1
commit
6a972d8b9e
@ -29,17 +29,19 @@ export default Component.extend({
|
|||||||
subscriptionSettings.stripeConfig = stripeProcessor.config;
|
subscriptionSettings.stripeConfig = stripeProcessor.config;
|
||||||
subscriptionSettings.allowSelfSignup = !!subscriptionSettings.allowSelfSignup;
|
subscriptionSettings.allowSelfSignup = !!subscriptionSettings.allowSelfSignup;
|
||||||
subscriptionSettings.fromAddress = subscriptionSettings.fromAddress || '';
|
subscriptionSettings.fromAddress = subscriptionSettings.fromAddress || '';
|
||||||
if (Object.keys(subscriptionSettings).includes('mailgunApiKey')) {
|
|
||||||
subscriptionSettings.mailgunApiKey = subscriptionSettings.mailgunApiKey || '';
|
|
||||||
subscriptionSettings.mailgunDomain = subscriptionSettings.mailgunDomain || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return subscriptionSettings;
|
return subscriptionSettings;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
hasMailgunAPIKeyOption: computed('settings.membersSubscriptionSettings', function () {
|
bulkEmailSettings: computed('settings.bulkEmailSettings', function () {
|
||||||
let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings'));
|
let bulkEmailSettings = this.get('settings.bulkEmailSettings') || {};
|
||||||
return Object.keys(subscriptionSettings).includes('mailgunApiKey');
|
const {apiKey = '', baseUrl = '', domain = ''} = bulkEmailSettings;
|
||||||
|
return {apiKey, baseUrl, domain};
|
||||||
|
}),
|
||||||
|
|
||||||
|
hasBulkEmailConfig: computed('settings.bulkEmailSettings', function () {
|
||||||
|
let bulkEmailSettings = this.get('settings.bulkEmailSettings');
|
||||||
|
return !!bulkEmailSettings.isConfig;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
defaultContentVisibility: computed('settings.defaultContentVisibility', function () {
|
defaultContentVisibility: computed('settings.defaultContentVisibility', function () {
|
||||||
@ -50,6 +52,11 @@ export default Component.extend({
|
|||||||
setDefaultContentVisibility(value) {
|
setDefaultContentVisibility(value) {
|
||||||
this.setDefaultContentVisibility(value);
|
this.setDefaultContentVisibility(value);
|
||||||
},
|
},
|
||||||
|
setBulkEmailSettings(key, event) {
|
||||||
|
let bulkEmailSettings = this.get('settings.bulkEmailSettings') || {};
|
||||||
|
bulkEmailSettings[key] = event.target.value;
|
||||||
|
this.setBulkEmailSettings(bulkEmailSettings);
|
||||||
|
},
|
||||||
setSubscriptionSettings(key, event) {
|
setSubscriptionSettings(key, event) {
|
||||||
let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings'));
|
let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings'));
|
||||||
let stripeProcessor = subscriptionSettings.paymentProcessors.find((proc) => {
|
let stripeProcessor = subscriptionSettings.paymentProcessors.find((proc) => {
|
||||||
@ -80,12 +87,6 @@ export default Component.extend({
|
|||||||
if (key === 'fromAddress') {
|
if (key === 'fromAddress') {
|
||||||
subscriptionSettings.fromAddress = event.target.value;
|
subscriptionSettings.fromAddress = event.target.value;
|
||||||
}
|
}
|
||||||
if (key === 'mailgunApiKey') {
|
|
||||||
subscriptionSettings.mailgunApiKey = event.target.value;
|
|
||||||
}
|
|
||||||
if (key === 'mailgunDomain') {
|
|
||||||
subscriptionSettings.mailgunDomain = event.target.value;
|
|
||||||
}
|
|
||||||
this.setMembersSubscriptionSettings(subscriptionSettings);
|
this.setMembersSubscriptionSettings(subscriptionSettings);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -163,6 +163,10 @@ export default Controller.extend({
|
|||||||
|
|
||||||
setMembersSubscriptionSettings(subscriptionSettings) {
|
setMembersSubscriptionSettings(subscriptionSettings) {
|
||||||
this.set('settings.membersSubscriptionSettings', JSON.stringify(subscriptionSettings));
|
this.set('settings.membersSubscriptionSettings', JSON.stringify(subscriptionSettings));
|
||||||
|
},
|
||||||
|
|
||||||
|
setBulkEmailSettings(bulkEmailSettings) {
|
||||||
|
this.set('settings.bulkEmailSettings', bulkEmailSettings);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -185,12 +185,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="f8 fw4 midgrey mt1">Your members will receive system emails from this address</div>
|
<div class="f8 fw4 midgrey mt1">Your members will receive system emails from this address</div>
|
||||||
{{/gh-form-group}}
|
{{/gh-form-group}}
|
||||||
{{#if hasMailgunAPIKeyOption}}
|
{{#unless hasBulkEmailConfig}}
|
||||||
{{#gh-form-group}}
|
{{#gh-form-group}}
|
||||||
<label class="fw6 f8">Mailgun domain</label>
|
<label class="fw6 f8">Mailgun domain</label>
|
||||||
{{gh-text-input
|
{{gh-text-input
|
||||||
value=(readonly subscriptionSettings.mailgunDomain)
|
value=(readonly bulkEmailSettings.domain)
|
||||||
input=(action "setSubscriptionSettings" "mailgunDomain")
|
input=(action "setBulkEmailSettings" "domain")
|
||||||
class="mt1"
|
class="mt1"
|
||||||
}}
|
}}
|
||||||
<a href="https://app.mailgun.com/app/sending/domains" target="_blank" class="mt1 fw4 f8">
|
<a href="https://app.mailgun.com/app/sending/domains" target="_blank" class="mt1 fw4 f8">
|
||||||
@ -201,8 +201,8 @@
|
|||||||
<label class="fw6 f8">Mailgun API key</label>
|
<label class="fw6 f8">Mailgun API key</label>
|
||||||
{{gh-text-input
|
{{gh-text-input
|
||||||
type="password"
|
type="password"
|
||||||
value=(readonly subscriptionSettings.mailgunApiKey)
|
value=(readonly bulkEmailSettings.apiKey)
|
||||||
input=(action "setSubscriptionSettings" "mailgunApiKey")
|
input=(action "setBulkEmailSettings" "apiKey")
|
||||||
class="mt1 password"
|
class="mt1 password"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
}}
|
}}
|
||||||
@ -210,7 +210,16 @@
|
|||||||
Find your Mailgun API keys here »
|
Find your Mailgun API keys here »
|
||||||
</a>
|
</a>
|
||||||
{{/gh-form-group}}
|
{{/gh-form-group}}
|
||||||
{{/if}}
|
|
||||||
|
{{#gh-form-group}}
|
||||||
|
<label class="fw6 f8">Mailgun base url</label>
|
||||||
|
{{gh-text-input
|
||||||
|
value=(readonly bulkEmailSettings.baseUrl)
|
||||||
|
input=(action "setBulkEmailSettings" "baseUrl")
|
||||||
|
class="mt1"
|
||||||
|
}}
|
||||||
|
{{/gh-form-group}}
|
||||||
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
{{/liquid-if}}
|
{{/liquid-if}}
|
||||||
</section>
|
</section>
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
settings=settings
|
settings=settings
|
||||||
setDefaultContentVisibility=(action "setDefaultContentVisibility")
|
setDefaultContentVisibility=(action "setDefaultContentVisibility")
|
||||||
setMembersSubscriptionSettings=(action "setMembersSubscriptionSettings")
|
setMembersSubscriptionSettings=(action "setMembersSubscriptionSettings")
|
||||||
|
setBulkEmailSettings=(action "setBulkEmailSettings")
|
||||||
}}
|
}}
|
||||||
<div class="mt5 pl5 pr5 pb5">
|
<div class="mt5 pl5 pr5 pb5">
|
||||||
{{gh-task-button "Save members settings"
|
{{gh-task-button "Save members settings"
|
||||||
|
Loading…
Reference in New Issue
Block a user