FEATURE: select all / deselect all on search page
This commit is contained in:
parent
0c5189fa2a
commit
71892cc5f4
|
@ -79,12 +79,26 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
Discourse.ajax("/search", { data: args }).then(results => {
|
Discourse.ajax("/search", { data: args }).then(results => {
|
||||||
this.set("model", translateResults(results) || {});
|
this.set("model", translateResults(results) || {});
|
||||||
// this.set("model.q", this.get("q"));
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
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() {
|
toggleBulkSelect() {
|
||||||
this.toggleProperty('bulkSelectEnabled');
|
this.toggleProperty('bulkSelectEnabled');
|
||||||
this.get('selected').clear();
|
this.get('selected').clear();
|
||||||
|
|
|
@ -9,6 +9,15 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if model.posts}}
|
||||||
|
{{#if bulkSelectEnabled}}
|
||||||
|
<div class='fps-select'>
|
||||||
|
<a href {{action "selectAll"}}>{{i18n "search.select_all"}}</a>
|
||||||
|
<a href {{action "clearAll"}}>{{i18n "search.clear_all"}}</a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if context}}
|
{{#if context}}
|
||||||
<div class='fps-search-context'>
|
<div class='fps-search-context'>
|
||||||
<label>
|
<label>
|
||||||
|
|
|
@ -49,6 +49,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fps-select {
|
||||||
|
margin-top: -15px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
a:hover {
|
||||||
|
color: $secondary;
|
||||||
|
background-color: $tertiary;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
margin-right: 15px;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 2px 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.search.row {
|
.search.row {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
input {
|
input {
|
||||||
|
|
|
@ -942,6 +942,8 @@ en:
|
||||||
image_link: "link your image will point to"
|
image_link: "link your image will point to"
|
||||||
|
|
||||||
search:
|
search:
|
||||||
|
select_all: "Select All"
|
||||||
|
clear_all: "Clear All"
|
||||||
title: "search topics, posts, users, or categories"
|
title: "search topics, posts, users, or categories"
|
||||||
no_results: "No results found."
|
no_results: "No results found."
|
||||||
no_more_results: "No more results found."
|
no_more_results: "No more results found."
|
||||||
|
|
Loading…
Reference in New Issue