From 749664b07f2db44dc83cab28fb45b379a7433b0a Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 8 Aug 2016 15:37:59 +0200 Subject: [PATCH] Add getContentEl to dialog API --- src/modal_dialog/main.js | 28 ++++++++++++++++++---------- src/modal_dialog/view/ModalView.js | 10 ++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/modal_dialog/main.js b/src/modal_dialog/main.js index 083cf7918..ead34e8f0 100644 --- a/src/modal_dialog/main.js +++ b/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; }); \ No newline at end of file diff --git a/src/modal_dialog/view/ModalView.js b/src/modal_dialog/view/ModalView.js index 1e49c03fd..ddace4279 100644 --- a/src/modal_dialog/view/ModalView.js +++ b/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 *