]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1643 change layout format in database: "50%-50%" instead of "50-50"
authorsimonbrandhof <simon.brandhof@gmail.com>
Wed, 3 Nov 2010 12:51:28 +0000 (12:51 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Wed, 3 Nov 2010 12:51:28 +0000 (12:51 +0000)
sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/edit_layout.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb
sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb
sonar-server/src/main/webapp/stylesheets/dashboard.css

index 290a1499dee3fbc0e8f32be1d59e0f70164548db..6379054c6b8202a591e51855cfb95339f82ee488 100644 (file)
@@ -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
index 4e0c8146da805e306054adad02b20762963b07f2..6fe3e353130a156f9a918ef6a0a72623ba8762d6 100644 (file)
@@ -18,6 +18,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02\r
 #\r
 class Dashboard < ActiveRecord::Base\r
+\r
+  DEFAULT_LAYOUT='50%-50%'\r
+\r
   belongs_to :user\r
 \r
   has_many :widgets, :include => 'properties', :dependent => :delete_all\r
index bcb71d3b551b3d8c572e5ea2e7fb8d059f5fd84f..3917a3d47365671694550b4d9cec3844e3a88321 100644 (file)
@@ -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>
 
     <%
index 3dcb0ad4d025789bd3e55829e432acdda54cb131..02ec1c72596bc39377614b9bed0781f48baf1aff 100644 (file)
@@ -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>
index 8902604dea92f488d707631c7e8e3d4273b2f9ff..1e6d6f9e9be418bb1f0ba807935e8dbda3308a9b 100644 (file)
@@ -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 }
index ffaaecf0ea62fdf9f6116dd1458ae7675fdef533..0ec89239ecf6a81f96b2e00a29fe30db002ffaaa 100755 (executable)
@@ -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)
index 0be73d2e8a5c5ee62dcee21536aceaad4c52cb40..5b935b7b576b525f02ea2c88bccbecfb786fdb13 100644 (file)
   float: left;
   margin: 0;
   padding: 0;
+  clear: right;
 }
 
 #dashboard .column-handle {