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-25 16:20:16 +03:00
|
|
|
{{#if this.post.email.isSuccess}}
|
2019-11-08 13:07:47 +03:00
|
|
|
{{!-- Mail has already been sent --}}
|
2019-11-14 16:30:49 +03:00
|
|
|
<div class="ba b--whitegrey bg-white br3">
|
|
|
|
<div class="flex pa5 pt4 pb4 items-center bb b--whitegrey">
|
|
|
|
<div class="w16 flex flex-column items-center">
|
|
|
|
<span class="db mr4 mt3">{{svg-jar "send-email" class="w7 h7 stroke-darkgrey"}}</span>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-column justify-center">
|
|
|
|
<p class="ma0 pa0 midgrey">Post was sent by email to</p>
|
|
|
|
<p class="ma0 pa0 f5 lh-solid">{{pluralize this.post.email.emailCount "member"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="pa5 pt3 pb3 f7 bb b--whitegrey">
|
|
|
|
<table class="ma0" style="table-layout: fixed">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2019-11-25 19:03:54 +03:00
|
|
|
<td class="pa1 pl0 fw7 f8 w16 v-top lh-copy">Subject:</td>
|
|
|
|
<td class="pa1 pa0 word-wrap midgrey v-top lh-copy">{{this.post.email.subject}}</td>
|
2019-11-14 16:30:49 +03:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2019-11-25 19:44:50 +03:00
|
|
|
<td class="pa1 pl0 fw7 f8 w16 nowrap v-top lh-copy">Sent:</td>
|
2019-11-25 19:03:54 +03:00
|
|
|
<td class="pa1 pa0 word-wrap midgrey v-top lh-copy">{{gh-format-post-time this.post.email.createdAtUTC}}</td>
|
2019-11-14 16:30:49 +03:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div class="pa5 pt3 pb3">
|
|
|
|
<p class="ma0 pa0"><button {{on "click" this.toggleEmailPreview}} class="blue">View sent email</button></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-11-25 16:20:16 +03:00
|
|
|
{{else if (or this.retryEmail.isRunning this.post.email.isFailure)}}
|
|
|
|
{{!-- Mail failed to send --}}
|
|
|
|
|
2019-11-25 19:03:54 +03:00
|
|
|
<div class="ba b--whitegrey bg-white br3 gh-box-error-border">
|
2019-11-25 16:20:16 +03:00
|
|
|
<div class="flex pa5 pt4 pb4 items-center bb b--whitegrey">
|
|
|
|
<div class="w16 flex flex-column items-center">
|
2019-11-25 19:03:54 +03:00
|
|
|
<span class="db mr4 mt3">{{svg-jar "warning" class="w7 h7 fill-red"}}</span>
|
2019-11-25 16:20:16 +03:00
|
|
|
</div>
|
|
|
|
<div class="flex flex-column justify-center">
|
|
|
|
<p class="ma0 pa0 midgrey">Post failed to send to</p>
|
|
|
|
<p class="ma0 pa0 f5 lh-solid">{{pluralize this.post.email.emailCount "member"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-11-25 19:03:54 +03:00
|
|
|
<div class="pa5 pt3 pb3 f7 bb b--whitegrey">
|
|
|
|
<p class="mb2 lh-copy">
|
2019-11-26 15:38:43 +03:00
|
|
|
{{#if this.session.user.isOwner}}
|
|
|
|
Email failed to send when publishing this post. Please <LinkTo @route="settings.labs">check your Mailgun configuration</LinkTo> if the error persists.
|
|
|
|
{{else}}
|
|
|
|
Email failed to send when publishing this post. Please check your Mailgun configuration if the error persists.
|
|
|
|
{{/if}}
|
2019-11-25 19:03:54 +03:00
|
|
|
</p>
|
|
|
|
<p class="ma0 pa0">
|
|
|
|
<table class="ma0" style="table-layout: fixed">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="pa1 pl0 fw7 f8 w16 v-top lh-copy">Error:</td>
|
|
|
|
<td class="pa1 pl0 word-wrap midgrey v-top lh-copy">{{this.post.email.error}}</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
|
|
</div>
|
2019-11-25 16:20:16 +03:00
|
|
|
<div class="pa5 pt3 pb3 f7 bb b--whitegrey">
|
|
|
|
<table class="ma0" style="table-layout: fixed">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2019-11-25 19:03:54 +03:00
|
|
|
<td class="pa1 pl0 fw7 f8 w16 v-top lh-copy">Subject:</td>
|
|
|
|
<td class="pa1 pl0 truncate midgrey v-top lh-copy">{{this.post.email.subject}}</td>
|
2019-11-25 16:20:16 +03:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2019-11-25 19:03:54 +03:00
|
|
|
<td class="pa1 pl0 fw7 f8 w16 nowrap v-top lh-copy">Tried:</td>
|
|
|
|
<td class="pa1 pl0 truncate midgrey v-top lh-copy">{{gh-format-post-time this.post.email.createdAtUTC}}</td>
|
2019-11-25 16:20:16 +03:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2019-11-25 19:03:54 +03:00
|
|
|
<div class="pa5 pt3 pb3 flex justify-between items center">
|
|
|
|
<button {{on "click" this.toggleEmailPreview}} class="blue">View email</button>
|
|
|
|
<GhTaskButton @buttonText="Retry send" @runningText="Sending..." @task={{this.retryEmail}}
|
|
|
|
@class="gh-btn gh-btn-icon" data-test-button="retry-email" />
|
2019-11-25 16:20:16 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-11-08 13:07:47 +03:00
|
|
|
{{else}}
|
|
|
|
{{!-- Mail not sent yet --}}
|
2019-11-25 16:20:16 +03:00
|
|
|
{{#if this.mailgunError}}
|
2019-11-08 13:07:47 +03:00
|
|
|
<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"}}>
|
2019-11-25 16:20:16 +03:00
|
|
|
{{#gh-form-group errors=this.post.errors hasValidated=this.post.hasValidated property="emailSubject"}}
|
2019-11-08 13:07:47 +03:00
|
|
|
<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"
|
2019-11-25 16:20:16 +03:00
|
|
|
placeholder=(truncate this.emailSubject 40)
|
|
|
|
value=(readonly this.emailSubjectScratch)
|
|
|
|
input=(action (mut this.emailSubjectScratch) value="target.value")
|
|
|
|
focus-out=(action "setEmailSubject" this.emailSubjectScratch)
|
2019-11-08 11:56:56 +03:00
|
|
|
stopEnterKeyDownPropagation=true
|
2019-11-25 16:20:16 +03:00
|
|
|
disabled=this.mailgunError
|
2019-11-08 13:07:47 +03:00
|
|
|
data-test-field="email-subject"}}
|
2019-11-25 16:20:16 +03:00
|
|
|
{{gh-error-message errors=this.post.errors property="emailSubject" data-test-error="email-subject"}}
|
2019-11-08 13:07:47 +03:00
|
|
|
{{/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"
|
2019-11-25 16:20:16 +03:00
|
|
|
value=this.testEmailAddress
|
2019-11-08 13:07:47 +03:00
|
|
|
stopEnterKeyDownPropagation=true
|
2019-11-25 16:20:16 +03:00
|
|
|
disabled=this.mailgunError
|
2019-11-08 13:07:47 +03:00
|
|
|
data-test-field="email-test"}}
|
|
|
|
|
2019-11-25 16:20:16 +03:00
|
|
|
{{#if this.sendTestEmailError}}
|
|
|
|
<div class="error"><p class="response">{{this.sendTestEmailError}}</p></div>
|
2019-11-08 13:07:47 +03:00
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{gh-task-button "Send test email"
|
2019-11-25 16:20:16 +03:00
|
|
|
task=this.sendTestEmail
|
2019-11-08 13:07:47 +03:00
|
|
|
successText="Email sent"
|
|
|
|
runningText="Sending..."
|
|
|
|
class="gh-btn w-100 mt2 gh-btn-icon"
|
2019-11-25 16:20:16 +03:00
|
|
|
disabled=this.mailgunError
|
2019-11-08 13:07:47 +03:00
|
|
|
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>
|