From c5f609428d9518f250e4a29fa4d37c898876efaf Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Wed, 6 Feb 2013 10:51:40 +0000 Subject: [PATCH] MDL-37566 AJAX Fix issues with minimum height and centring --- lib/yui/chooserdialogue/chooserdialogue.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/yui/chooserdialogue/chooserdialogue.js b/lib/yui/chooserdialogue/chooserdialogue.js index 897f0c5481b..5de6281814c 100644 --- a/lib/yui/chooserdialogue/chooserdialogue.js +++ b/lib/yui/chooserdialogue/chooserdialogue.js @@ -241,8 +241,21 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { newheight = newheight - (15 + 15 + 40 + 40); dialogue.setStyle('maxHeight', newheight + 'px'); + dialogueheight = bb.getStyle('height'); + if (dialogueheight.match(/.*px$/)) { + dialogueheight = dialogueheight.replace(/px$/, ''); + } else { + dialogueheight = totalheight; + } + + if (dialogueheight < this.get('baseheight')) { + dialogueheight = this.get('baseheight'); + dialogue.setStyle('height', dialogueheight + 'px'); + } + + // Re-calculate the location now that we've changed the size - dialoguetop = Math.max(12, ((winheight - totalheight) / 2)) + offsettop; + dialoguetop = Math.max(12, ((winheight - dialogueheight) / 2)) + offsettop; // We need to set the height for the yui3-widget - can't work // out what we're setting at present -- shoud be the boudingBox @@ -314,6 +327,9 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { minheight : { value : 300 }, + baseheight: { + value : 400 + }, maxheight : { value : 660 }, -- 2.43.0