From f11bba5537b10423e2d7c3c0bf91d744396e227c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 19 Jun 2015 19:56:52 +0000 Subject: [PATCH] Fixed the sudo dialog when called from a dialog, eg. email addresses (#19851). git-svn-id: http://svn.redmine.org/redmine/trunk@14339 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/sudo_mode/new.js.erb | 6 +++--- public/javascripts/application.js | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/sudo_mode/new.js.erb b/app/views/sudo_mode/new.js.erb index 34510fa54..ed77b32b1 100644 --- a/app/views/sudo_mode/new.js.erb +++ b/app/views/sudo_mode/new.js.erb @@ -1,4 +1,4 @@ -$('#ajax-modal').html('<%= escape_javascript render partial: 'sudo_mode/new_modal' %>'); -showModal('ajax-modal', '400px'); +$("body").append($("
", {id: "sudo-modal"}).hide()); +$('#sudo-modal').html('<%= escape_javascript render partial: 'sudo_mode/new_modal' %>'); +showModal('sudo-modal', '400px'); $('#sudo_password').focus(); - diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 0a12bc026..775ad592f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -383,6 +383,8 @@ function showModal(id, width, title) { var el = $('#'+id).first(); if (el.length === 0 || el.is(':visible')) {return;} if (!title) title = el.find('h3.title').text(); + // moves existing modals behind the transparent background + $(".modal").zIndex(99); el.dialog({ width: width, modal: true, @@ -401,6 +403,8 @@ function hideModal(el) { modal = $('#ajax-modal'); } modal.dialog("close"); + // restores existing modals in front of the transparent background + $(".modal").zIndex(101); } function submitPreview(url, form, target) {