added 260907 version of worker toolkit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import Ember from 'ember';
|
||||
import BackNavigateable from 'flaredown/mixins/back-navigateable';
|
||||
import SearchableDropdown from 'flaredown/mixins/searchable-dropdown';
|
||||
|
||||
const {
|
||||
get,
|
||||
computed,
|
||||
Controller,
|
||||
String: {
|
||||
htmlSafe,
|
||||
},
|
||||
} = Ember;
|
||||
|
||||
export default Controller.extend(BackNavigateable, SearchableDropdown, {
|
||||
closeSymbol: htmlSafe('✕ '),
|
||||
|
||||
randomTrackables: computed(function() {
|
||||
return this.randomSearch('topic');
|
||||
}),
|
||||
|
||||
performSearch(term, resolve, reject) {
|
||||
this
|
||||
.searchByTerm('topic', term)
|
||||
.then(function() { resolve(...arguments); }, reject);
|
||||
},
|
||||
|
||||
manipulateTopic(topic, action) {
|
||||
const model = get(this, 'model');
|
||||
|
||||
model[action](topic);
|
||||
model.save();
|
||||
},
|
||||
|
||||
actions: {
|
||||
addTopic(topic) {
|
||||
this.manipulateTopic(topic, 'addTopic');
|
||||
},
|
||||
|
||||
removeTopic(topic) {
|
||||
this.manipulateTopic(topic, 'removeTopic');
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user