Modal fixes for BS3

Jonathan Frederic 12 years ago
parent 4917aba5e4
commit 3bb8c472cd

@ -63,7 +63,7 @@ IPython.dialog = (function (IPython) {
}
dialog_content.append(footer);
// hook up on-open event
modal.on("shown", function() {
modal.on("shown.bs.modal", function() {
setTimeout(function() {
footer.find("button").last().focus();
if (options.open) {
@ -74,11 +74,11 @@ IPython.dialog = (function (IPython) {
// destroy modal on hide, unless explicitly asked not to
if (options.destroy === undefined || options.destroy) {
modal.on("hidden", function () {
modal.on("hidden.bs.modal", function () {
modal.remove();
});
}
modal.on("hidden", function () {
modal.on("hidden.bs.modal", function () {
if (IPython.notebook) {
var cell = IPython.notebook.get_selected_cell();
if (cell) cell.select();

@ -84,11 +84,17 @@ define(["widgets/js/widget"], function(WidgetManager) {
this.children={};
this.$el.on("remove", function(){
that.$window.remove();
that.$backdrop.remove();
});
this.$window = $('<div />')
.addClass('modal widget-modal')
this.$backdrop = $('<div />')
.appendTo($('#notebook-container'))
.addClass('modal-dialog')
.css('position', 'absolute')
.css('left', '0px')
.css('top', '0px');
this.$window = $('<div />')
.appendTo(this.$backdrop)
.addClass('modal-content widget-modal')
.mousedown(function(){
that.bring_to_front();
});
@ -127,7 +133,7 @@ define(["widgets/js/widget"], function(WidgetManager) {
that.$window
.draggable('destroy')
.resizable('destroy')
.removeClass('widget-modal modal')
.removeClass('widget-modal modal-content')
.addClass('docked-widget-modal')
.detach()
.insertBefore(that.$show_button);
@ -140,9 +146,9 @@ define(["widgets/js/widget"], function(WidgetManager) {
that.$window
.removeClass('docked-widget-modal')
.addClass('widget-modal modal')
.addClass('widget-modal modal-content')
.detach()
.appendTo($('#notebook-container'))
.appendTo(that.$backdrop)
.draggable({handle: '.popover-title', snap: '#notebook, .modal', snapMode: 'both'})
.resizable()
.children('.ui-resizable-handle').show();
@ -223,12 +229,15 @@ define(["widgets/js/widget"], function(WidgetManager) {
var $widget_modals = $(".widget-modal");
var max_zindex = 0;
$widget_modals.each(function (index, el){
max_zindex = Math.max(max_zindex, parseInt($(el).css('z-index')));
var zindex = parseInt($(el).css('z-index'));
if (!isNaN(zindex)) {
max_zindex = Math.max(max_zindex, zindex);
}
});
// Start z-index of widget modals at 2000
max_zindex = Math.max(max_zindex, 2000);
$widget_modals.each(function (index, el){
$el = $(el);
if (max_zindex == parseInt($el.css('z-index'))) {

Loading…
Cancel
Save