From 9c7b891afdb687e1ceb110ba07e53b805f04bb5d Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 17 Nov 2016 02:25:15 +0530 Subject: [PATCH] FEATURE: batch select topics --- .../javascripts/discourse/components/topic-list.js.es6 | 8 ++++++++ .../discourse/templates/topic-list-header-column.raw.hbs | 6 ++++++ .../discourse/templates/topic-list-header.raw.hbs | 8 ++++---- config/locales/client.en.yml | 2 ++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/components/topic-list.js.es6 b/app/assets/javascripts/discourse/components/topic-list.js.es6 index 260bddb756e..5b214be7aa7 100644 --- a/app/assets/javascripts/discourse/components/topic-list.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-list.js.es6 @@ -125,6 +125,14 @@ export default Ember.Component.extend({ this.rerender(); }); + onClick('button.bulk-select-all', function(){ + $('input.bulk-select:not(:checked)').click(); + }); + + onClick('button.bulk-clear-all', function(){ + $('input.bulk-select:checked').click(); + }); + onClick('th.sortable', function(e2){ this.sendAction('changeSort', e2.data('sort-order')); this.rerender(); diff --git a/app/assets/javascripts/discourse/templates/topic-list-header-column.raw.hbs b/app/assets/javascripts/discourse/templates/topic-list-header-column.raw.hbs index 3d3da42d96a..ab53f6f29cf 100644 --- a/app/assets/javascripts/discourse/templates/topic-list-header-column.raw.hbs +++ b/app/assets/javascripts/discourse/templates/topic-list-header-column.raw.hbs @@ -2,6 +2,12 @@ {{~#if showBulkToggle}} {{/if ~}} + {{~#if bulkSelectEnabled}} + + + + + {{/if ~}} {{view.localizedName}} {{~#if view.isSorting}} diff --git a/app/assets/javascripts/discourse/templates/topic-list-header.raw.hbs b/app/assets/javascripts/discourse/templates/topic-list-header.raw.hbs index 4714a3cedb7..e5d1f506d6d 100644 --- a/app/assets/javascripts/discourse/templates/topic-list-header.raw.hbs +++ b/app/assets/javascripts/discourse/templates/topic-list-header.raw.hbs @@ -1,9 +1,9 @@ {{#if bulkSelectEnabled}} - - - + + + {{/if}} -{{raw "topic-list-header-column" order='default' name='topic.title' showBulkToggle=toggleInTitle}} +{{raw "topic-list-header-column" order='default' name='topic.title' bulkSelectEnabled=bulkSelectEnabled showBulkToggle=toggleInTitle}} {{#unless hideCategory}} {{raw "topic-list-header-column" sortable=sortable order='category' name='category_title'}} {{/unless}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 9eed55aad48..35c1f55e24b 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1272,6 +1272,8 @@ en: topics: new_messages_marker: "last visit" bulk: + select_all: "Select All" + clear_all: "Clear All" unlist_topics: "Unlist Topics" reset_read: "Reset Read" delete: "Delete Topics"