aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb
blob: bcb71d3b551b3d8c572e5ea2e7fb8d059f5fd84f (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
<script type="text/javascript">
    <!--
    var options = {
        editorEnabled: true,
        portal: 'dashboard',
        column: 'dashboard-column',
        columnhandle: 'column-handle',
        block: 'block',
        handle: 'none',
        hoverclass: 'block-hover',
        dashboardstate: 'dashboardstate',
        toggle: 'block-toggle',
        blocklist: 'widget_defs',
        highlight_duration: 2,
        highlight_startcolor: '#cae3f2',
        highlight_endcolor: '#ffffff',
        saveurl: '<%= url_for :action => 'set_dashboard', :did => @dashboard.id, :id => @resource.id -%>'
    };
    var portal;
    function init_dashboard() {
      portal = new Portal(options);
      <% if params[:highlight] %>
      portal.highlightWidget(<%= params[:highlight] -%>);
      <% end %>
    }
    Event.observe(window, 'load', init_dashboard, false);
    //-->
</script>


<div id="dashboard">
  <%= render :partial => 'dashboard/header', :locals => {:back => true} %>

  <div id="widget_defs">
    <table width="100%">
    <% @widget_definitions.each_with_index do |definition, index| %>
      <% if index%4==0 %><tr><% end %>
        <%= render :partial => 'dashboard/widget_definition', :locals => {:definition => definition} %>
      <% if index%4==3 %></tr><% end %>
    <% end %>
    <% if @widget_definitions.size%4<3 %></tr><% end %>
    </table>
  </div>


  <%
    columns=@dashboard.column_layout.split('-')
    for index in 1..columns.size()
  %>
    <div class="dashboard-column-wrapper" style="width: <%= (columns.size()>0) ? columns[index-1].to_i : 100 %>%; clear: right;">
    <div class="dashboard-column" id="dashboard-column-<%= index -%>" style="margin: 0px <%= index<columns.size() ? "5px" : "0px" %> 0px <%= index>1 ? "5px" : "0px" %>;">
      <div class="column-handle" style="display: none"> </div>

    <%
      @dashboard.widgets.select{|widget| widget.column_index==index}.sort_by{|widget| widget.row_index}.each do |widget|
        widget_definition=@widget_definitions.find{|wd| wd.getId()==widget.widget_key }
        if widget_definition
    %>
        <div class="block" id="block_<%= widget.id -%>">
          <%= render :partial => 'dashboard/configure_widget', :locals => {:widget => widget,  :definition => widget_definition} %>
        </div>
    <%
        end
      end
    %>
      </div>
    </div>
  <% end %>
  <div style="clear: both;"></div>
</div>