Browse Source

Merge dev

pull/3411/head
Artur Arseniev 6 years ago
parent
commit
3cb7d140f1
  1. 11
      src/block_manager/view/CategoryView.js

11
src/block_manager/view/CategoryView.js

@ -12,6 +12,10 @@ export default Backbone.View.extend({
events: {}, events: {},
attributes() {
return this.model.get('attributes');
},
initialize(o = {}, config = {}) { initialize(o = {}, config = {}) {
this.config = config; this.config = config;
const pfx = config.pStylePrefix || ''; const pfx = config.pStylePrefix || '';
@ -25,6 +29,7 @@ export default Backbone.View.extend({
this.events[`click .${pfx}title`] = 'toggle'; this.events[`click .${pfx}title`] = 'toggle';
this.listenTo(this.model, 'change:open', this.updateVisibility); this.listenTo(this.model, 'change:open', this.updateVisibility);
this.delegateEvents(); this.delegateEvents();
this.model.view = this;
}, },
updateVisibility() { updateVisibility() {
@ -33,13 +38,13 @@ export default Backbone.View.extend({
}, },
open() { open() {
this.el.className = `${this.className} ${this.activeClass}`; this.$el.addClass(this.activeClass);
this.getIconEl().className = `${this.iconClass} ${this.caretD}`; this.getIconEl().className = `${this.iconClass} ${this.caretD}`;
this.getBlocksEl().style.display = ''; this.getBlocksEl().style.display = '';
}, },
close() { close() {
this.el.className = this.className; this.$el.removeClass(this.activeClass);
this.getIconEl().className = `${this.iconClass} ${this.caretR}`; this.getIconEl().className = `${this.iconClass} ${this.caretR}`;
this.getBlocksEl().style.display = 'none'; this.getBlocksEl().style.display = 'none';
}, },
@ -77,7 +82,7 @@ export default Backbone.View.extend({
pfx: this.pfx, pfx: this.pfx,
label label
}); });
el.className = this.className; $el.addClass(this.className);
$el.css({ order: model.get('order') }); $el.css({ order: model.get('order') });
this.updateVisibility(); this.updateVisibility();

Loading…
Cancel
Save