Browse Source

Add the possibility to order Block's categories

pull/758/head
Artur Arseniev 9 years ago
parent
commit
569b2a0806
  1. 2
      dist/css/grapes.min.css
  2. 2
      src/block_manager/view/BlocksView.js
  3. 1
      src/block_manager/view/CategoryView.js
  4. 5
      src/styles/scss/_gjs_blocks.scss
  5. 11
      src/trait_manager/model/Trait.js

2
dist/css/grapes.min.css

File diff suppressed because one or more lines are too long

2
src/block_manager/view/BlocksView.js

@ -120,6 +120,8 @@ module.exports = Backbone.View.extend({
id: category,
label: category
};
} else if (typeof category === 'object') {
category.id = category.label;
}
var catModel = this.categories.add(category);

1
src/block_manager/view/CategoryView.js

@ -73,6 +73,7 @@ module.exports = Backbone.View.extend({
label: this.model.get('label')
});
this.el.className = this.className;
this.$el.css({ order: this.model.get('order') });
this.updateVisibility();
return this;
}

5
src/styles/scss/_gjs_blocks.scss

@ -4,6 +4,11 @@
justify-content: flex-start;
}
.#{$app-prefix}block-categories {
display: flex;
flex-direction: column;
}
.#{$app-prefix}block-category {
width: 100%;

11
src/trait_manager/model/Trait.js

@ -58,6 +58,17 @@ module.exports = require('backbone').Model.extend({
}
},
setValueFromInput(value, final = 1, opts = {}) {
const toSet = { value };
this.set(toSet, { ...opts, avoidStore: 1 });
// Have to trigger the change
if (final) {
this.set('value', '', opts);
this.set(toSet, opts);
}
},
/**
* Get the initial value of the trait
* @return {string}

Loading…
Cancel
Save