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.allowSelfSignup = !!subscriptionSettings.allowSelfSignup;
|
||||
subscriptionSettings.fromAddress = subscriptionSettings.fromAddress || '';
|
||||
if (Object.keys(subscriptionSettings).includes('mailgunApiKey')) {
|
||||
subscriptionSettings.mailgunApiKey = subscriptionSettings.mailgunApiKey || '';
|
||||
subscriptionSettings.mailgunDomain = subscriptionSettings.mailgunDomain || '';
|
||||
}
|
||||
|
||||
return subscriptionSettings;
|
||||
}),
|
||||
|
||||
hasMailgunAPIKeyOption: computed('settings.membersSubscriptionSettings', function () {
|
||||
let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings'));
|
||||
return Object.keys(subscriptionSettings).includes('mailgunApiKey');
|
||||
bulkEmailSettings: computed('settings.bulkEmailSettings', function () {
|
||||
let bulkEmailSettings = this.get('settings.bulkEmailSettings') || {};
|
||||
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 () {
|
||||
@ -50,6 +52,11 @@ export default Component.extend({
|
||||
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) {
|
||||
let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings'));
|
||||
let stripeProcessor = subscriptionSettings.paymentProcessors.find((proc) => {
|
||||
@ -80,12 +87,6 @@ export default Component.extend({
|
||||
if (key === 'fromAddress') {
|
||||
subscriptionSettings.fromAddress = event.target.value;
|
||||
}
|
||||
if (key === 'mailgunApiKey') {
|
||||
subscriptionSettings.mailgunApiKey = event.target.value;
|
||||
}
|
||||
if (key === 'mailgunDomain') {
|
||||
subscriptionSettings.mailgunDomain = event.target.value;
|
||||
}
|
||||
this.setMembersSubscriptionSettings(subscriptionSettings);
|
||||
}
|
||||
},
|
||||
|
@ -163,6 +163,10 @@ export default Controller.extend({
|
||||
|
||||
setMembersSubscriptionSettings(subscriptionSettings) {
|
||||
this.set('settings.membersSubscriptionSettings', JSON.stringify(subscriptionSettings));
|
||||
},
|
||||
|
||||
setBulkEmailSettings(bulkEmailSettings) {
|
||||
this.set('settings.bulkEmailSettings', bulkEmailSettings);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -185,12 +185,12 @@
|
||||
</div>
|
||||
<div class="f8 fw4 midgrey mt1">Your members will receive system emails from this address</div>
|
||||
{{/gh-form-group}}
|
||||
{{#if hasMailgunAPIKeyOption}}
|
||||
{{#unless hasBulkEmailConfig}}
|
||||
{{#gh-form-group}}
|
||||
<label class="fw6 f8">Mailgun domain</label>
|
||||
{{gh-text-input
|
||||
value=(readonly subscriptionSettings.mailgunDomain)
|
||||
input=(action "setSubscriptionSettings" "mailgunDomain")
|
||||
value=(readonly bulkEmailSettings.domain)
|
||||
input=(action "setBulkEmailSettings" "domain")
|
||||
class="mt1"
|
||||
}}
|
||||
<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>
|
||||
{{gh-text-input
|
||||
type="password"
|
||||
value=(readonly subscriptionSettings.mailgunApiKey)
|
||||
input=(action "setSubscriptionSettings" "mailgunApiKey")
|
||||
value=(readonly bulkEmailSettings.apiKey)
|
||||
input=(action "setBulkEmailSettings" "apiKey")
|
||||
class="mt1 password"
|
||||
autocomplete="new-password"
|
||||
}}
|
||||
@ -210,7 +210,16 @@
|
||||
Find your Mailgun API keys here »
|
||||
</a>
|
||||
{{/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>
|
||||
{{/liquid-if}}
|
||||
</section>
|
||||
|
@ -27,6 +27,7 @@
|
||||
settings=settings
|
||||
setDefaultContentVisibility=(action "setDefaultContentVisibility")
|
||||
setMembersSubscriptionSettings=(action "setMembersSubscriptionSettings")
|
||||
setBulkEmailSettings=(action "setBulkEmailSettings")
|
||||
}}
|
||||
<div class="mt5 pl5 pr5 pb5">
|
||||
{{gh-task-button "Save members settings"
|
||||
|
Loading…
Reference in New Issue
Block a user