app/assets/javascripts/caboose/modal_controller.js in caboose-cms-0.9.206 vs app/assets/javascripts/caboose/modal_controller.js in caboose-cms-0.9.207

- old
+ new

@@ -1,6 +1,5 @@ - var ModalController = Class.extend({ modal_width: false, modal_height: false, modal_element: false, @@ -16,56 +15,30 @@ modal: function(el, width, height, callback) { var that = this; if (!width) width = that.modal_width ? that.modal_width : 400; if (!height) height = that.modal_height ? that.modal_height : $(el).outerHeight(true); - that.modal_element = el; - el.attr('id', 'the_modal').addClass('modal').css('width', '' + width + 'px'); - var options = { - html: el, - initialWidth: width, - //initialHeight: height, - innerWidth: width, - //innerHeight: height, - scrolling: false, - closeButton: false, - opacity: 0.50, - onComplete: function() { - // var arr = ['TopLeft','TopCenter','TopRight','BottomLeft','BottomCenter','BottomRight','MiddleLeft','MiddleRight']; - // for (var i in arr) $('#cbox' + arr[i]).css('background-color', '#fff !important'); - $("#cboxClose").hide(); - if (callback) callback(); - } - }; - if (that.trapFocus === false) - options['trapFocus'] = false; - $.colorbox(options); + that.modal_element = el; + el.attr('id', 'the_modal'); + $("#caboose_sidebar_holder").html(el).addClass("visible").addClass("loading"); }, last_size: 0, autosize: function(msg, msg_container, flag) { var that = this; - if (!flag) - that.last_size = 0; - if (!that.modal_element) return; if (msg) $('#' + (msg_container ? msg_container : 'modal_message')).html(msg); - var h = that.modal_height ? that.modal_height : $(that.modal_element).outerHeight(true) + 20; - if (h > 0 && h > that.last_size) - $.colorbox.resize({ innerHeight: '' + h + 'px' }); - that.last_size = h; - - if (!flag || flag < 2) - setTimeout(function() { that.autosize(false, false, flag ? flag + 1 : 1); }, 200); + $("#caboose_sidebar_holder").removeClass("loading"); }, before_close: false, close: function() { var that = this; if (that.before_close) that.before_close(); - $.colorbox.close(); + $("#caboose_sidebar_holder").removeClass("visible"); + setTimeout(function(){ $("#caboose_sidebar_holder").html("") }, 500); }, /***************************************************************************** Asset management *****************************************************************************/ @@ -91,30 +64,9 @@ { var el = document.createElement('script'); el.setAttribute('type', 'text/javascript'); el.setAttribute('src', full_url); document.getElementsByTagName('head')[0].appendChild(el) - - //$.getScript(full_url, function() { - // if (after) after(); - //}); - // - //var trigger = 'script_' + Math.floor((Math.random() * 1000) + 1) + '_loaded' - //$(document).on(trigger, function() { - // if (after) after(); - // $(document).unbind(trigger); - //}); - //$.ajax({ - // trigger: trigger, - // url: full_url, - // type: 'get', - // success: function(js) { - // var el = document.createElement('script'); - // el.setAttribute('type', 'text/javascript'); - // el.innerHTML = js + "\n$(document).trigger('" + this.trigger + "');\n", - // document.getElementsByTagName('head')[0].appendChild(el); - // } - //}); } else if (url.match(/\.css/)) { var el = document.createElement('link'); el.setAttribute('rel', 'stylesheet');