From d7ab1c5cfbfcdff3ce3e201f6fb0684fdb914096 Mon Sep 17 00:00:00 2001 From: carlfeberhard Date: Thu, 22 Sep 2016 11:38:10 -0400 Subject: [PATCH 1/8] UI, Modal: re-build dom on render Moves templating to render (and updates dom node attributes after) to reset modal and prevent inline styling and other modifications to the singleton from persisting between calls to show. --- client/galaxy/scripts/mvc/ui/ui-modal.js | 43 +++++++++++----------- static/maps/mvc/ui/ui-modal.js.map | 2 +- static/scripts/bundled/libs.bundled.js | 4 +- static/scripts/bundled/libs.bundled.js.map | 2 +- static/scripts/mvc/ui/ui-modal.js | 2 +- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/client/galaxy/scripts/mvc/ui/ui-modal.js b/client/galaxy/scripts/mvc/ui/ui-modal.js index fcb709815dd..c30a3843708 100644 --- a/client/galaxy/scripts/mvc/ui/ui-modal.js +++ b/client/galaxy/scripts/mvc/ui/ui-modal.js @@ -1,5 +1,8 @@ define([], function() { var View = Backbone.View.extend({ + + className: "ui-modal", + // defaults optionsDefault : { container : 'body', @@ -19,18 +22,8 @@ var View = Backbone.View.extend({ // initialize initialize: function( options ) { - this.setElement( this._template() ); this.options = _.defaults( options || {}, this.optionsDefault ); $( this.options.container ).prepend( this.el ); - - // link elements - this.$header = this.$( '.modal-header' ); - this.$dialog = this.$( '.modal-dialog' ); - this.$body = this.$( '.modal-body' ); - this.$footer = this.$( '.modal-footer' ); - this.$backdrop = this.$( '.modal-backdrop' ); - this.$buttons = this.$( '.buttons' ); - // optional render options && this.render(); }, @@ -70,6 +63,16 @@ var View = Backbone.View.extend({ */ render: function() { var self = this; + this.$el.html( this._template() ); + + // link elements + this.$header = this.$( '.modal-header' ); + this.$dialog = this.$( '.modal-dialog' ); + this.$body = this.$( '.modal-body' ); + this.$footer = this.$( '.modal-footer' ); + this.$backdrop = this.$( '.modal-backdrop' ); + this.$buttons = this.$( '.buttons' ); + if (this.options.body == 'progress') { this.options.body = $( '
' + '
' + @@ -162,17 +165,15 @@ var View = Backbone.View.extend({ * Returns the modal template */ _template: function() { - return '
' + - '