Browse Source

Update Panel JSDoc comments

pull/36/head
Artur Arseniev 10 years ago
parent
commit
54308d9918
  1. 1
      .gitignore
  2. 36
      src/panels/main.js
  3. 10
      src/panels/model/Panels.js
  4. 33
      src/panels/view/PanelsView.js

1
.gitignore

@ -9,6 +9,7 @@ grapes.sublime-workspace
img/
private/
docs/
vendor/
coverage/
node_modules/

36
src/panels/main.js

@ -1,11 +1,29 @@
/**
* This module manages panels and buttons inside the editor.
* You can init the editor with all panels and buttons necessary via configuration
*
* ```js
* var editor = new GrapesJS({
* ...
* panels: {...} // Check below for the possible properties
* ...
* });
* ```
*
*
* Before using methods you should get first the module from the GrapesJs instance, in this way:
*
* ```js
* var panelService = editor.get('Panels');
* ```
*
* @module Panels
* @param {Object} config Configurations
*/
define(function(require) {
/**
* @class Panel
* @param {Object} Configurations
*
* @return {Object}
* */
function Panel(config){
var Panels = function(config){
var c = config || {},
defaults = require('./config/config'),
Panels = require('./model/Panels'),
@ -120,7 +138,7 @@ define(function(require) {
},
};
}
};
return Panel;
return Panels;
});

10
src/panels/model/Panels.js

@ -1,11 +1,9 @@
define([ 'backbone','./Panel'],
define([ 'backbone','./Panel'],
function (Backbone, Panel) {
/**
* @class Panels
* */
return Backbone.Collection.extend({
model: Panel,
});
});

33
src/panels/view/PanelsView.js

@ -1,10 +1,11 @@
define(['backbone','./PanelView'],
define(['backbone','./PanelView'],
function (Backbone, PanelView) {
/**
/**
* @class ItemsView
* @private
* */
return Backbone.View.extend({
initialize: function(o) {
this.opt = o;
this.config = o.config;
@ -13,52 +14,54 @@ define(['backbone','./PanelView'],
this.listenTo( this.collection, 'reset', this.render );
this.className = this.pfx + 'panels';
},
/**
* Add to collection
* @param Object Model
*
*
* @return Object
* @private
* */
addTo: function(model){
this.addToCollection(model);
},
/**
* Add new object to collection
* @param Object Model
* @param Object Fragment collection
* @param integer Index of append
*
*
* @return Object Object created
* @private
* */
addToCollection: function(model, fragmentEl){
var fragment = fragmentEl || null;
var viewObject = PanelView;
var view = new viewObject({
model : model,
var view = new viewObject({
model : model,
config : this.config,
});
var rendered = view.render().el;
if(fragment){
fragment.appendChild(rendered);
}else{
this.$el.append(rendered);
}
return rendered;
},
render: function() {
var fragment = document.createDocumentFragment();
this.$el.empty();
this.collection.each(function(model){
this.addToCollection(model, fragment);
}, this);
this.$el.append(fragment);
this.$el.attr('class', _.result(this, 'className'));
return this;

Loading…
Cancel
Save