summaryrefslogtreecommitdiffstats
path: root/public/javascripts/context_menu.js
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-24 10:25:33 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-24 10:25:33 +0000
commitab34455cdd5691b67119cf8ed41e0b7fc2822397 (patch)
treefc459a91e0f93c0f10ec32a0de38bd8abe87ffdf /public/javascripts/context_menu.js
parent66b9add002ab4616929f06bfef3197e23ed695fd (diff)
downloadredmine-ab34455cdd5691b67119cf8ed41e0b7fc2822397.tar.gz
redmine-ab34455cdd5691b67119cf8ed41e0b7fc2822397.zip
Issue percentage selector extends screen border (#22059).
Patch by Antonina Lebedeva. git-svn-id: http://svn.redmine.org/redmine/trunk@15349 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public/javascripts/context_menu.js')
-rw-r--r--public/javascripts/context_menu.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js
index 1b7da8991..ca2a9bec9 100644
--- a/public/javascripts/context_menu.js
+++ b/public/javascripts/context_menu.js
@@ -87,7 +87,8 @@ function contextMenuCreate() {
function contextMenuShow(event) {
var mouse_x = event.pageX;
- var mouse_y = event.pageY;
+ var mouse_y = event.pageY;
+ var mouse_y_c = event.clientY;
var render_x = mouse_x;
var render_y = mouse_y;
var dims;
@@ -110,7 +111,7 @@ function contextMenuShow(event) {
menu_width = $('#context-menu').width();
menu_height = $('#context-menu').height();
max_width = mouse_x + 2*menu_width;
- max_height = mouse_y + menu_height;
+ max_height = mouse_y_c + menu_height;
var ws = window_size();
window_width = ws.width;
@@ -123,12 +124,22 @@ function contextMenuShow(event) {
} else {
$('#context-menu').removeClass('reverse-x');
}
+
if (max_height > window_height) {
render_y -= menu_height;
$('#context-menu').addClass('reverse-y');
+ // adding class for submenu
+ if (mouse_y_c < 325) {
+ $('#context-menu .folder').addClass('down');
+ }
} else {
- $('#context-menu').removeClass('reverse-y');
+ // adding class for submenu
+ if (window_height - mouse_y_c < 345) {
+ $('#context-menu .folder').addClass('up');
+ }
+ $('#context-menu').removeClass('reverse-y');
}
+
if (render_x <= 0) render_x = 1;
if (render_y <= 0) render_y = 1;
$('#context-menu').css('left', (render_x + 'px'));
@@ -136,7 +147,6 @@ function contextMenuShow(event) {
$('#context-menu').show();
//if (window.parseStylesheets) { window.parseStylesheets(); } // IE
-
}
});
}