Tab left/right buttons for project menu (#20632).

Patch by Felix Gliesche.

git-svn-id: http://svn.redmine.org/redmine/trunk@15067 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2016-01-16 09:14:02 +00:00
parent aaeb0807bf
commit 2ec87100a9
5 changed files with 24 additions and 11 deletions

View File

@@ -13,11 +13,6 @@
</div> </div>
</div> </div>
<script>
$(document).ready(displayTabsButtons);
$(window).resize(displayTabsButtons);
</script>
<% tabs.each do |tab| -%> <% tabs.each do |tab| -%>
<%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ), <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ),
:id => "tab-content-#{tab[:name]}", :id => "tab-content-#{tab[:name]}",

View File

@@ -87,8 +87,12 @@
<h1><%= page_header_title %></h1> <h1><%= page_header_title %></h1>
<% if display_main_menu?(@project) %> <% if display_main_menu?(@project) %>
<div id="main-menu"> <div id="main-menu" class="tabs">
<%= render_main_menu(@project) %> <%= render_main_menu(@project) %>
<div class="tabs-buttons" style="display:none;">
<button class="tab-left" onclick="moveTabLeft(this); return false;"></button>
<button class="tab-right" onclick="moveTabRight(this); return false;"></button>
</div>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@@ -90,7 +90,7 @@ module Redmine
menu_items_for(menu, project) do |node| menu_items_for(menu, project) do |node|
links << render_menu_node(node, project) links << render_menu_node(node, project)
end end
links.empty? ? nil : content_tag('ul', links.join("\n").html_safe) links.empty? ? nil : content_tag('ul', links.join.html_safe)
end end
def render_menu_node(node, project=nil) def render_menu_node(node, project=nil)

View File

@@ -620,6 +620,13 @@ function setupAjaxIndicator() {
}); });
} }
function setupTabs() {
if($('.tabs').length > 0) {
displayTabsButtons();
$(window).resize(displayTabsButtons);
}
}
function hideOnLoad() { function hideOnLoad() {
$('.hol').hide(); $('.hol').hide();
} }
@@ -677,3 +684,4 @@ $(document).ready(setupAjaxIndicator);
$(document).ready(hideOnLoad); $(document).ready(hideOnLoad);
$(document).ready(addFormObserversForDoubleSubmit); $(document).ready(addFormObserversForDoubleSubmit);
$(document).ready(defaultFocus); $(document).ready(defaultFocus);
$(document).ready(setupTabs);

View File

@@ -10,7 +10,7 @@ h4 {border-bottom: 1px dotted #bbb;}
pre, code {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace;} pre, code {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace;}
/***** Layout *****/ /***** Layout *****/
#wrapper {background: white;} #wrapper {background: white;overflow: hidden;}
#top-menu {background: #3E5B76; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 2px 0px 6px;} #top-menu {background: #3E5B76; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 2px 0px 6px;}
#top-menu ul {margin: 0; padding: 0;} #top-menu ul {margin: 0; padding: 0;}
@@ -31,14 +31,15 @@ pre, code {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace;}
#header h1 a.ancestor { font-size: 80%; } #header h1 a.ancestor { font-size: 80%; }
#quick-search {float:right;} #quick-search {float:right;}
#main-menu {position: absolute; bottom: 0px; left:6px; margin-right: -500px;} #main-menu {position: absolute; bottom: 0px; left:6px; margin-right: -500px; width: 100%;}
#main-menu ul {margin: 0; padding: 0;} #main-menu ul {margin: 0; padding: 0; width: 100%; white-space: nowrap;}
#main-menu li { #main-menu li {
float:left; float:none;
list-style-type:none; list-style-type:none;
margin: 0px 2px 0px 0px; margin: 0px 2px 0px 0px;
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
white-space:nowrap; white-space:nowrap;
display:inline-block;
} }
#main-menu li a { #main-menu li a {
display: block; display: block;
@@ -50,6 +51,11 @@ pre, code {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace;}
} }
#main-menu li a:hover {background:#759FCF; color:#fff;} #main-menu li a:hover {background:#759FCF; color:#fff;}
#main-menu li a.selected, #main-menu li a.selected:hover {background:#fff; color:#555;} #main-menu li a.selected, #main-menu li a.selected:hover {background:#fff; color:#555;}
#main-menu .tabs-buttons {
right: 6px;
background-color: transparent;
border-bottom-color: transparent;
}
#admin-menu ul {margin: 0; padding: 0;} #admin-menu ul {margin: 0; padding: 0;}
#admin-menu li {margin: 0; padding: 0 0 6px 0; list-style-type:none;} #admin-menu li {margin: 0; padding: 0 0 6px 0; list-style-type:none;}