Browse Source

Delete unnecessary lines

pull/747/head
Juan Martín Pithod 9 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', label: 'Block',
category: { category: {
label: 'General', label: 'General',
order: 1, order: 2,
open: true, open: false,
}, },
attributes: { class: 'gjs-fonts gjs-f-b1' }, attributes: { class: 'gjs-fonts gjs-f-b1' },
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</div>`
@ -126,23 +126,11 @@
editor.BlockManager.add('testBlock2', { editor.BlockManager.add('testBlock2', {
label: 'Block2', label: 'Block2',
category: { category: 'Test category',
label: 'Otro',
order: 5,
open: true,
},
attributes: { class: 'gjs-fonts gjs-f-2' }, 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> </script>
</body> </body>

29
src/block_manager/model/Block.js

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

3
src/block_manager/model/Category.js

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

12
src/block_manager/view/BlocksView.js

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

Loading…
Cancel
Save