diff --git a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 index 8efc5c6adfe..3641329f833 100644 --- a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 +++ b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 @@ -79,12 +79,26 @@ export default Ember.Controller.extend({ Discourse.ajax("/search", { data: args }).then(results => { this.set("model", translateResults(results) || {}); - // this.set("model.q", this.get("q")); }); }, actions: { + selectAll() { + this.get('selected').addObjects(this.get('model.posts').map(r => r.topic)); + // Doing this the proper way is a HUGE pain, + // we can hack this to work by observing each on the array + // in the component, however, when we select ANYTHING, we would force + // 50 traversals of the list + // This hack is cheap and easy + $('.fps-result input[type=checkbox]').prop('checked', true); + }, + + clearAll() { + this.get('selected').clear() + $('.fps-result input[type=checkbox]').prop('checked', false); + }, + toggleBulkSelect() { this.toggleProperty('bulkSelectEnabled'); this.get('selected').clear(); diff --git a/app/assets/javascripts/discourse/templates/full-page-search.hbs b/app/assets/javascripts/discourse/templates/full-page-search.hbs index f0278b64072..db60849ff9a 100644 --- a/app/assets/javascripts/discourse/templates/full-page-search.hbs +++ b/app/assets/javascripts/discourse/templates/full-page-search.hbs @@ -9,6 +9,15 @@ {{/if}} +{{#if model.posts}} + {{#if bulkSelectEnabled}} +
+ {{i18n "search.select_all"}} + {{i18n "search.clear_all"}} +
+ {{/if}} +{{/if}} + {{#if context}}