Skip to content

Commit

Permalink
Update classes in SectorView. Closes #1753
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jan 27, 2019
1 parent b7820d1 commit 3079efb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
11 changes: 6 additions & 5 deletions src/style_manager/model/Sector.js
Expand Up @@ -15,15 +15,16 @@ module.exports = Backbone.Model.extend({
},

initialize(opts) {
var o = opts || {};
var props = [];
var builded = this.buildProperties(o.buildProps);
!this.get('id') && this.set('id', this.get('name'));
const o = opts || {};
const builded = this.buildProperties(o.buildProps);
const name = this.get('name') || '';
let props = [];
!this.get('id') && this.set('id', name.replace(/ /g, '_').toLowerCase());

if (!builded) props = this.get('properties');
else props = this.extendProperties(builded);

var propsModel = new Properties(props);
const propsModel = new Properties(props);
propsModel.sector = this;
this.set('properties', propsModel);
},
Expand Down
10 changes: 6 additions & 4 deletions src/style_manager/view/SectorView.js
Expand Up @@ -78,15 +78,17 @@ module.exports = Backbone.View.extend({
},

render() {
const { pfx, model } = this;
const { id } = model.attributes;
this.$el.html(
this.template({
pfx: this.pfx,
label: this.model.get('name')
pfx,
label: model.get('name')
})
);
this.$caret = this.$el.find('#' + this.pfx + 'caret');
this.$caret = this.$el.find(`#${pfx}caret`);
this.renderProperties();
this.$el.attr('class', this.pfx + 'sector no-select');
this.$el.attr('class', `${pfx}sector ${pfx}sector__${id} no-select`);
this.updateOpen();
return this;
},
Expand Down
14 changes: 5 additions & 9 deletions src/style_manager/view/SectorsView.js
Expand Up @@ -134,20 +134,16 @@ module.exports = Backbone.View.extend({
* @private
* */
addToCollection(model, fragmentEl) {
const { pfx, target, propTarget, config } = this;
var fragment = fragmentEl || null;
var view = new SectorView({
model,
id:
this.pfx +
model
.get('name')
.replace(' ', '_')
.toLowerCase(),
id: `${pfx}${model.get('id')}`,
name: model.get('name'),
properties: model.get('properties'),
target: this.target,
propTarget: this.propTarget,
config: this.config
target,
propTarget,
config
});
var rendered = view.render().el;

Expand Down

0 comments on commit 3079efb

Please sign in to comment.