|
|
|
@ -1,24 +1,20 @@ |
|
|
|
import { filter } from 'underscore'; |
|
|
|
import Backbone from 'backbone'; |
|
|
|
import { Collection } from 'common'; |
|
|
|
import Selector from './Selector'; |
|
|
|
|
|
|
|
export default Backbone.Collection.extend({ |
|
|
|
model: Selector, |
|
|
|
|
|
|
|
modelId: attr => `${attr.name}_${attr.type || Selector.TYPE_CLASS}`, |
|
|
|
|
|
|
|
export default class Selectors extends Collection { |
|
|
|
getStyleable() { |
|
|
|
return filter( |
|
|
|
this.models, |
|
|
|
item => item.get('active') && !item.get('private') |
|
|
|
); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
getValid({ noDisabled } = {}) { |
|
|
|
return filter(this.models, item => !item.get('private')).filter(item => |
|
|
|
noDisabled ? item.get('active') : 1 |
|
|
|
); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
getFullString(collection, opts = {}) { |
|
|
|
const result = []; |
|
|
|
@ -26,4 +22,8 @@ export default Backbone.Collection.extend({ |
|
|
|
coll.forEach(selector => result.push(selector.getFullName(opts))); |
|
|
|
return result.join('').trim(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
Selectors.prototype.model = Selector; |
|
|
|
Selectors.prototype.modelId = attr => |
|
|
|
`${attr.name}_${attr.type || Selector.TYPE_CLASS}`; |
|
|
|
|