aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
blob: 013e9a882fc9e43d699f9e55c4fae8cdcbcc90bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<%
   selected_section = controller.class::SECTION if defined?(controller.class::SECTION)
   if selected_section==Navigation::SECTION_RESOURCE && !@project && !@resource
     selected_section = Navigation::SECTION_HOME
   end
   @project=@resource unless @project || selected_section==Navigation::SECTION_HOME
   period_param = "period=#{u(params[:period])}" if params[:period]
%>
<div id="container">
  <%= yield :header -%>
  <div id="hd">
    <div id="nav-left">
      <ul>
        <li>
          <a href="<%= ApplicationController.root_context -%>/"><%= message('layout.dashboards') -%></a>
        </li>
        <%= render 'layouts/menu_projects' -%>
        <li>
          <a href="<%= ApplicationController.root_context -%>/measures"><%= message('layout.measures') -%></a>
        </li>
        <li>
          <a href="<%= ApplicationController.root_context -%>/issues/index"><%= message('issues.page') -%></a>
        </li>
        <li>
          <a href="<%= ApplicationController.root_context -%>/profiles"><%= message('quality_profiles.page') -%></a>
        </li>
      </ul>
    </div>
    <div id="nav">
      <ul>
        <li>
          <input type="text" size="15" name="search" id="searchInput" onFocus="autocompleteResources()" value="<%= message('search_verb') -%>"/>
          <img src="<%= ApplicationController.root_context -%>/images/loading-small.gif" id="searchingResources" style="display:none">
        </li>
        <% if logged_in? %>
          <%= render 'layouts/menu_user' -%>
        <% else %>
          <li><a href="<%= ApplicationController.root_context -%>/sessions/new?return_to=<%= u (request.request_uri) -%>"><%= message('layout.login') -%></a></li>
        <% end %>
        <%= render 'layouts/menu_administration' -%>
      </ul>
    </div>
    <div id="searchResourcesResults" class="autocomplete" style="display:none"></div>
  </div>
  <%= render 'layouts/breadcrumb' if @breadcrumbs || selected_section==Navigation::SECTION_RESOURCE -%>
  <div id="body">
    <% if selected_section && (!@hide_sidebar) %>
      <div id="sidebar">
        <ul class="sidebar blue-sidebar">
          <% if selected_section==Navigation::SECTION_HOME %>
            <% ActiveDashboard.user_dashboards(current_user, true).each do |active_dashboard| %>
              <li class="<%= 'active' if @dashboard && controller.controller_path=='dashboard' && active_dashboard.dashboard_id==@dashboard.id -%>">
                <a href="<%= ApplicationController.root_context -%>/dashboard/?did=<%= active_dashboard.dashboard_id -%>"><%= active_dashboard.dashboard.name(true) -%></a>
              </li>
            <% end %>

            <% controller.java_facade.getPages(Navigation::SECTION_HOME, nil, nil, nil, nil).each do |page|
              page_url = (page.isController() ? page.getId() : "/plugins/home/#{page.getId()}")
              selected=request.request_uri.include?("/plugins/home/#{page_url}")
            %>
              <li class="<%= 'active' if selected -%>">
                <a href="<%= ApplicationController.root_context -%><%= page_url -%>"><%= message(page.getId() + '.page', :default => page.getTitle()) -%></a></li>
            <% end %>

            <li class="spacer"></li>
            <li class="sidebar-title"><%= message('sidebar.tools') -%></li>

            <li class="<%= 'active' if controller.controller_path=='dependencies' -%>">
              <a href="<%= ApplicationController.root_context -%>/dependencies/index"><%= message('dependencies.page') -%></a></li>
            <li class="<%= 'active' if request.request_uri.include?('/comparison/index') -%>">
              <a href="<%= ApplicationController.root_context -%>/comparison/index"><%= message('comparison.page') -%></a>
            </li>

          <% elsif selected_section==Navigation::SECTION_RESOURCE %>
            <% ActiveDashboard.user_dashboards(current_user, false).each do |active_dashboard| %>
              <li class="<%= 'active' if @dashboard && controller.controller_path=='dashboard' && active_dashboard.dashboard_id==@dashboard.id -%>">
                <a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= @project.id -%>?did=<%= active_dashboard.dashboard_id -%><%= "&"+period_param if period_param -%>"><%= active_dashboard.dashboard.name(true) -%></a>
              </li>
            <% end %>
            <li class="spacer"></li>
            <li class="sidebar-title"><%= message('sidebar.tools') -%></li>
            <li class="<%= 'active' if request.request_uri.include?('/components/index') -%>">
              <a href="<%= ApplicationController.root_context -%>/components/index/<%= @project.id -%>"><%= message('components.page') -%></a>
            </li>
            <li class="<%= 'active' if request.request_uri.include?('/drilldown/issues') -%>">
              <a href="<%= ApplicationController.root_context -%>/drilldown/issues/<%= @project.id -%><%= "?"+period_param if period_param -%>"><%= message('issues_drilldown.page') -%></a>
            </li>
            <% controller.java_facade.getPages(Navigation::SECTION_RESOURCE, @project.scope, @project.qualifier, @project.language, @project.last_snapshot.metric_keys.to_java(:string)).each do |page|
              page_url = (page.isController() ? "#{page.getId()}?id=#{@project.id}" : "/plugins/resource/#{@project.id}?page=#{page.getId()}")
            %>
              <li class="<%= 'active' if request.request_uri.include?(page_url) -%>">
                <a href="<%= ApplicationController.root_context -%><%= page_url -%>"><%= message(page.getId() + '.page', :default => page.getTitle()) %></a>
              </li>
            <% end %>
            <li class="<%= 'active' if controller.controller_path=='cloud' -%>">
              <a href="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>"><%= message('clouds.page') -%></a>
            </li>
            <% if controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'comparable') %>
              <li class="<%= 'active' if request.request_uri.include?('/comparison/index') -%>">
                <a href="<%= ApplicationController.root_context -%>/comparison/index?resource=<%= @project.key -%>"><%= message('comparison.page') -%></a>
              </li>
            <% end %>


          <% elsif selected_section==Navigation::SECTION_CONFIGURATION %>

            <% if is_admin? %>

            <li class="sidebar-title"><%= message('sidebar.project_settings') -%></li>
            <li class="<%= 'active' if request.request_uri.include?('/settings') -%>">
              <a href="<%= ApplicationController.root_context -%>/settings/index"><%= message('settings.page') -%></a></li>
            <li class="<%= 'active' if controller.controller_path=='metrics' -%>">
              <a href="<%= ApplicationController.root_context -%>/metrics/index"><%= message('manual_metrics.page') -%></a></li>
            <li class="<%= 'active' if controller.controller_path=='manual_rules' -%>">
              <a href="<%= ApplicationController.root_context -%>/manual_rules/index"><%= message('manual_rules.page') -%></a></li>
            <li class="<%= 'active' if controller.controller_path=='admin_dashboards' -%>">
              <a href="<%= ApplicationController.root_context -%>/admin_dashboards/index"><%= message('default_dashboards.page') -%></a></li>
            <% controller.java_facade.getPages(Navigation::SECTION_CONFIGURATION, nil, nil, nil, nil).each do |page|
              page_url = (page.isController() ? page.getId() : "/plugins/configuration/#{page.getId()}")
            %>
              <li class="<%= 'active' if request.request_uri.include?(page_url) -%>">
                <a href="<%= ApplicationController.root_context -%><%= page_url -%>"><%= message(page.getId() + '.page', :default => page.getTitle()) %></a>
              </li>
            <% end %>
            <li class="spacer"></li>
            <li class="sidebar-title"><%= message('sidebar.security') -%></li>
            <li class="<%= 'active' if request.request_uri.include?('/users') -%>"><a href="<%= ApplicationController.root_context -%>/users"><%= message('users.page') -%></a>
            </li>
            <li class="<%= 'active' if request.request_uri.include?('/groups') -%>">
              <a href="<%= ApplicationController.root_context -%>/groups/index"><%= message('user_groups.page') -%></a></li>
            <li class="<%= 'active' if request.request_uri.include?('/roles/global') -%>">
              <a href="<%= ApplicationController.root_context -%>/roles/global"><%= message('global_permissions.page') -%></a></li>
            <li class="<%= 'active' if request.request_uri.include?('/roles/projects') || request.request_uri.include?('/permission_templates') -%>">
              <a href="<%= ApplicationController.root_context -%>/roles/projects"><%= message('roles.page') -%></a></li>

            <li class="spacer"></li>
            <li class="sidebar-title"><%= message('sidebar.system') -%></li>
            <li class="<%= 'active' if controller.controller_path=='backup' -%>"><a href="<%= ApplicationController.root_context -%>/backup"><%= message('backup.page') -%></a>
            </li>
            <li class="<%= 'active' if controller.controller_path=='bulk_deletion' -%>">
              <a href="<%= ApplicationController.root_context -%>/bulk_deletion"><%= message('bulk_deletion.page') -%></a>
            </li>
            <% update_center_activated = controller.java_facade.getSettings().getBoolean('sonar.updatecenter.activate')
               if update_center_activated %>
              <li class="<%= 'active' if controller.controller_path=='updatecenter' -%>">
                <a href="<%= ApplicationController.root_context -%>/updatecenter"><%= message('update_center.page') -%></a></li>
              <li class="<%= 'active' if controller.controller_path=='system' -%>">
                <a href="<%= ApplicationController.root_context -%>/system"><%= message('system_info.page') -%></a></li>
            <% end %>

            <% end #of admin part %>

          <% end %>

          <%= yield :sidebar %>
          <li id="logo">
            <center><a href="http://www.sonarqube.org/" target="SonarSource"><%= image_tag('sonarqube-24x100.png', :alt => message('layout.sonar.slogan'), :width => 100, :height => 24) -%></a></center>
          </li>
        </ul>
      </div>
    <% end %>
    <%
      html_id_class = ''
      html_id_class = "id='content' class='with_sidebar'" if selected_section
      html_id_class = "id='content'" if @hide_sidebar
    %>
    <div <%= html_id_class -%>>
      <% if @project %>
        <div class="print"><h2><%= h @project.name(true) %></h2></div>
      <% end %>
      <div class="error" id="error" style="display:none">
        <span id="errormsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('error').hide();return false;"><%= message('hide').downcase -%></a>]
      </div>
      <div class="notice" id="info" style="display:none">
        <span id="infomsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('info').hide();return false;"><%= message('hide').downcase -%></a>]
      </div>
      <div class="warning" id="warning" style="display:none">
        <span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('warning').hide();return false;"><%= message('hide').downcase -%></a>]
      </div>
      <%= yield %>
    </div>
  </div>
</div>

<% unless params[:hd]=='false' %>
  <%= yield :footer %>
  <div id="footer">
    <% controller.java_facade.getWebFooters().each do |footer| %>
      <% if footer.getHtml() %>
        <div><%= footer.getHtml().to_s %></div>
      <% end %>
    <% end %>
    <div id="ftlinks">
      <div>SonarQube&trade; technology is powered by <a href="http://www.sonarsource.com" target="SonarSource SA">SonarSource SA</a></div>
      <div>
        Version <%= sonar_version -%> -
        <a href="http://www.sonarqube.org" target="sonar">Community</a> -
        <a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> -
        <a href="http://www.sonarqube.org/support" target="support">Get Support</a> -
        <a href="http://sonar-plugins.codehaus.org" target="plugins">Plugins</a>
        <% unless DatabaseVersion.production? %>
          <br/><span class="yellowHighlight" id="evaluation_warning">Embedded database should be used for evaluation purpose only</span>
        <% end %>
      </div>
      <!--[if lte IE 7]><br/><span class="ie-warn">Your web browser is outdated. This website may not display correctly.</span><![endif]-->
    </div>
  </div>
<% end %>