Skip to content

A platform for community discussion. Free, open, simple.

DEV: add email preview digest outlet (#38067)

Keegan George2b09c9f73676
diff --git a/frontend/discourse/admin/templates/admin-email/preview-digest.gjs b/frontend/discourse/admin/templates/admin-email/preview-digest.gjs
index 29586516158..87c8c84e41b 100644
--- a/frontend/discourse/admin/templates/admin-email/preview-digest.gjs
+++ b/frontend/discourse/admin/templates/admin-email/preview-digest.gjs
@@ -4,108 +4,111 @@ import ConditionalLoadingSpinner from "discourse/components/conditional-loading-
import DButton from "discourse/components/d-button";
import DPageSubheader from "discourse/components/d-page-subheader";
import DatePickerPast from "discourse/components/date-picker-past";
+import PluginOutlet from "discourse/components/plugin-outlet";
import TextField from "discourse/components/text-field";
import EmailGroupUserChooser from "discourse/select-kit/components/email-group-user-chooser";
import { i18n } from "discourse-i18n";
export default <template>
- <DPageSubheader
- @descriptionLabel={{i18n
- "admin.config.email.sub_pages.preview_summary.header_description"
- }}
- />
+ <PluginOutlet @name="admin-email-preview-digest">
+ <DPageSubheader
+ @descriptionLabel={{i18n
+ "admin.config.email.sub_pages.preview_summary.header_description"
+ }}
+ />
- <div class="admin-controls email-preview">
- <div class="controls">
- <div class="inline-form">
- <label for="last-seen">{{i18n "admin.email.last_seen_user"}}</label>
- <DatePickerPast @value={{@controller.lastSeen}} @id="last-seen" />
- <label>{{i18n "admin.email.user"}}:</label>
- <EmailGroupUserChooser
- @value={{@controller.username}}
- @onChange={{@controller.updateUsername}}
- @options={{hash
- maximum=1
- caretDownIcon="angle-down"
- caretUpIcon="angle-up"
- }}
- />
- <DButton
- @action={{@controller.refresh}}
- @label="admin.email.refresh"
- class="btn-primary digest-refresh-button"
- />
- <div class="toggle">
- <label>{{i18n "admin.email.format"}}</label>
- {{#if @controller.showHtml}}
- <span>{{i18n "admin.email.html"}}</span>
- |
- <a
- href
- {{on "click" @controller.toggleShowHtml}}
- class="show-text-link"
- >
- {{i18n "admin.email.text"}}
- </a>
- {{else}}
- <a
- href
- {{on "click" @controller.toggleShowHtml}}
- class="show-html-link"
- >{{i18n "admin.email.html"}}</a>
- |
- <span>{{i18n "admin.email.text"}}</span>
- {{/if}}
+ <div class="admin-controls email-preview">
+ <div class="controls">
+ <div class="inline-form">
+ <label for="last-seen">{{i18n "admin.email.last_seen_user"}}</label>
+ <DatePickerPast @value={{@controller.lastSeen}} @id="last-seen" />
+ <label>{{i18n "admin.email.user"}}:</label>
+ <EmailGroupUserChooser
+ @value={{@controller.username}}
+ @onChange={{@controller.updateUsername}}
+ @options={{hash
+ maximum=1
+ caretDownIcon="angle-down"
+ caretUpIcon="angle-up"
+ }}
+ />
+ <DButton
+ @action={{@controller.refresh}}
+ @label="admin.email.refresh"
+ class="btn-primary digest-refresh-button"
+ />
+ <div class="toggle">
+ <label>{{i18n "admin.email.format"}}</label>
+ {{#if @controller.showHtml}}
+ <span>{{i18n "admin.email.html"}}</span>
+ |
+ <a
+ href
+ {{on "click" @controller.toggleShowHtml}}
+ class="show-text-link"
+ >
+ {{i18n "admin.email.text"}}
+ </a>
+ {{else}}
+ <a
+ href
+ {{on "click" @controller.toggleShowHtml}}
+ class="show-html-link"
+ >{{i18n "admin.email.html"}}</a>
+ |
+ <span>{{i18n "admin.email.text"}}</span>
+ {{/if}}
+ </div>
</div>
</div>
</div>
- </div>
- <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
- <div class="email-preview-digest">
- {{#if @controller.showSendEmailForm}}
- <div class="controls">
- <div class="inline-form">
- {{#if @controller.sendingEmail}}
- {{i18n "admin.email.sending_test"}}
- {{else}}
- <label>{{i18n "admin.email.send_digest_label"}}</label>
- <TextField
- @value={{@controller.email}}
- @placeholderKey="admin.email.test_email_address"
- />
- <DButton
- @action={{@controller.sendEmail}}
- @disabled={{@controller.sendEmailDisabled}}
- @label="admin.email.send_digest"
- class="btn-default"
- />
- {{#if @controller.sentEmail}}
- <span class="result-message">{{i18n
- "admin.email.sent_test"
- }}</span>
+ <div class="email-preview-digest">
+ {{#if @controller.showSendEmailForm}}
+ <div class="controls">
+ <div class="inline-form">
+ {{#if @controller.sendingEmail}}
+ {{i18n "admin.email.sending_test"}}
+ {{else}}
+ <label>{{i18n "admin.email.send_digest_label"}}</label>
+ <TextField
+ @value={{@controller.email}}
+ @placeholderKey="admin.email.test_email_address"
+ />
+ <DButton
+ @action={{@controller.sendEmail}}
+ @disabled={{@controller.sendEmailDisabled}}
+ @label="admin.email.send_digest"
+ class="btn-default"
+ />
+ {{#if @controller.sentEmail}}
+ <span class="result-message">{{i18n
+ "admin.email.sent_test"
+ }}</span>
+ {{/if}}
{{/if}}
- {{/if}}
+ </div>
</div>
- </div>
- {{/if}}
+ {{/if}}
- <div class="preview-output">
- {{#if @controller.showHtml}}
- {{#if @controller.htmlEmpty}}
- <p>{{i18n "admin.email.no_result"}}</p>
+ <div class="preview-output">
+ {{#if @controller.showHtml}}
+ {{#if @controller.htmlEmpty}}
+ <p>{{i18n "admin.email.no_result"}}</p>
+ {{else}}
+ <iframe
+ title={{i18n "admin.email.html_preview"}}
+ srcdoc={{@controller.model.html_content}}
+ ></iframe>
+ {{/if}}
{{else}}
- <iframe
- title={{i18n "admin.email.html_preview"}}
- srcdoc={{@controller.model.html_content}}
- ></iframe>
+ <pre>{{@controller.model.text_content}}</pre>
{{/if}}
- {{else}}
- <pre>{{@controller.model.text_content}}</pre>
- {{/if}}
+ </div>
</div>
- </div>
- </ConditionalLoadingSpinner>
+ </ConditionalLoadingSpinner>
+ </PluginOutlet>
</template>