return nil if snapshot.nil? || snapshot.project_snapshot.nil?
mode=snapshot.project_snapshot.send "period#{period_index}_mode"
mode_param=snapshot.project_snapshot.send "period#{period_index}_param"
+ date=snapshot.project_snapshot.send "period#{period_index}_date"
label=nil
if mode
if mode=='days'
label = "over %s days" % mode_param
elsif mode=='version'
- label = "since version %s" % mode_param
+ label = "since version %s (%s)" % [mode_param, l(date)]
elsif mode=='previous_analysis'
- label = "since previous analysis (%s)" % localize(Date.parse(mode_param))
+ label = "since previous analysis (%s)" % l(date)
elsif mode=='date'
- label = "since #{localize(Date.parse(mode_param))}"
+ label = "since #{localize(date)}"
end
end
label
<script>
var treemap_width = $('treemap').getDimensions().width - 15;
var treemap_height = document.viewport.getDimensions().height - 220;
- function load_treemap(size_metric, color_metric, hide_form, period_index) {
+ function load_treemap(size_metric, color_metric, hide_form) {
$('treemap_loading').show();
$('treemap').hide();
- <%= remote_function :update => 'treemap', :url => {:action => 'treemap', :id => @filter.id, :show_periods => true},
+ <%= remote_function :update => 'treemap', :url => {:action => 'treemap', :id => @filter.id},
:complete => "$('treemap_loading').hide();$('treemap').show();",
- :with => "'width=' + treemap_width + '&height=' + treemap_height + '&size_metric=' + size_metric + '&color_metric=' + color_metric + '&hide_form=' + hide_form + '&period=' + period_index" %>
+ :with => "'width=' + treemap_width + '&height=' + treemap_height + '&size_metric=' + size_metric + '&color_metric=' + color_metric + '&hide_form=' + hide_form" %>
}
- load_treemap('<%= size_metric.key -%>', '<%= color_metric.key -%>', <%= edit_mode -%>, <%= params[:period].to_i -%>);
+ load_treemap('<%= size_metric.key -%>', '<%= color_metric.key -%>', <%= edit_mode -%>);
</script>
<% end %>
\ No newline at end of file
<%= select_tag 'color_metric', options_grouped_by_domain(Sonar::TreemapBuilder.color_metrics, @color_metric.key),
:id => 'color_metric', :class => 'small', :onchange => "load_treemap(this.form.size_metric.value,this.form.color_metric.value, false);return false;" %>
</td>
- <% if params[:show_periods]=='true' %>
- <td class="sep"> </td>
- <td>
- <span class="comments">Period:</span>
- <br/>
- <select name="period" onchange="submit()" class="small">
- <option value="">None</option>
- <% period_names.each_with_index do |name, index| %>
- <option value="<%= index+1 -%>" <%= 'selected' if params[:period].to_i==index+1 -%>><%= name -%></value>
- <% end %>
- </select>
- </td>
- <% end %>
</tr>
</table>
</form>