From cef0256eb03e86d6a2963e384e65f79132a182eb Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Sun, 27 Feb 2011 21:55:27 +0100 Subject: [PATCH] SONAR-2218 experimental page to display sources --- .../webapp/WEB-INF/app/models/project_measure.rb | 15 +++++++++++++++ .../main/webapp/WEB-INF/app/models/snapshot.rb | 1 + .../src/main/webapp/WEB-INF/config/routes.rb | 1 + 3 files changed, 17 insertions(+) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb index c95f03ad08a..54675821f79 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb @@ -61,6 +61,21 @@ class ProjectMeasure < ActiveRecord::Base end end + def data_as_line_distribution + @line_distribution ||= + begin + hash={} + if data + parts=data.split(';') + parts.each do |part| + fields=part.split('=') + hash[fields[0].to_i]=fields[1] + end + end + hash + end + end + def formatted_value if metric.nil? return value.to_s diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb index bed213aed75..023f0ecd2d3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb @@ -33,6 +33,7 @@ class Snapshot < ActiveRecord::Base has_many :events, :dependent => :destroy, :order => 'event_date DESC' has_one :source, :class_name => 'SnapshotSource', :dependent => :destroy + has_many :violations, :class_name => 'RuleFailure' has_many :async_measure_snapshots has_many :async_measures, :through => :async_measure_snapshots diff --git a/sonar-server/src/main/webapp/WEB-INF/config/routes.rb b/sonar-server/src/main/webapp/WEB-INF/config/routes.rb index 1eb2b53a1f4..86ceed337c7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/config/routes.rb +++ b/sonar-server/src/main/webapp/WEB-INF/config/routes.rb @@ -25,6 +25,7 @@ ActionController::Routing::Routes.draw do |map| map.resources 'rules', :path_prefix => 'api', :controller => 'api/rules' map.resources 'properties', :path_prefix => 'api', :controller => 'api/properties', :requirements => { :id => /.*/ } + map.connect 'browse/:id', :controller => 'browse', :action => 'index', :requirements => { :id => /.*/ } # home page map.home '', :controller => 'filters', :action => 'index' -- 2.39.5