From bc6b1799d76cc6cdf196c67bc6b258c05b533ea6 Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Wed, 7 Dec 2011 11:48:37 +0000 Subject: [PATCH] MDL-30627 Ensure that the dialogue is always shown in the current view window --- blocks/community/yui/comments/comments.js | 7 ------- enrol/yui/notification/notification.js | 5 +++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/blocks/community/yui/comments/comments.js b/blocks/community/yui/comments/comments.js index b2b1f536455..155a823c570 100644 --- a/blocks/community/yui/comments/comments.js +++ b/blocks/community/yui/comments/comments.js @@ -31,13 +31,6 @@ YUI.add('moodle-block_community-comments', function(Y) { this.overlays[commentid].render(); this.overlays[commentid].hide(); - // position the overlay in the middle of the web browser window - var WidgetPositionAlign = Y.WidgetPositionAlign; - this.overlays[commentid].set("align", { - node:"", //empty => viewport - points:[WidgetPositionAlign.CC, WidgetPositionAlign.CC] - }); - Y.one('#comments-'+commentid).on('click', this.show, this, commentid); } diff --git a/enrol/yui/notification/notification.js b/enrol/yui/notification/notification.js index f1ad0fb1d27..1c7e6da721d 100644 --- a/enrol/yui/notification/notification.js +++ b/enrol/yui/notification/notification.js @@ -81,8 +81,9 @@ Y.extend(DIALOGUE, Y.Overlay, { if (hidden) { bb.setStyle('top', '-1000px').removeClass(DIALOGUE_PREFIX+'-hidden'); } - var x = Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2); - var y = Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2)+Y.one(window).get('scrollTop'); + var x = Math.max(Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2), 15); + var y = Math.max(Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2), 15) + Y.one(window).get('scrollTop'); + if (hidden) { bb.addClass(DIALOGUE_PREFIX+'-hidden'); }