aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-11-03 12:51:28 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-11-03 12:51:28 +0000
commitb13bcac76a651dbcf35cad5d216464719559dc26 (patch)
tree3d289a3e74c03475856486ddae06d7339f19acc4 /sonar-server
parent48f63df9e3f03edaf762b32e988a24e69ca54604 (diff)
downloadsonarqube-b13bcac76a651dbcf35cad5d216464719559dc26.tar.gz
sonarqube-b13bcac76a651dbcf35cad5d216464719559dc26.zip
SONAR-1643 change layout format in database: "50%-50%" instead of "50-50"
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/edit_layout.html.erb30
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb4
-rwxr-xr-xsonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb2
-rw-r--r--sonar-server/src/main/webapp/stylesheets/dashboard.css1
7 files changed, 25 insertions, 21 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
index 290a1499dee..6379054c6b8 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
@@ -171,7 +171,7 @@ class DashboardsController < ApplicationController
dashboard.description=params[:description]
dashboard.shared=(params[:shared].present? && is_admin?)
dashboard.user_id=current_user.id
- dashboard.column_layout='50-50' if !dashboard.column_layout
+ dashboard.column_layout=Dashboard::DEFAULT_LAYOUT if !dashboard.column_layout
end
def add_default_dashboards_if_first_user_dashboard
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb
index 4e0c8146da8..6fe3e353130 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb
@@ -18,6 +18,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
#
class Dashboard < ActiveRecord::Base
+
+ DEFAULT_LAYOUT='50%-50%'
+
belongs_to :user
has_many :widgets, :include => 'properties', :dependent => :delete_all
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb
index bcb71d3b551..3917a3d4736 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb
@@ -47,8 +47,8 @@
columns=@dashboard.column_layout.split('-')
for index in 1..columns.size()
%>
- <div class="dashboard-column-wrapper" style="width: <%= (columns.size()>0) ? columns[index-1].to_i : 100 %>%; clear: right;">
- <div class="dashboard-column" id="dashboard-column-<%= index -%>" style="margin: 0px <%= index<columns.size() ? "5px" : "0px" %> 0px <%= index>1 ? "5px" : "0px" %>;">
+ <div class="dashboard-column-wrapper" style="width: <%= columns[index-1] -%>">
+ <div class="dashboard-column" id="dashboard-column-<%= index -%>" style="margin: 0px <%= index<columns.size() ? "5px" : "0px" -%> 0px <%= index>1 ? "5px" : "0px" -%>;">
<div class="column-handle" style="display: none"> </div>
<%
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/edit_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/edit_layout.html.erb
index 3dcb0ad4d02..02ec1c72596 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/edit_layout.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/edit_layout.html.erb
@@ -3,25 +3,25 @@
<div id="edit-layout" class="admin">
<p class="note">Click to choose the layout: </p><br/>
- <!--100%-->
- <div class="select-layout <%= 'selected' if @dashboard.layout=='100' -%>" style="text-align:center;width: 20%;">
- <%= link_to image_tag('layout100.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "100"}, :method => :post %>
+
+ <div class="select-layout <%= 'selected' if @dashboard.layout=='100%' -%>" style="text-align:center;width: 20%;">
+ <%= link_to image_tag('layout100.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "100%"}, :method => :post %>
</div>
- <!--50%-50%-->
- <div class="select-layout <%= 'selected' if @dashboard.layout=="50-50" -%>" style="text-align:center;width: 20%;">
- <%= link_to image_tag('layout5050.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "50-50"}, :method => :post %>
+
+ <div class="select-layout <%= 'selected' if @dashboard.layout=="50%-50%" -%>" style="text-align:center;width: 20%;">
+ <%= link_to image_tag('layout5050.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "50%-50%"}, :method => :post %>
</div>
- <!--30%-70%-->
- <div class="select-layout <%= 'selected' if @dashboard.layout=="30-70" -%>" style="text-align:center;width: 20%;">
- <%= link_to image_tag('layout3070.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "30-70"}, :method => :post %>
+
+ <div class="select-layout <%= 'selected' if @dashboard.layout=="30%-70%" -%>" style="text-align:center;width: 20%;">
+ <%= link_to image_tag('layout3070.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "30%-70%"}, :method => :post %>
</div>
- <!--70%-30%-->
- <div class="select-layout <%= 'selected' if @dashboard.layout=="70-30" -%>" style="text-align:center;width: 20%;">
- <%= link_to image_tag('layout7030.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "70-30"}, :method => :post %>
+
+ <div class="select-layout <%= 'selected' if @dashboard.layout=="70%-30%" -%>" style="text-align:center;width: 20%;">
+ <%= link_to image_tag('layout7030.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "70%-30%"}, :method => :post %>
</div>
- <!--33%-33%-33%-->
- <div class="select-layout <%= 'selected' if @dashboard.layout=="33-33-33" -%>" style="text-align:center;width: 19%;">
- <%= link_to image_tag('layout333333.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "33-33-33"}, :method => :post %>
+
+ <div class="select-layout <%= 'selected' if @dashboard.layout=="33%-33%-33%" -%>" style="text-align:center;width: 19%;">
+ <%= link_to image_tag('layout333333.png'), {:action => 'set_layout', :did => @dashboard.id, :id => @resource.id, :layout => "33%-33%-33%"}, :method => :post %>
</div>
<div style="clear:both;"></div>
</div>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb
index 8902604dea9..1e6d6f9e9be 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb
@@ -5,8 +5,8 @@
columns=@dashboard.column_layout.split('-')
for index in 1..columns.size()
%>
- <div class="dashboard-column-wrapper" style="width: <%= (columns.size()>0) ? columns[index-1].to_i : 100 %>%; clear: right;">
- <div class="dashboard-column" id="dashboard-column-<%= index -%>" style="margin: 0px <%= index<columns.size() ? "5px" : "0px" %> 0px <%= index>1 ? "5px" : "0px" %>;">
+ <div class="dashboard-column-wrapper" style="width: <%= columns[index-1] -%>; ">
+ <div class="dashboard-column" id="dashboard-column-<%= index -%>" style="margin: 0px <%= index<columns.size() ? "5px" : "0px" -%> 0px <%= index>1 ? "5px" : "0px" -%>;">
<%
@dashboard.widgets.select{|widget| widget.column_index==index}.sort_by{|widget| widget.row_index}.each do |widget|
widget_definition=@widget_definitions.find{|wd| wd.getId()==widget.widget_key }
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb
index ffaaecf0ea6..0ec89239ecf 100755
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb
@@ -65,7 +65,7 @@ class CreateDashboards < ActiveRecord::Migration
private
def self.create_dashboard
- dashboard=::Dashboard.new(:name => 'Dashboard', :shared => true, :description => 'Default dashboard', :column_layout => "50-50")
+ dashboard=::Dashboard.new(:name => 'Dashboard', :shared => true, :description => 'Default dashboard', :column_layout => Dashboard::DEFAULT_LAYOUT)
dashboard.widgets.build(:widget_key => 'static_analysis', :name => 'Static analysis', :column_index => 1, :row_index => 1, :configured => true)
dashboard.widgets.build(:widget_key => 'comments_duplications', :name => 'Comments duplications', :column_index => 1, :row_index => 2, :configured => true)
dashboard.widgets.build(:widget_key => 'extended_analysis', :name => 'Extended analysis', :column_index => 1, :row_index => 3, :configured => true)
diff --git a/sonar-server/src/main/webapp/stylesheets/dashboard.css b/sonar-server/src/main/webapp/stylesheets/dashboard.css
index 0be73d2e8a5..5b935b7b576 100644
--- a/sonar-server/src/main/webapp/stylesheets/dashboard.css
+++ b/sonar-server/src/main/webapp/stylesheets/dashboard.css
@@ -121,6 +121,7 @@
float: left;
margin: 0;
padding: 0;
+ clear: right;
}
#dashboard .column-handle {