aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-02-27 21:55:27 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-02-27 21:55:27 +0100
commitcef0256eb03e86d6a2963e384e65f79132a182eb (patch)
tree64da0601d66c8e65f48673591a756d9645a7e7d7 /sonar-server
parent4bb50d01dcb3e31939bb1bdaa646c971664ab7a8 (diff)
downloadsonarqube-cef0256eb03e86d6a2963e384e65f79132a182eb.tar.gz
sonarqube-cef0256eb03e86d6a2963e384e65f79132a182eb.zip
SONAR-2218 experimental page to display sources
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb15
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/config/routes.rb1
3 files changed, 17 insertions, 0 deletions
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'