super(filter, options)
@size_metric = Metric.by_key(@filter.criteria('tmSize')||'ncloc')
- @color_metric = Metric.by_key(@filter.criteria('tmColor')||'violations_density')
+ @color_metric = Metric.by_key(@filter.criteria('tmColor'))
@html_id = options[:html_id]
@filter.metrics=([@size_metric, @color_metric].compact)
@height = (@filter.criteria('tmHeight')||'600').to_i
@id_count = 0
- filter.set_criteria_value('sort', "metric:#{@size_metric.key}")
+ filter.set_criteria_value('sort', "metric:#{@size_metric.key}") if @size_metric
filter.set_criteria_value('asc', 'true')
filter.pagination.per_page = 500
filter.pagination.page = 1
private
def build_tree(node)
- if @filter.results
+ if @filter.results && @size_metric
@filter.results.each do |result|
size_measure=result.measure(@size_metric)
if size_measure
<span class="note"><%= human_short_date s.created_at -%></span>
<div style="width: 100%; text-align: center;">
- <a href="#" onclick="removeFromList(<%= index -%>, $j('#sids'))"><img src="<%= ApplicationController.root_context -%>/images/controls/cross.png" title="<%= message('comparison.remove_resource') -%>"/></a>
+ <a href="#" onclick="removeFromList(<%= index -%>, $j('#sids'))"><img src="<%= ApplicationController.root_context -%>/images/cross-gray.png" title="<%= message('comparison.remove_resource') -%>"/></a>
</div>
</td>
<td class="thin" style="vertical-align: bottom;">
<% if index < last_index %>
<a href="#" onclick="moveDown(<%= index -%>)"><img src="<%= ApplicationController.root_context -%>/images/controls/move_down.png" title="<%= message('comparison.move_down') -%>"/></a>
<% end %>
- <a href="#" onclick="removeFromList(<%= index -%>, $j('#metrics'))"><img src="<%= ApplicationController.root_context -%>/images/controls/cross.png" title="<%= message('comparison.remove_metric') -%>"/></a>
+ <a href="#" onclick="removeFromList(<%= index -%>, $j('#metrics'))"><img src="<%= ApplicationController.root_context -%>/images/cross-gray.png" title="<%= message('comparison.remove_metric') -%>"/></a>
</div>
</td>
%>
<% if edit_mode %>
- <table class="data width100 admin">
+ <table class="spaced width100 admin">
<tr>
<td>
- <%= metric_select_tag 'metric', Metric.all.reject { |m| m.data? },
+ <%= metric_select_tag 'metric', Metric.all.reject { |m| m.hidden || m.data? },
:html_id => 'select-metric',
:allow_empty => true,
:key_prefix => 'metric:',
+<% if edit_mode %>
+ <table class="spaced width100 admin">
+ <tr>
+ <td valign="top" class="thin nowrap">
+ <span class="comments"><%= message('size') -%></span>
+ <br/>
+ <%= metric_select_tag 'tmSize', Metric.all.select { |m| m.treemap_size? },
+ :html_id => 'select-tm-size',
+ :selected_key => @filter.display.size_metric.key -%>
+ </td>
+ <td valign="top" class="thin nowrap">
+ <span class="comments"><%= message('color') -%></span>
+ <span id="tm-gradient" class="note"></span>
+ <br/>
+ <%= metric_select_tag 'tmColor', Metric.all.select { |m| m.treemap_color? },
+ :html_id => 'select-tm-color',
+ :allow_empty => true,
+ :selected_key => (@filter.display.color_metric ? @filter.display.color_metric.key : nil) -%>
+
+ <button id="update-treemap">Update</button>
+ </td>
+ <td class="right" valign="bottom">
+ <a href="#" class="button" id="exit-edit">Done</a>
+ </td>
+ </tr>
+ </table>
+ <% content_for :script do %>
+ <script>
+ $j(document).ready(function () {
+ $j("#update-treemap").on("click", function (e) {
+ var url = removeUrlAttr(decodeURI(window.location.href), 'tmSize');
+ url = removeUrlAttr(url, 'tmColor');
+ url += '&tmSize=' + $j('#select-tm-size').val();
+ var color = $j('#select-tm-color').val();
+ if (color != null && color != '') {
+ url += '&tmColor=' + color;
+ }
+ window.location = url;
+ });
+ $j("#exit-edit").on("click", function (e) {
+ window.location = removeUrlAttr(decodeURI(window.location.href), 'edit');
+ });
+ });
+ </script>
+ <% end %>
+<% end %>
+
<div class="treemap" style="width: 100%; height:<%= @filter.display.height %>px;">
<%= @filter.display.html -%>
</div>
\ No newline at end of file
<%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%>
</li>
- <% condition_metrics = Metric.all.select { |m| m.numeric? } %>
+ <% condition_metrics = Metric.all.select { |m| m.numeric? && !m.hidden } %>
<% for i in 1..3 %>
<li id="criteria-metric-<%= i -%>" style="<%= "display: none" if hidden_condition_indexes.include?(i) -%>">
<%= metric_select_tag "c#{i}_metric", condition_metrics, :allow_empty => true, :selected_key => @filter.criteria("c#{i}_metric"), :width => '100%', :placeholder => 'Metric' -%>
margin: 0;
padding: 0;
}
+ul.sidebar select, ul.sidebar input {
+ font-size: 93%;
+}
+
#logo {
text-align: center;
white-space: nowrap;
position: relative;
- /* sonar: reduce height */
+ /* sonar: reduce height and font-size */
height: 20px;
line-height: 20px;
+ font-size: 93%;
padding: 0 0 0 8px;
color: #444;
text-decoration: none;