From ccfb41a2957432447cd21fcdba764f00b1090f15 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Wed, 16 Mar 2011 15:00:54 +0100 Subject: [PATCH] Remove the select-box 'show commits' --- .../app/controllers/resource_controller.rb | 25 +++++++------------ .../app/views/resource/_options.html.erb | 13 +++------- .../WEB-INF/app/views/resource/index.html.erb | 5 ++-- 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb index afcc3f2722e..0ebc8b8be8f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb @@ -73,14 +73,13 @@ class ResourceController < ApplicationController @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| @@ -96,17 +95,11 @@ class ResourceController < ApplicationController 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) @@ -115,7 +108,7 @@ class ResourceController < ApplicationController end def render_coverage - load_sources(true) + load_sources() @display_coverage=true if @lines @hits_by_line=load_distribution('coverage_line_hits_data') @@ -149,7 +142,7 @@ class ResourceController < ApplicationController def render_violations - load_sources(false) + load_sources() @display_violations=true @global_violations=[] @expandable=(@lines!=nil) @@ -205,7 +198,7 @@ class ResourceController < ApplicationController def render_source - load_sources(true) + load_sources() filter_lines_by_date() render :action => 'index', :layout => !request.xhr? end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb index 87460906560..1e86caee7c8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb @@ -23,16 +23,9 @@ - <% first=true %> - <% if @scm_available %> - - <% first=false - end %> - - <% if @expandable %> + <% + first=true + if @expandable %> - <% if @display_scm + <% if current_revision!=line.revision current_revision=line.revision title = "Revision #{h(line.revision)} » #{l(line.datetime) if line.datetime}" @@ -69,8 +69,7 @@ <% else %> - <% end - end %> + <% end %> <% if @display_coverage %> -- 2.39.5
- onclick="applyOptions()"/> - - onclick="applyOptions()"/> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb index 6e9b128b19a..1f51b7c26c7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb @@ -61,7 +61,7 @@ end %>
<%= l(line.date) if line.date -%> <%= h(line.author) -%><%= index + 1 -%>