diff --git a/app/assets/javascripts/admin/controllers/admin-email-incomings.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-incomings.js.es6 index deb7f0771c6..a6acd9af78f 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-incomings.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-incomings.js.es6 @@ -1,11 +1,21 @@ import IncomingEmail from 'admin/models/incoming-email'; export default Ember.Controller.extend({ - loadMore() { - return IncomingEmail.findAll(this.get("filter"), this.get("model.length")) - .then(incoming => { - if (incoming.length < 50) { this.get("model").set("allLoaded", true); } - this.get("model").addObjects(incoming); - }); + loading: false, + + actions: { + + loadMore() { + if (this.get("loading") || this.get("model.allLoaded")) { return; } + this.set('loading', true); + + IncomingEmail.findAll(this.get("filter"), this.get("model.length")) + .then(incoming => { + if (incoming.length < 50) { this.get("model").set("allLoaded", true); } + this.get("model").addObjects(incoming); + }).finally(() => { + this.set('loading', false); + }); + } } }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 index 2506a0cd999..44a38dfa324 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 @@ -1,11 +1,20 @@ import EmailLog from 'admin/models/email-log'; export default Ember.Controller.extend({ - loadMore() { - return EmailLog.findAll(this.get("filter"), this.get("model.length")) - .then(logs => { - if (logs.length < 50) { this.get("model").set("allLoaded", true); } - this.get("model").addObjects(logs); - }); + loading: false, + + actions: { + loadMore() { + if (this.get("loading") || this.get("model.allLoaded")) { return; } + + this.set('loading', true); + return EmailLog.findAll(this.get("filter"), this.get("model.length")) + .then(logs => { + if (logs.length < 50) { this.get("model").set("allLoaded", true); } + this.get("model").addObjects(logs); + }).finally(() => { + this.set('loading', false); + }); + } } }); diff --git a/app/assets/javascripts/admin/templates/email-received.hbs b/app/assets/javascripts/admin/templates/email-received.hbs index 95e0cb2dc57..e6e3bcbec96 100644 --- a/app/assets/javascripts/admin/templates/email-received.hbs +++ b/app/assets/javascripts/admin/templates/email-received.hbs @@ -1,55 +1,57 @@ -
{{i18n 'admin.email.time'}} | -{{i18n 'admin.email.incoming_emails.from_address'}} | -{{i18n 'admin.email.incoming_emails.to_addresses'}} | -{{i18n 'admin.email.incoming_emails.subject'}} | +{{#load-more selector=".email-list tr" action="loadMore"}} +
---|
{{i18n 'admin.email.time'}} | +{{i18n 'admin.email.incoming_emails.from_address'}} | +{{i18n 'admin.email.incoming_emails.to_addresses'}} | +{{i18n 'admin.email.incoming_emails.subject'}} | +||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
{{i18n 'admin.email.logs.filters.title'}} | +{{text-field value=filter.from placeholderKey="admin.email.incoming_emails.filters.from_placeholder"}} | +{{text-field value=filter.to placeholderKey="admin.email.incoming_emails.filters.to_placeholder"}} | +{{text-field value=filter.subject placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"}} | ||||||||
{{i18n 'admin.email.logs.filters.title'}} | -{{text-field value=filter.from placeholderKey="admin.email.incoming_emails.filters.from_placeholder"}} | -{{text-field value=filter.to placeholderKey="admin.email.incoming_emails.filters.to_placeholder"}} | -{{text-field value=filter.subject placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"}} | -||||||||
{{format-date email.created_at}} | -
-
- {{#if email.user}}
- {{#link-to 'adminUser' email.user}}
- {{avatar email.user imageSize="tiny"}}
- {{email.from_address}}
- {{/link-to}}
+ {{#each email in model}}
+ {{format-date email.created_at}} |
+
+ |
+
+ {{#if email.user}}
+ {{#link-to 'adminUser' email.user}}
+ {{avatar email.user imageSize="tiny"}}
+ {{email.from_address}}
+ {{/link-to}}
+ {{else}}
+ —
+ {{/if}}
+
+
+ {{#each to in email.to_addresses}}
+
+ {{/each}}
+ {{#each cc in email.cc_addresses}}
+
+ {{/each}}
+ |
+
+ {{#if email.post_url}}
+ {{email.subject}}
{{else}}
- —
+ {{email.subject}}
{{/if}}
-
- |
-
- {{#each to in email.to_addresses}}
-
- {{/each}}
- {{#each cc in email.cc_addresses}}
-
- {{/each}}
- |
-
- {{#if email.post_url}}
- {{email.subject}}
- {{else}}
- {{email.subject}}
- {{/if}}
- |
- {{i18n 'admin.email.incoming_emails.none'}} | |
+ |||
{{i18n 'admin.email.incoming_emails.none'}} |
{{i18n 'admin.email.time'}} | -{{i18n 'admin.email.incoming_emails.from_address'}} | -{{i18n 'admin.email.incoming_emails.to_addresses'}} | -{{i18n 'admin.email.incoming_emails.subject'}} | -{{i18n 'admin.email.incoming_emails.error'}} | +{{#load-more selector=".email-list tr" action="loadMore"}} +
---|
{{i18n 'admin.email.time'}} | +{{i18n 'admin.email.incoming_emails.from_address'}} | +{{i18n 'admin.email.incoming_emails.to_addresses'}} | +{{i18n 'admin.email.incoming_emails.subject'}} | +{{i18n 'admin.email.incoming_emails.error'}} | +
---|---|---|---|---|
{{i18n 'admin.email.logs.filters.title'}} | +{{text-field value=filter.from placeholderKey="admin.email.incoming_emails.filters.from_placeholder"}} | +{{text-field value=filter.to placeholderKey="admin.email.incoming_emails.filters.to_placeholder"}} | +{{text-field value=filter.subject placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"}} | +{{text-field value=filter.error placeholderKey="admin.email.incoming_emails.filters.error_placeholder"}} |
{{i18n 'admin.email.logs.filters.title'}} | -{{text-field value=filter.from placeholderKey="admin.email.incoming_emails.filters.from_placeholder"}} | -{{text-field value=filter.to placeholderKey="admin.email.incoming_emails.filters.to_placeholder"}} | -{{text-field value=filter.subject placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"}} | -{{text-field value=filter.error placeholderKey="admin.email.incoming_emails.filters.error_placeholder"}} | -
{{format-date email.created_at}} | +
+
+ {{#if email.user}}
+ {{#link-to 'adminUser' email.user}}
+ {{avatar email.user imageSize="tiny"}}
+ {{email.from_address}}
+ {{/link-to}}
+ {{else}}
+ —
+ {{/if}}
+
+ |
+ + {{#each to in email.to_addresses}} + + {{/each}} + {{#each cc in email.cc_addresses}} + + {{/each}} + | +{{email.subject}} | ++ {{email.error}} + | +
{{i18n 'admin.email.incoming_emails.none'}} | ||||
{{format-date email.created_at}} | -
-
- {{#if email.user}}
- {{#link-to 'adminUser' email.user}}
- {{avatar email.user imageSize="tiny"}}
- {{email.from_address}}
- {{/link-to}}
- {{else}}
- —
- {{/if}}
-
- |
- - {{#each to in email.to_addresses}} - - {{/each}} - {{#each cc in email.cc_addresses}} - - {{/each}} - | -{{email.subject}} | -- {{email.error}} - | -
{{i18n 'admin.email.incoming_emails.none'}} |
{{i18n 'admin.email.sent_at'}} | -{{i18n 'admin.email.user'}} | -{{i18n 'admin.email.to_address'}} | -{{i18n 'admin.email.email_type'}} | -{{i18n 'admin.email.reply_key'}} | +{{#load-more selector=".email-list tr" action="loadMore"}} +
---|
{{i18n 'admin.email.sent_at'}} | +{{i18n 'admin.email.user'}} | +{{i18n 'admin.email.to_address'}} | +{{i18n 'admin.email.email_type'}} | +{{i18n 'admin.email.reply_key'}} | +
---|---|---|---|---|
{{i18n 'admin.email.logs.filters.title'}} | +{{text-field value=filter.user placeholderKey="admin.email.logs.filters.user_placeholder"}} | +{{text-field value=filter.address placeholderKey="admin.email.logs.filters.address_placeholder"}} | +{{text-field value=filter.type placeholderKey="admin.email.logs.filters.type_placeholder"}} | +{{text-field value=filter.reply_key placeholderKey="admin.email.logs.filters.reply_key_placeholder"}} |
{{i18n 'admin.email.logs.filters.title'}} | -{{text-field value=filter.user placeholderKey="admin.email.logs.filters.user_placeholder"}} | -{{text-field value=filter.address placeholderKey="admin.email.logs.filters.address_placeholder"}} | -{{text-field value=filter.type placeholderKey="admin.email.logs.filters.type_placeholder"}} | -{{text-field value=filter.reply_key placeholderKey="admin.email.logs.filters.reply_key_placeholder"}} | -
{{format-date l.created_at}} | ++ {{#if l.user}} + {{#link-to 'adminUser' l.user}}{{avatar l.user imageSize="tiny"}}{{/link-to}} + {{#link-to 'adminUser' l.user}}{{l.user.username}}{{/link-to}} + {{else}} + — + {{/if}} + | +{{l.to_address}} | +{{l.email_type}} | ++ {{#if l.post_url}} + {{l.reply_key}} + {{else}} + {{l.reply_key}} + {{/if}} + | +
{{i18n 'admin.email.logs.none'}} | ||||
{{format-date l.created_at}} | -- {{#if l.user}} - {{#link-to 'adminUser' l.user}}{{avatar l.user imageSize="tiny"}}{{/link-to}} - {{#link-to 'adminUser' l.user}}{{l.user.username}}{{/link-to}} - {{else}} - — - {{/if}} - | -{{l.to_address}} | -{{l.email_type}} | -- {{#if l.post_url}} - {{l.reply_key}} - {{else}} - {{l.reply_key}} - {{/if}} - | -
{{i18n 'admin.email.logs.none'}} |
{{i18n 'admin.email.time'}} | -{{i18n 'admin.email.user'}} | -{{i18n 'admin.email.to_address'}} | -{{i18n 'admin.email.email_type'}} | -{{i18n 'admin.email.skipped_reason'}} | +{{#load-more selector=".email-list tr" action="loadMore"}} +
---|
{{i18n 'admin.email.time'}} | +{{i18n 'admin.email.user'}} | +{{i18n 'admin.email.to_address'}} | +{{i18n 'admin.email.email_type'}} | +{{i18n 'admin.email.skipped_reason'}} | +
---|---|---|---|---|
{{i18n 'admin.email.logs.filters.title'}} | +{{text-field value=filter.user placeholderKey="admin.email.logs.filters.user_placeholder"}} | +{{text-field value=filter.address placeholderKey="admin.email.logs.filters.address_placeholder"}} | +{{text-field value=filter.type placeholderKey="admin.email.logs.filters.type_placeholder"}} | +{{text-field value=filter.skipped_reason placeholderKey="admin.email.logs.filters.skipped_reason_placeholder"}} |
{{i18n 'admin.email.logs.filters.title'}} | -{{text-field value=filter.user placeholderKey="admin.email.logs.filters.user_placeholder"}} | -{{text-field value=filter.address placeholderKey="admin.email.logs.filters.address_placeholder"}} | -{{text-field value=filter.type placeholderKey="admin.email.logs.filters.type_placeholder"}} | -{{text-field value=filter.skipped_reason placeholderKey="admin.email.logs.filters.skipped_reason_placeholder"}} | -
{{format-date l.created_at}} | ++ {{#if l.user}} + {{#link-to 'adminUser' l.user}}{{avatar l.user imageSize="tiny"}}{{/link-to}} + {{#link-to 'adminUser' l.user}}{{l.user.username}}{{/link-to}} + {{else}} + — + {{/if}} + | +{{l.to_address}} | +{{l.email_type}} | ++ {{#if l.post_url}} + {{l.skipped_reason}} + {{else}} + {{l.skipped_reason}} + {{/if}} + | +
{{i18n 'admin.email.logs.none'}} | ||||
{{format-date l.created_at}} | -- {{#if l.user}} - {{#link-to 'adminUser' l.user}}{{avatar l.user imageSize="tiny"}}{{/link-to}} - {{#link-to 'adminUser' l.user}}{{l.user.username}}{{/link-to}} - {{else}} - — - {{/if}} - | -{{l.to_address}} | -{{l.email_type}} | -- {{#if l.post_url}} - {{l.skipped_reason}} - {{else}} - {{l.skipped_reason}} - {{/if}} - | -
{{i18n 'admin.email.logs.none'}} |