2019-11-08 11:56:56 +03:00
|
|
|
<div class="settings-menu-header subview">
|
|
|
|
<button {{on "click" this.close}} class="back settings-menu-header-action" data-test-button="close-psm-subview">{{svg-jar "arrow-left"}}<span class="hidden">Back</span></button>
|
|
|
|
<h4>Email newsletter</h4>
|
|
|
|
<div style="width:23px;"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings-menu-content settings-menu-email">
|
2019-11-08 13:07:47 +03:00
|
|
|
{{#if post.email}}
|
|
|
|
{{!-- Mail has already been sent --}}
|
|
|
|
<p>Subject: {{this.post.email.subject}}</p>
|
|
|
|
<p>Status: {{this.post.email.status}}</p>
|
|
|
|
<p>Sent on: {{gh-format-post-time this.post.email.createdAtUTC}}</p>
|
|
|
|
<p>Sent to {{pluralize this.post.email.emailCount "member"}}</p>
|
2019-11-13 19:38:32 +03:00
|
|
|
<p><button {{on "click" this.toggleEmailPreview}}>View email</button></p>
|
2019-11-08 13:07:47 +03:00
|
|
|
{{else}}
|
|
|
|
{{!-- Mail not sent yet --}}
|
|
|
|
{{#if mailgunError}}
|
|
|
|
<p class="gh-box gh-box-warning settings-menu-mailgun-warning">
|
|
|
|
{{svg-jar "info" class="w5 h5 fill-yellow nl1"}}
|
|
|
|
You need to configure Mailgun in {{#link-to "settings.labs" data-test-nav="labs"}}Labs → Members settings{{/link-to}} to enable email newsletters.
|
|
|
|
</p>
|
|
|
|
{{/if}}
|
2019-11-08 11:56:56 +03:00
|
|
|
|
2019-11-08 13:07:47 +03:00
|
|
|
<form {{action "discardEnter" on="submit"}}>
|
|
|
|
{{#gh-form-group errors=post.errors hasValidated=post.hasValidated property="emailSubject"}}
|
|
|
|
<label for="og-title">Subject</label>
|
2019-11-08 11:56:56 +03:00
|
|
|
{{gh-text-input
|
2019-11-08 13:07:47 +03:00
|
|
|
class="post-setting-email-subject"
|
|
|
|
id="email-subject"
|
|
|
|
name="post-setting-email-subject"
|
|
|
|
placeholder=(truncate emailSubject 40)
|
|
|
|
value=(readonly emailSubjectScratch)
|
|
|
|
input=(action (mut emailSubjectScratch) value="target.value")
|
|
|
|
focus-out=(action "setEmailSubject" emailSubjectScratch)
|
2019-11-08 11:56:56 +03:00
|
|
|
stopEnterKeyDownPropagation=true
|
2019-11-13 14:17:36 +03:00
|
|
|
disabled=mailgunError
|
2019-11-08 13:07:47 +03:00
|
|
|
data-test-field="email-subject"}}
|
|
|
|
{{gh-error-message errors=post.errors property="emailSubject" data-test-error="email-subject"}}
|
|
|
|
{{/gh-form-group}}
|
2019-11-08 11:56:56 +03:00
|
|
|
|
2019-11-08 13:07:47 +03:00
|
|
|
<div class="form-group">
|
|
|
|
<div class="flex">
|
|
|
|
<label class="nowrap flex-auto">Test email</label>
|
2019-11-13 19:38:32 +03:00
|
|
|
<button type="button" class="gh-btn gh-btn-link settings-menu-email-button" {{on "click" this.toggleEmailPreview}} data-test-button="toggle-email-preview">
|
2019-11-08 13:07:47 +03:00
|
|
|
<span class="blue">
|
|
|
|
Preview in browser
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
2019-11-08 11:56:56 +03:00
|
|
|
|
2019-11-08 13:07:47 +03:00
|
|
|
<div class="{{if mailgunError "disabled"}}">
|
|
|
|
{{gh-text-input
|
|
|
|
class="post-setting-email-test"
|
|
|
|
id="email-test"
|
|
|
|
name="post-setting-email-test"
|
2019-11-13 13:52:09 +03:00
|
|
|
placeholder="noreply@example.com"
|
|
|
|
value=testEmailAddress
|
2019-11-08 13:07:47 +03:00
|
|
|
stopEnterKeyDownPropagation=true
|
|
|
|
disabled=mailgunError
|
|
|
|
data-test-field="email-test"}}
|
|
|
|
|
|
|
|
{{#if sendTestEmailError}}
|
|
|
|
<div class="error"><p class="response">{{sendTestEmailError}}</p></div>
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{gh-task-button "Send test email"
|
|
|
|
task=sendTestEmail
|
|
|
|
successText="Email sent"
|
|
|
|
runningText="Sending..."
|
|
|
|
class="gh-btn w-100 mt2 gh-btn-icon"
|
|
|
|
disabled=mailgunError
|
|
|
|
data-test-send-test-mail=true
|
|
|
|
}}
|
|
|
|
</div>
|
2019-11-08 11:56:56 +03:00
|
|
|
</div>
|
2019-11-08 13:07:47 +03:00
|
|
|
</form>
|
|
|
|
{{/if}}
|
2019-11-08 11:56:56 +03:00
|
|
|
</div>
|