Browse Source

Add getContentEl to dialog API

pull/36/head
Artur Arseniev 10 years ago
parent
commit
749664b07f
  1. 28
      src/modal_dialog/main.js
  2. 10
      src/modal_dialog/view/ModalView.js

28
src/modal_dialog/main.js

@ -2,7 +2,7 @@ define(function(require) {
/**
* @class Modal
* @param {Object} Configurations
*
*
* @return {Object}
* */
function Modal(config)
@ -16,7 +16,7 @@ define(function(require) {
if (!(name in c))
c[name] = defaults[name];
}
this.model = new ModalM(c);
var obj = {
model : this.model,
@ -25,33 +25,41 @@ define(function(require) {
this.modal = new ModalView(obj);
}
Modal.prototype = {
getModel : function(){
return this.model;
},
render : function(){
return this.modal.render().$el;
},
show : function(){
return this.modal.show();
},
hide : function(){
return this.modal.hide();
},
setTitle : function(v){
return this.modal.setTitle(v);
},
setContent : function(v){
return this.modal.setContent(v);
},
/**
* Returns content element
* @return {HTMLElement}
*/
getContentEl: function(){
return this.modal.getContent();
}
};
return Modal;
});

10
src/modal_dialog/view/ModalView.js

@ -23,6 +23,16 @@ define(['backbone', 'text!./../template/modal.html'],
this.delegateEvents();
},
/**
* Returns content element
* @return {HTMLElement}
*/
getContent:function(){
if(!this.$content)
this.$content = this.$el.find('.'+this.pfx+'content #'+this.pfx+'c');
return this.$content.get(0);
},
/**
* Update content
*

Loading…
Cancel
Save