0001-Apply-existing-tab-functionality-to-main-menu.patch

Felix Gliesche, 2015-09-01 19:18

Download (4.56 KB)

View differences:

app/views/common/_tabs.html.erb
13 13
  </div>
14 14
</div>
15 15

  
16
<script>
17
  $(document).ready(displayTabsButtons);
18
  $(window).resize(displayTabsButtons);
19
</script>
20

  
21 16
<% tabs.each do |tab| -%>
22 17
  <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ),
23 18
                       :id => "tab-content-#{tab[:name]}",
app/views/layouts/base.html.erb
44 44
    <h1><%= page_header_title %></h1>
45 45

  
46 46
    <% if display_main_menu?(@project) %>
47
    <div id="main-menu">
47
    <div id="main-menu" class="tabs">
48 48
        <%= render_main_menu(@project) %>
49
        <div class="tabs-buttons" style="display:none;">
50
            <button class="tab-left" onclick="moveTabLeft(this); return false;"></button>
51
            <button class="tab-right" onclick="moveTabRight(this); return false;"></button>
52
        </div>
49 53
    </div>
50 54
    <% end %>
51 55
</div>
lib/redmine/menu_manager.rb
90 90
        menu_items_for(menu, project) do |node|
91 91
          links << render_menu_node(node, project)
92 92
        end
93
        links.empty? ? nil : content_tag('ul', links.join("\n").html_safe)
93
        links.empty? ? nil : content_tag('ul', links.join.html_safe)
94 94
      end
95 95

  
96 96
      def render_menu_node(node, project=nil)
public/javascripts/application.js
609 609
  });
610 610
}
611 611

  
612
function setupTabs() {
613
  if($('.tabs').length > 0) {
614
    displayTabsButtons();
615
    $(window).resize(displayTabsButtons);
616
  }
617
}
618

  
612 619
function hideOnLoad() {
613 620
  $('.hol').hide();
614 621
}
......
655 662
$(document).ready(hideOnLoad);
656 663
$(document).ready(addFormObserversForDoubleSubmit);
657 664
$(document).ready(defaultFocus);
665
$(document).ready(setupTabs);
public/stylesheets/application.css
10 10
pre, code {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace;}
11 11

  
12 12
/***** Layout *****/
13
#wrapper {background: white;}
13
#wrapper {background: white;overflow: hidden;}
14 14

  
15 15
#top-menu {background: #3E5B76; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 2px 0px 6px;}
16 16
#top-menu ul {margin: 0;  padding: 0;}
......
31 31
#header h1 a.ancestor { font-size: 80%; }
32 32
#quick-search {float:right;}
33 33

  
34
#main-menu {position: absolute;  bottom: 0px;  left:6px; margin-right: -500px;}
35
#main-menu ul {margin: 0;  padding: 0;}
34
#main-menu {position: absolute;  bottom: 0px;  left:6px; margin-right: -500px; width: 100%;}
35
#main-menu ul {margin: 0;  padding: 0; width: 100%; white-space: nowrap;}
36 36
#main-menu li {
37
  float:left;
37
  float:none;
38 38
  list-style-type:none;
39 39
  margin: 0px 2px 0px 0px;
40 40
  padding: 0px 0px 0px 0px;
41 41
  white-space:nowrap;
42
  display:inline-block;
42 43
}
43 44
#main-menu li a {
44 45
  display: block;
......
50 51
}
51 52
#main-menu li a:hover {background:#759FCF; color:#fff;}
52 53
#main-menu li a.selected, #main-menu li a.selected:hover {background:#fff; color:#555;}
54
#main-menu .tabs-buttons {
55
  right: 6px;
56
  background-color: transparent;
57
  border-bottom-color: transparent;
58
}
53 59

  
54 60
#admin-menu ul {margin: 0;  padding: 0;}
55 61
#admin-menu li {margin: 0;  padding: 0 0 6px 0; list-style-type:none;}
56
-