From c66f6e858dff8fbe97f2eacd5dd1dce1e24eacae Mon Sep 17 00:00:00 2001
From: "Mark M. Florida" <markflorida@wustl.edu>
Date: Wed, 26 Oct 2016 18:15:45 -0500
Subject: [PATCH] XNAT-4544: tweaked xmodal styles and defaults so buttons stay
 in the browser viewport and adjusted height of script editor dialog.

---
 src/main/webapp/scripts/xmodal-v1/xmodal.css      |  2 +-
 src/main/webapp/scripts/xmodal-v1/xmodal.js       | 14 +++++++-------
 src/main/webapp/scripts/xnat/app/scriptEditor.js  |  5 +++--
 src/main/webapp/xnat-templates/screens/Scripts.vm |  2 +-
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/main/webapp/scripts/xmodal-v1/xmodal.css b/src/main/webapp/scripts/xmodal-v1/xmodal.css
index 17a4d721..bfd32b79 100644
--- a/src/main/webapp/scripts/xmodal-v1/xmodal.css
+++ b/src/main/webapp/scripts/xmodal-v1/xmodal.css
@@ -21,7 +21,7 @@ div.xmodal-mask { background: transparent url(data:image/png;base64,iVBORw0KGgoA
 /*div.xmodal-mask.open { display: block ; z-index: 100 ; }*/
 
 div.xmodal {
-    display: none ; min-width: 200px ; min-height: 128px ; max-width: 98% ; max-height: 98% ;
+    display: none ; min-width: 200px ; min-height: 128px ; max-width: 92% ; max-height: 92% ;
     position: fixed ; top: 0 ; right: 0 ; bottom: 0 ; left: 0 ; margin: auto ; overflow: hidden ;
     background: #fff ; border: 1px solid #a0a0a0 ; box-shadow: 0 10px 30px rgba(0,0,0,0.5) ;
     font-family: Arial, Helvetica, sans-serif ; }
diff --git a/src/main/webapp/scripts/xmodal-v1/xmodal.js b/src/main/webapp/scripts/xmodal-v1/xmodal.js
index 55531bea..80c6bb6f 100644
--- a/src/main/webapp/scripts/xmodal-v1/xmodal.js
+++ b/src/main/webapp/scripts/xmodal-v1/xmodal.js
@@ -450,7 +450,7 @@ if (typeof jQuery == 'undefined') {
 
             resizeBody($modal, modal);
 
-            $(window).resize(function () {
+            $(window).off('resize').on('resize', function(){
                 resizeBody($modal, modal);
             });
 
@@ -711,12 +711,12 @@ if (typeof jQuery == 'undefined') {
             this.top = firstDefined(_opts.top||undefined, '22px');
 
             this.width = 600;
-            this.minWidth = 'inherit';
-            this.maxWidth = 'inherit';
+            //this.minWidth = 'inherit';
+            //this.maxWidth = 'inherit';
 
             this.height = 400;
-            this.minHeight = 'inherit';
-            this.maxHeight = 'inherit';
+            //this.minHeight = 'inherit';
+            //this.maxHeight = 'inherit';
 
             // support for 'preset' sizes
             if (_opts.kind || _opts.size){
@@ -724,8 +724,8 @@ if (typeof jQuery == 'undefined') {
                     var kinds = {
                         dialog:  [600, 400],
                         message: [400, 200],
-                        max:     ['98%', '96%'],
-                        full:    ['98%', '96%'],
+                        max:     ['98%', '98%'],
+                        full:    ['98%', '98%'],
                         large:   ['80%', '80%'],
                         med:     ['60%', '60%'],
                         small:   ['40%', '40%'],
diff --git a/src/main/webapp/scripts/xnat/app/scriptEditor.js b/src/main/webapp/scripts/xnat/app/scriptEditor.js
index 47bfbce4..8a66f6b3 100644
--- a/src/main/webapp/scripts/xnat/app/scriptEditor.js
+++ b/src/main/webapp/scripts/xnat/app/scriptEditor.js
@@ -300,8 +300,9 @@ var XNAT = getObject(XNAT || {});
 
         var opts = {};
         opts.width = 880;
-        opts.height = 720;
-        //opts.top = 100;
+        opts.height = 600;
+        // opts.maxHeight = '98%';
+        // opts.top = 100;
         opts.scroll = false;
         opts.template = $('#script-editor-template');
         opts.title = 'XNAT Script Editor';
diff --git a/src/main/webapp/xnat-templates/screens/Scripts.vm b/src/main/webapp/xnat-templates/screens/Scripts.vm
index 318fb4d5..04d1a09e 100644
--- a/src/main/webapp/xnat-templates/screens/Scripts.vm
+++ b/src/main/webapp/xnat-templates/screens/Scripts.vm
@@ -451,7 +451,7 @@
                 </tr>
             </table>
             <br>
-            <div class="editor-wrapper" style="width:840px;height:440px;position:relative;">
+            <div class="editor-wrapper" style="width:840px;height:320px;position:relative;">
                 <!-- the '.editor-content' div gets replaced when the script content is loaded -->
                 <div class="editor-content" style="position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid #ccc;"></div>
             </div>
-- 
GitLab