aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb
blob: 030231d857042fe4576c1a3c5c7f9ec2ba405397 (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
<div id="source_options">
  <script>
    applyOptions=function() {
      $('resource-loading').show();
      <% if request.xhr? %>
        var params = Form.serialize($('options-form'));
        new Ajax.Updater('resource_container', '<%= url_for :controller => 'browse', :id => @resource.key -%>', {asynchronous:true, parameters:params});
        return true;
      <% else %>
        $('options-form').submit();
        return false;
      <% end %>
    };
  </script>
  <form method="GET" action="<%= url_for :controller => 'browse', :id => @resource.key -%>" id="options-form">
    <input type="hidden" name="tab" value="<%= params[:tab] -%>"/>
    <input type="hidden" name="metric" value="<%= params[:metric] -%>"/>
    <input type="hidden" name="period" value="<%= params[:period] -%>"/>

    <% if @scm_available %>
      <input type="checkbox" value="true" name="scm" id="scm" <%= 'checked' if @display_scm -%> onclick="applyOptions()"/>
      <label for="scm">Show commits</label><br/>
    <% end %>

    <% if @snapshot.project_snapshot.periods? %>
      <select id="period" name="period" class="small" onchange="applyOptions()">
        <option value="">Time changes...</option>
        <%= period_select_options(@snapshot, 1) -%>
        <%= period_select_options(@snapshot, 2) -%>
        <%= period_select_options(@snapshot, 3) -%>
        <%= period_select_options(@snapshot, 4) -%>
        <%= period_select_options(@snapshot, 5) -%>
      </select>
      <br/>
    <% end %>

    <% if @expandable %>
      <input type="checkbox" value="true" name="expand" id="expand" <%= 'checked' if @expanded -%> onclick="applyOptions()"/>
      <label for="expand">Expand</label>
      <br/>
    <% end %>

    <%= render :partial => 'rules_filter' if @display_violations -%>
  </form>
</div>