mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:18:24 +08:00
98201ecc24
This PR is the first step towards replacing our `{{user-selector}}` and eventually deprecating and removing it from our codebase. Some of `{{user-selector}}` problems are:
1. It's called `{{user-selector}}`, but in reality in can also select groups and emails.
2. It's an Ember component, yet it doesn't have a handlebars template and uses jQuery to render itself and modify the DOM. An example of this problem is when you want to clear the selected users programmatically, see [this](6c155dba77/app/assets/javascripts/discourse/app/components/user-selector.js (L179-L185)
).
3. We now have select kit which does very similar things but a lot better.
This PR introduces `{{email-group-user-chooser}}` which is meant to replace `{{user-selector}}`. It extends select kit and has the same features that `{{user-selector}}` has. `{{user-selector}}` is still used in a few places in core, but they'll all be replaced with the new component in a separate commit.
Once `{{user-selector}}` is not used anywhere in core, it'll be deprecated and then removed after the 2.7 release.
71 lines
2.1 KiB
Handlebars
71 lines
2.1 KiB
Handlebars
<p>{{i18n "admin.email.preview_digest_desc"}}</p>
|
|
|
|
<div class="admin-controls email-preview">
|
|
<div class="controls">
|
|
<label for="last-seen">{{i18n "admin.email.last_seen_user"}}</label>
|
|
{{date-picker-past value=lastSeen id="last-seen"}}
|
|
<label>{{i18n "admin.email.user"}}:</label>
|
|
{{email-group-user-chooser
|
|
value=username
|
|
onChange=(action "updateUsername")
|
|
options=(hash
|
|
maximum=1
|
|
)
|
|
}}
|
|
{{d-button
|
|
class="btn-primary digest-refresh-button"
|
|
action=(action "refresh")
|
|
label="admin.email.refresh"}}
|
|
<div class="toggle">
|
|
<label>{{i18n "admin.email.format"}}</label>
|
|
{{#if showHtml}}
|
|
<span>{{i18n "admin.email.html"}}</span>
|
|
|
|
|
<a href {{action "toggleShowHtml"}}>
|
|
{{i18n "admin.email.text"}}
|
|
</a>
|
|
{{else}}
|
|
<a href {{action "toggleShowHtml"}}>{{i18n "admin.email.html"}}</a> |
|
|
<span>{{i18n "admin.email.text"}}</span>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{#conditional-loading-spinner condition=loading}}
|
|
|
|
<div class="email-preview-digest">
|
|
{{#if showSendEmailForm}}
|
|
<div class="controls">
|
|
{{#if sendingEmail}}
|
|
{{i18n "admin.email.sending_test"}}
|
|
{{else}}
|
|
<label>{{i18n "admin.email.send_digest_label"}}</label>
|
|
{{text-field value=email placeholderKey="admin.email.test_email_address"}}
|
|
{{d-button
|
|
class="btn-default"
|
|
action=(action "sendEmail")
|
|
disabled=sendEmailDisabled
|
|
label="admin.email.send_digest"}}
|
|
{{#if sentEmail}}
|
|
<span class="result-message">{{i18n "admin.email.sent_test"}}</span>
|
|
{{/if}}
|
|
{{/if}}
|
|
</div>
|
|
{{/if}}
|
|
|
|
<div class="preview-output">
|
|
{{#if showHtml}}
|
|
{{#if htmlEmpty}}
|
|
<p>{{i18n "admin.email.no_result"}}</p>
|
|
{{else}}
|
|
<iframe title={{i18n "admin.email.html_preview"}} srcdoc={{model.html_content}} />
|
|
{{/if}}
|
|
{{else}}
|
|
<pre>{{html-safe model.text_content}}</pre>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
|
|
{{/conditional-loading-spinner}}
|