diff options
Diffstat (limited to 'public/javascripts/application.js')
-rw-r--r-- | public/javascripts/application.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/public/javascripts/application.js b/public/javascripts/application.js index cc75c8180..1a5e0c04f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -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") { |