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

10
src/modal_dialog/view/ModalView.js

@ -23,6 +23,16 @@ define(['backbone', 'text!./../template/modal.html'],
this.delegateEvents(); 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 * Update content
* *

Loading…
Cancel
Save