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}}
|
2020-06-30 09:27:18 +03:00
|
|
|
Email failed to send when publishing this post. Please verify your email settings if the error persists.
|
2019-11-26 15:38:43 +03:00
|
|
|
{{else}}
|
2020-06-30 09:27:18 +03:00
|
|
|
Email failed to send when publishing this post. Please verify your email settings if the error persists.
|
2019-11-26 15:38:43 +03:00
|
|
|
{{/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>
|
2019-12-13 17:20:29 +03:00
|
|
|
<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"}}
|
2020-01-16 18:14:03 +03:00
|
|
|
You need to configure Mailgun in <LinkTo @route="settings.labs" data-test-nav="labs">Labs → Members settings</LinkTo> to enable email newsletters.
|
2019-11-08 13:07:47 +03:00
|
|
|
</p>
|
|
|
|
{{/if}}
|
2019-11-08 11:56:56 +03:00
|
|
|
|
2019-11-08 13:07:47 +03:00
|
|
|
<form {{action "discardEnter" on="submit"}}>
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="emailSubject">
|
2019-11-08 13:07:47 +03:00
|
|
|
<label for="og-title">Subject</label>
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhTextInput
|
|
|
|
@class="post-setting-email-subject"
|
|
|
|
@id="email-subject"
|
|
|
|
@name="post-setting-email-subject"
|
|
|
|
@placeholder={{truncate this.emailSubject 40}}
|
|
|
|
@value={{readonly this.emailSubjectScratch}}
|
|
|
|
@input={{action (mut this.emailSubjectScratch) value="target.value"}}
|
|
|
|
@focus-out={{action "setEmailSubject" this.emailSubjectScratch}}
|
|
|
|
@stopEnterKeyDownPropagation={{true}}
|
|
|
|
@disabled={{this.mailgunError}}
|
|
|
|
data-test-field="email-subject" />
|
2019-12-13 19:11:49 +03:00
|
|
|
<GhErrorMessage @errors={{this.post.errors}} @property="emailSubject" data-test-error="email-subject" />
|
2020-01-16 18:14:03 +03:00
|
|
|
</GhFormGroup>
|
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-12-13 17:20:29 +03:00
|
|
|
<div class="{{if this.mailgunError "disabled"}}">
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhTextInput
|
|
|
|
@class="post-setting-email-test"
|
|
|
|
@id="email-test"
|
|
|
|
@name="post-setting-email-test"
|
|
|
|
@placeholder="noreply@example.com"
|
|
|
|
@value={{this.testEmailAddress}}
|
|
|
|
@stopEnterKeyDownPropagation={{true}}
|
|
|
|
@disabled={{this.mailgunError}}
|
|
|
|
data-test-field="email-test" />
|
2019-11-08 13:07:47 +03:00
|
|
|
|
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}}
|
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhTaskButton @buttonText="Send test email"
|
|
|
|
@task={{this.sendTestEmail}}
|
|
|
|
@successText="Email sent"
|
|
|
|
@runningText="Sending..."
|
|
|
|
@class="gh-btn w-100 mt2 gh-btn-icon"
|
|
|
|
@disabled={{this.mailgunError}}
|
|
|
|
data-test-send-test-mail="true"
|
|
|
|
/>
|
2019-11-08 13:07:47 +03:00
|
|
|
</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>
|