@extension=@extensions.find{|extension| extension.isDefaultTab()} if @extension==nil
end
- def load_sources(use_scm_for_periods=true)
+ def load_sources
@period = params[:period].to_i unless params[:period].blank?
- @display_scm=(params[:scm]=='true')
@expanded=(params[:expand]=='true')
if @snapshot.source
source_lines=Java::OrgSonarServerUi::JRubyFacade.new.colorizeCode(@snapshot.source.data, @snapshot.project.language).split("\n")
- init_scm((@period && use_scm_for_periods) || @display_scm)
+ init_scm()
@lines=[]
source_lines.each_with_index do |source, index|
end
end
- def init_scm(scm)
+ def init_scm
@scm_available=(@snapshot.measure('last_commit_datetimes_by_line')!=nil)
- if scm
- @authors_by_line=load_distribution('authors_by_line')
- @revisions_by_line=load_distribution('revisions_by_line')
- @dates_by_line=load_distribution('last_commit_datetimes_by_line')
- else
- @authors_by_line={}
- @revisions_by_line={}
- @dates_by_line={}
- end
+ @authors_by_line=load_distribution('authors_by_line')
+ @revisions_by_line=load_distribution('revisions_by_line')
+ @dates_by_line=load_distribution('last_commit_datetimes_by_line')
end
def load_distribution(metric_key)
end
def render_coverage
- load_sources(true)
+ load_sources()
@display_coverage=true
if @lines
@hits_by_line=load_distribution('coverage_line_hits_data')
def render_violations
- load_sources(false)
+ load_sources()
@display_violations=true
@global_violations=[]
@expandable=(@lines!=nil)
def render_source
- load_sources(true)
+ load_sources()
filter_lines_by_date()
render :action => 'index', :layout => !request.xhr?
end
<table>
<tr>
- <% first=true %>
- <% if @scm_available %>
- <td class="<%= 'first' if first -%>">
- <input type="checkbox" value="true" name="scm" id="scm" <%= 'checked' if @display_scm -%> onclick="applyOptions()"/>
- <label for="scm">Show commits</label>
- </td>
- <% first=false
- end %>
-
- <% if @expandable %>
+ <%
+ first=true
+ if @expandable %>
<td class="<%= 'first' if first -%>">
<input type="checkbox" value="true" name="expand" id="expand" <%= 'checked' if @expanded -%> onclick="applyOptions()"/>
<label for="expand">Show full source</label>
end
%>
<tr>
- <% if @display_scm
+ <%
if current_revision!=line.revision
current_revision=line.revision
title = "Revision #{h(line.revision)} ยป #{l(line.datetime) if line.datetime}"
<td class="scm revision"><span class="date"><a href="#" title="<%= title -%>" alt="<%= title -%>"><%= l(line.date) if line.date -%></a></span> <span class="author"><%= h(line.author) -%></span></td>
<% else %>
<td class="scm"></td>
- <% end
- end %>
+ <% end %>
<td class="lid <%= ' section' if line.violations? -%>" id="L<%= index+1 -%>"><a name="L<%= index+1 -%>" href="#L<%= index+1 -%>"><%= index + 1 -%></a></td>
<% if @display_coverage %>