FEATURE: new Dismiss posts/topics modal

This commit is contained in:
Arpit Jalan 2015-10-20 14:39:25 +05:30
parent 5d341bef57
commit 4a880a758f
7 changed files with 26 additions and 10 deletions

View File

@ -2,6 +2,7 @@ import DiscoveryController from 'discourse/controllers/discovery';
import { queryParams } from 'discourse/controllers/discovery-sortable';
import BulkTopicSelection from 'discourse/mixins/bulk-topic-selection';
import { endWith } from 'discourse/lib/computed';
import showModal from 'discourse/lib/show-modal';
const controllerOpts = {
needs: ['discovery'],
@ -66,10 +67,13 @@ const controllerOpts = {
});
},
resetNew() {
this.topicTrackingState.resetNew();
Discourse.Topic.resetNew().then(() => this.send('refresh'));
},
dismissReadPosts() {
showModal('dismiss-read', { title: 'topics.bulk.dismiss' });
}
},

View File

@ -42,6 +42,7 @@ export default Ember.Mixin.create({
});
tracker.incrementMessageCount();
}
self.send('closeModal');
self.send('refresh');
});
}

View File

@ -46,6 +46,10 @@ const DiscoveryRoute = Discourse.Route.extend(OpenComposer, {
createTopic() {
this.openComposer(this.controllerFor("discovery/topics"));
},
dismissRead(operationType) {
this.controllerFor("discovery/topics").send('dismissRead', operationType);
}
}

View File

@ -5,8 +5,7 @@
{{#if showDismissAtTop}}
<div class="row">
{{#if showDismissRead}}
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics-top' class='btn dismiss-read' {{action "dismissRead" "topics"}}>{{i18n 'topics.bulk.dismiss_topics'}}</button>
<button title="{{i18n 'topics.bulk.dismiss_posts_tooltip'}}" id='dismiss-posts-top' class='btn dismiss-read' {{action "dismissRead" "posts"}}>{{i18n 'topics.bulk.dismiss_posts'}}</button>
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics-top' class='btn dismiss-read' {{action "dismissReadPosts"}}>{{i18n 'topics.bulk.dismiss'}}</button>
{{/if}}
{{#if showResetNew}}
<button id='dismiss-new-top' class='btn dismiss-read' {{action "resetNew"}}>{{i18n 'topics.bulk.dismiss_new'}}</button>
@ -55,8 +54,7 @@
{{conditional-loading-spinner condition=model.loadingMore}}
{{#if allLoaded}}
{{#if showDismissRead}}
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics' class='btn dismiss-read' {{action "dismissRead" "topics"}}>{{i18n 'topics.bulk.dismiss_topics'}}</button>
<button title="{{i18n 'topics.bulk.dismiss_posts_tooltip'}}" id='dismiss-posts' class='btn dismiss-read' {{action "dismissRead" "posts"}}>{{i18n 'topics.bulk.dismiss_posts'}}</button>
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics' class='btn dismiss-read' {{action "dismissReadPosts"}}>{{i18n 'topics.bulk.dismiss'}}</button>
{{/if}}
{{#if showResetNew}}
<button id='dismiss-new' class='btn dismiss-read' {{action "resetNew"}}>{{i18n 'topics.bulk.dismiss_new'}}</button>

View File

@ -25,8 +25,7 @@
{{conditional-loading-spinner condition=model.loadingMore}}
{{#if allLoaded}}
{{#if showDismissRead}}
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics' class='btn dismiss-read' {{action "dismissRead" "topics"}}>{{i18n 'topics.bulk.dismiss_topics'}}</button>
<button title="{{i18n 'topics.bulk.dismiss_posts_tooltip'}}" id='dismiss-posts' class='btn dismiss-read' {{action "dismissRead" "posts"}}>{{i18n 'topics.bulk.dismiss_posts'}}</button>
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics' class='btn dismiss-read' {{action "dismissReadPosts"}}>{{i18n 'topics.bulk.dismiss'}}</button>
{{/if}}
{{#if showResetNew}}
<button id='dismiss-new' class='btn dismiss-read' {{action "resetNew"}}>{{i18n 'topics.bulk.dismiss_new'}}</button>

View File

@ -0,0 +1,10 @@
<div class="modal-body">
<p>
{{i18n 'topics.bulk.dismiss_body'}}
</p>
</div>
<div class="modal-footer">
<button class='btn btn-primary' {{action "dismissRead" "posts"}}>{{i18n 'topics.bulk.dismiss_posts'}}</button>
<button class='btn btn-primary' {{action "dismissRead" "topics"}}>{{i18n 'topics.bulk.dismiss_topics'}}</button>
</div>

View File

@ -1010,10 +1010,10 @@ en:
bulk:
reset_read: "Reset Read"
delete: "Delete Topics"
dismiss_posts: "Dismiss Posts"
dismiss_posts_tooltip: "Clear unread counts on these topics but continue to show them on my unread list when new posts are made"
dismiss: "Dismiss"
dismiss_body: "Would you like to dismiss just the new posts in these topics, or dismiss the topics entirely?"
dismiss_posts: "Dismiss Just New Posts"
dismiss_topics: "Dismiss Topics"
dismiss_topics_tooltip: "Stop showing these topics in my unread list when new posts are made"
dismiss_new: "Dismiss New"
toggle: "toggle bulk selection of topics"
actions: "Bulk Actions"