Browse Source

Delete unnecessary lines

pull/747/head
Juan Martín Pithod 8 years ago
parent
commit
7f6de97acd
  1. 2
      dist/css/grapes.min.css
  2. 20
      index.html
  3. 29
      src/block_manager/model/Block.js
  4. 3
      src/block_manager/model/Category.js
  5. 12
      src/block_manager/view/BlocksView.js

2
dist/css/grapes.min.css

File diff suppressed because one or more lines are too long

20
index.html

@ -117,8 +117,8 @@
label: 'Block',
category: {
label: 'General',
order: 1,
open: true,
order: 2,
open: false,
},
attributes: { class: 'gjs-fonts gjs-f-b1' },
content: `<div style="padding-top:50px; padding-bottom:50px; text-align:center">Test block</div>`
@ -126,23 +126,11 @@
editor.BlockManager.add('testBlock2', {
label: 'Block2',
category: {
label: 'Otro',
order: 5,
open: true,
},
category: 'Test category',
attributes: { class: 'gjs-fonts gjs-f-2' },
content: `<div style="padding-top:50px; padding-bottom:50px; text-align:center">Test block</div>`
content: `<div style="padding-top:50px; padding-bottom:50px; text-align:center">Test block 2</div>`
})
editor.BlockManager.add('testBlock3', {
label: 'Block3',
category: {
label: 'Otro',
},
attributes: { class: 'gjs-fonts gjs-f-2' },
content: `<div style="padding-top:50px; padding-bottom:50px; text-align:center">Test block</div>`
})
</script>
</body>

29
src/block_manager/model/Block.js

@ -6,26 +6,21 @@ module.exports = Backbone.Model.extend({
defaults: {
label: '',
content: '',
category: {
label: '',
order: '',
},
category: '',
attributes: {},
},
// initialize(opts = {}) {
// let category = this.get('category');
// let catLabel = category.label;
initialize(opts = {}) {
let category = this.get('category');
// // if (catLable) {
// // if (typeof catLabel == 'string') {
// // var catObj = new Category({
// // id: catLabel,
// // label: catLabel,
// // order: category.order,
// // });
// // }
// // }
// },
if (category) {
if (typeof category == 'string') {
var catObj = new Category({
id: category,
label: category,
});
}
}
},
});

3
src/block_manager/model/Category.js

@ -5,8 +5,7 @@ module.exports = Backbone.Model.extend({
defaults: {
id: '',
label: '',
open: false,
order: '',
open: true,
attributes: {},
},

12
src/block_manager/view/BlocksView.js

@ -114,15 +114,15 @@ module.exports = Backbone.View.extend({
// Check for categories
if (category && this.categories) {
if (typeof category.label == 'string') {
if (typeof category == 'string') {
category = {
id: category.label,
label: category.label,
order: category.order,
open: category.open,
id: category,
label: category
};
} else if (typeof category == 'object') {
category.id = category.label;
}
var catModel = this.categories.add(category);
var catId = catModel.get('id');
var catView = this.renderedCategories[catId];

Loading…
Cancel
Save