From 4a880a758f33c32da0e59d005de7543d470adafa Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Tue, 20 Oct 2015 14:39:25 +0530 Subject: [PATCH] FEATURE: new Dismiss posts/topics modal --- .../discourse/controllers/discovery/topics.js.es6 | 6 +++++- .../discourse/mixins/bulk-topic-selection.js.es6 | 1 + .../javascripts/discourse/routes/discovery.js.es6 | 4 ++++ .../discourse/templates/discovery/topics.hbs | 6 ++---- .../discourse/templates/mobile/discovery/topics.hbs | 3 +-- .../discourse/templates/modal/dismiss-read.hbs | 10 ++++++++++ config/locales/client.en.yml | 6 +++--- 7 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 app/assets/javascripts/discourse/templates/modal/dismiss-read.hbs diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index 0a2b0462378..775aa1690bf 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -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' }); } }, diff --git a/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 b/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 index c0e7650d8b6..705f281a353 100644 --- a/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 +++ b/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 @@ -42,6 +42,7 @@ export default Ember.Mixin.create({ }); tracker.incrementMessageCount(); } + self.send('closeModal'); self.send('refresh'); }); } diff --git a/app/assets/javascripts/discourse/routes/discovery.js.es6 b/app/assets/javascripts/discourse/routes/discovery.js.es6 index 83b5b4186b4..12b3e1f180c 100644 --- a/app/assets/javascripts/discourse/routes/discovery.js.es6 +++ b/app/assets/javascripts/discourse/routes/discovery.js.es6 @@ -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); } } diff --git a/app/assets/javascripts/discourse/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/templates/discovery/topics.hbs index b57679afc79..8af62789372 100644 --- a/app/assets/javascripts/discourse/templates/discovery/topics.hbs +++ b/app/assets/javascripts/discourse/templates/discovery/topics.hbs @@ -5,8 +5,7 @@ {{#if showDismissAtTop}}
{{#if showDismissRead}} - - + {{/if}} {{#if showResetNew}} @@ -55,8 +54,7 @@ {{conditional-loading-spinner condition=model.loadingMore}} {{#if allLoaded}} {{#if showDismissRead}} - - + {{/if}} {{#if showResetNew}} diff --git a/app/assets/javascripts/discourse/templates/mobile/discovery/topics.hbs b/app/assets/javascripts/discourse/templates/mobile/discovery/topics.hbs index ae964b46e39..a58ce372e7f 100644 --- a/app/assets/javascripts/discourse/templates/mobile/discovery/topics.hbs +++ b/app/assets/javascripts/discourse/templates/mobile/discovery/topics.hbs @@ -25,8 +25,7 @@ {{conditional-loading-spinner condition=model.loadingMore}} {{#if allLoaded}} {{#if showDismissRead}} - - + {{/if}} {{#if showResetNew}} diff --git a/app/assets/javascripts/discourse/templates/modal/dismiss-read.hbs b/app/assets/javascripts/discourse/templates/modal/dismiss-read.hbs new file mode 100644 index 00000000000..9136970027c --- /dev/null +++ b/app/assets/javascripts/discourse/templates/modal/dismiss-read.hbs @@ -0,0 +1,10 @@ + + + diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 00c9a6b4a41..49da8b6a5b2 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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"