Adds buttons to scroll the tabs when they overflow.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3174 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-12-14 20:13:29 +00:00
parent 09e47a3b63
commit 1c11d3403e
5 changed files with 85 additions and 2 deletions
+49
View File
@@ -73,6 +73,55 @@ function showTab(name) {
return false;
}
function moveTabRight(el) {
var lis = Element.up(el, 'div.tabs').down('ul').childElements();
var tabsWidth = 0;
var i;
for (i=0; i<lis.length; i++) {
if (lis[i].visible()) {
tabsWidth += lis[i].getWidth() + 6;
}
}
if (tabsWidth < Element.up(el, 'div.tabs').getWidth() - 60) {
return;
}
i=0;
while (i<lis.length && !lis[i].visible()) {
i++;
}
lis[i].hide();
}
function moveTabLeft(el) {
var lis = Element.up(el, 'div.tabs').down('ul').childElements();
var i = 0;
while (i<lis.length && !lis[i].visible()) {
i++;
}
if (i>0) {
lis[i-1].show();
}
}
function displayTabsButtons() {
var lis;
var tabsWidth = 0;
var i;
$$('div.tabs').each(function(el) {
lis = el.down('ul').childElements();
for (i=0; i<lis.length; i++) {
if (lis[i].visible()) {
tabsWidth += lis[i].getWidth() + 6;
}
}
if (tabsWidth < el.getWidth() - 60) {
el.down('div.tabs-buttons').hide();
} else {
el.down('div.tabs-buttons').show();
}
});
}
function setPredecessorFieldsVisibility() {
relationType = $('relation_relation_type');
if (relationType && relationType.value == "precedes") {