Browse Source

Fix selector change in class tags

pull/712/head
Artur Arseniev 8 years ago
parent
commit
c83d4585c3
  1. 15
      src/selector_manager/model/Selectors.js
  2. 3
      src/selector_manager/view/ClassTagsView.js

15
src/selector_manager/model/Selectors.js

@ -1,21 +1,22 @@
var Backbone = require('backbone');
var Selector = require('./Selector');
import { filter } from 'underscore';
const Selector = require('./Selector');
module.exports = Backbone.Collection.extend({
module.exports = require('backbone').Collection.extend({
model: Selector,
getStyleable() {
return _.filter(this.models, item =>
return filter(this.models, item =>
item.get('active') && !item.get('private'));
},
getValid() {
return _.filter(this.models, item => !item.get('private'));
return filter(this.models, item => !item.get('private'));
},
getFullString() {
getFullString(collection) {
const result = [];
this.each(selector => result.push(selector.getFullName()));
const coll = collection || this;
coll.forEach(selector => result.push(selector.getFullName()));
return result.join('').trim();
}
});

3
src/selector_manager/view/ClassTagsView.js

@ -174,7 +174,8 @@ module.exports = Backbone.View.extend({
}
const state = selected.get('state');
let result = this.collection.getFullString();
const coll = this.collection;
let result = coll.getFullString(coll.getStyleable());
result = result || `#${selected.getId()}`;
result += state ? `:${state}` : '';
const el = this.el.querySelector('#' + this.pfx + 'sel');

Loading…
Cancel
Save