]> source.dussan.org Git - redmine.git/commitdiff
Tab left/right buttons for project menu (#20632).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 16 Jan 2016 09:14:02 +0000 (09:14 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 16 Jan 2016 09:14:02 +0000 (09:14 +0000)
Patch by Felix Gliesche.

git-svn-id: http://svn.redmine.org/redmine/trunk@15067 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/common/_tabs.html.erb
app/views/layouts/base.html.erb
lib/redmine/menu_manager.rb
public/javascripts/application.js
public/stylesheets/application.css

index 454b5d77219dd0a2856184a0f884d443b25f8f2b..705ecc7101dc3902e6a07af617cce64e45d03b95 100644 (file)
   </div>
 </div>
 
-<script>
-  $(document).ready(displayTabsButtons);
-  $(window).resize(displayTabsButtons);
-</script>
-
 <% tabs.each do |tab| -%>
   <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ),
                        :id => "tab-content-#{tab[:name]}",
index 1d83ca12b00f4422724247a1fc149eba38f91b2d..7da0f07c4376c122aa01327171d58380962e14b0 100644 (file)
     <h1><%= page_header_title %></h1>
 
     <% if display_main_menu?(@project) %>
-    <div id="main-menu">
+    <div id="main-menu" class="tabs">
         <%= 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>
     <% end %>
 </div>
index 58830598f59ced25f4cf103951afb34f749858ad..669216e6af32763b0b06fe480a93fbc34f6f879a 100644 (file)
@@ -90,7 +90,7 @@ module Redmine
         menu_items_for(menu, project) do |node|
           links << render_menu_node(node, project)
         end
-        links.empty? ? nil : content_tag('ul', links.join("\n").html_safe)
+        links.empty? ? nil : content_tag('ul', links.join.html_safe)
       end
 
       def render_menu_node(node, project=nil)
index 9c6c7a47db3d0bbd926093d125595163235e7562..b247907ad13aa78d539212af98de923080c18b8a 100644 (file)
@@ -620,6 +620,13 @@ function setupAjaxIndicator() {
   });
 }
 
+function setupTabs() {
+  if($('.tabs').length > 0) {
+    displayTabsButtons();
+    $(window).resize(displayTabsButtons);
+  }
+}
+
 function hideOnLoad() {
   $('.hol').hide();
 }
@@ -677,3 +684,4 @@ $(document).ready(setupAjaxIndicator);
 $(document).ready(hideOnLoad);
 $(document).ready(addFormObserversForDoubleSubmit);
 $(document).ready(defaultFocus);
+$(document).ready(setupTabs);
index d69215108c4d2319c91eb2b020e1b0018ee9a7e7..e3f70d0a15381a65dd558101766fb02ea415a2fd 100644 (file)
@@ -10,7 +10,7 @@ h4 {border-bottom: 1px dotted #bbb;}
 pre, code {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace;}
 
 /***** 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 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%; }
 #quick-search {float:right;}
 
-#main-menu {position: absolute;  bottom: 0px;  left:6px; margin-right: -500px;}
-#main-menu ul {margin: 0;  padding: 0;}
+#main-menu {position: absolute;  bottom: 0px;  left:6px; margin-right: -500px; width: 100%;}
+#main-menu ul {margin: 0;  padding: 0; width: 100%; white-space: nowrap;}
 #main-menu li {
-  float:left;
+  float:none;
   list-style-type:none;
   margin: 0px 2px 0px 0px;
   padding: 0px 0px 0px 0px;
   white-space:nowrap;
+  display:inline-block;
 }
 #main-menu li a {
   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.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 li {margin: 0;  padding: 0 0 6px 0; list-style-type:none;}