]> source.dussan.org Git - sonarqube.git/commitdiff
Merge 'Configure Widgets' and 'Edit Layout'
authorDavid Gageot <david@gageot.net>
Sat, 5 May 2012 21:15:26 +0000 (23:15 +0200)
committerDavid Gageot <david@gageot.net>
Mon, 7 May 2012 05:18:14 +0000 (07:18 +0200)
12 files changed:
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_script_configure.html.erb [deleted file]
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 [deleted file]
sonar-server/src/main/webapp/images/layout100.png
sonar-server/src/main/webapp/images/layout3070.png
sonar-server/src/main/webapp/images/layout333333.png
sonar-server/src/main/webapp/images/layout5050.png
sonar-server/src/main/webapp/images/layout7030.png
sonar-server/src/main/webapp/stylesheets/dashboard.css

index e288c6ff182413e0a3cdb40338bca666e522190a..bc5866a6f20163725a1208e3e7a48c0287dbbd97 100644 (file)
@@ -517,7 +517,6 @@ dashboard.click_to_choose_layout=Click to choose the layout
 dashboard.cannot_render_widget_x=Can not render widget {0}: {1}
 dashboard.back_to_dashboard=Back to dashboard
 dashboard.configure_widgets=Configure widgets
-dashboard.edit_layout=Edit layout
 dashboard.manage_dashboards=Manage dashboards
 dashboard.add_widget=Add widget
 dashboard.please_configure_the_widget_x=Please configure the widget <b>{0}</b>.
index 9fff94fdb0cf6ff2299125d57c11c4a3edd55c10..057582779292264e6d1ca9b366e6151b8a79472d 100644 (file)
@@ -55,15 +55,6 @@ class DashboardController < ApplicationController
     end
   end
 
-  def edit_layout
-    load_resource()
-    load_dashboard()
-    load_widget_definitions(@dashboard)
-    unless @dashboard
-      redirect_to home_path
-    end
-  end
-
   def set_layout
     dashboard=Dashboard.find(params[:did])
     if dashboard.editable_by?(current_user)
@@ -75,7 +66,7 @@ class DashboardController < ApplicationController
         widget.save
       end
     end
-    redirect_to :action => 'edit_layout', :did => dashboard.id, :id => params[:id]
+    redirect_to :action => 'configure', :did => dashboard.id, :id => params[:id]
   end
 
   def set_dashboard
index 88350d6c99cea3c6c3087d9543e0eb6a79317643..fad3fe9d7c1a53bd53861a1e664d305ec25156a4 100644 (file)
@@ -6,7 +6,6 @@
       <% else %>
         <% if @dashboard.editable_by?(current_user) %>
           <li><%= link_to message('dashboard.configure_widgets'), dashboard_action(:configure) -%></li>
-          <li><%= link_to message('dashboard.edit_layout'), dashboard_action(:edit_layout) -%></li>
         <% end %>
         <li class="last"><%= link_to message('dashboard.manage_dashboards'), {:controller => :dashboards, :action => :index, :resource => (@resource.id if @resource)} -%></li>
       <% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_script_configure.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_script_configure.html.erb
deleted file mode 100644 (file)
index 2a3a58e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<script type="text/javascript">
-  <!--
-  var options = {
-    editorEnabled:true,
-    portal:'dashboard',
-    column:'dashboard-column',
-    columnhandle:'column-handle',
-    block:'block',
-    hoverclass:'block-hover',
-    handleClass:'widget-handle',
-    dashboardstate:'dashboardstate',
-    toggle:'block-toggle',
-    blocklist:'widget_defs',
-    highlight_duration:2,
-    highlight_startcolor:'#cae3f2',
-    highlight_endcolor:'#ffffff',
-    saveurl:'<%= url_for dashboard_action(:set_dashboard) -%>'
-  };
-  var portal;
-  function init_dashboard() {
-    portal = new Portal(options);
-  <% if params[:highlight] %>
-    portal.highlightWidget(<%= params[:highlight] -%>);
-  <% end %>
-  }
-  Event.observe(window, 'load', init_dashboard, false);
-
-  function filterWidgets(category) {
-    new Ajax.Updater(
-      'widget_defs',
-      '<%= add_category_to_url(url_for dashboard_action(:widget_definitions))  -%>' + encodeURIComponent(category),
-      {asynchronous:true, evalScripts:true});
-    $('filter-widgets-loading').show();
-    return false;
-  }
-  //-->
-</script>
index dcc59429cdeef842f524b4cececaf949bbbe0d66..13099c792318c17682eb6823f237af837f040238 100644 (file)
@@ -1,10 +1,25 @@
-<%= render :partial => 'script_configure' %>
-
 <div id="dashboard">
   <%= render :partial => 'header', :locals => {:back => true} %>
 
-  <div id="widget_defs">
-    <%= render :partial => 'widget_definitions', :locals => {:category => @category} -%>
+  <div id="configure">
+    <div id="widget_defs">
+      <%= render :partial => 'widget_definitions', :locals => {:category => @category} -%>
+    </div>
+
+    <div id="edit-layout">
+      <p><%= message('dashboard.click_to_choose_layout') -%>: </p>
+
+      <% {'100%', 'layout100.png',
+          '50%-50%', 'layout5050.png',
+          '30%-70%', 'layout3070.png',
+          '70%-30%', 'layout7030.png',
+          '33%-33%-33%', 'layout333333.png'
+         }.each_pair do |layout, picto| %>
+        <div class="select-layout <%= 'selected' if @dashboard.layout==layout -%>">
+          <%= link_to image_tag(picto), dashboard_action(:set_layout, :layout => layout), :method => :post %>
+        </div>
+      <% end %>
+    </div>
   </div>
 
   <%
       </div>
     </div>
   <% end %>
-  <div style="clear: both;"></div>
 </div>
+
+<script type="text/javascript">
+  <!--
+  var options = {
+    editorEnabled:true,
+    portal:'dashboard',
+    column:'dashboard-column',
+    columnhandle:'column-handle',
+    block:'block',
+    hoverclass:'block-hover',
+    handleClass:'widget-handle',
+    dashboardstate:'dashboardstate',
+    toggle:'block-toggle',
+    blocklist:'widget_defs',
+    highlight_duration:2,
+    highlight_startcolor:'#cae3f2',
+    highlight_endcolor:'#ffffff',
+    saveurl:'<%= url_for dashboard_action(:set_dashboard) -%>'
+  };
+  var portal;
+  function init_dashboard() {
+    portal = new Portal(options);
+  <% if params[:highlight] %>
+    portal.highlightWidget(<%= params[:highlight] -%>);
+  <% end %>
+  }
+  Event.observe(window, 'load', init_dashboard, false);
+
+  function filterWidgets(category) {
+    new Ajax.Updater(
+      'widget_defs',
+      '<%= add_category_to_url(url_for dashboard_action(:widget_definitions))  -%>' + encodeURIComponent(category),
+      {asynchronous:true, evalScripts:true});
+    $('filter-widgets-loading').show();
+    return false;
+  }
+  //-->
+</script>
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
deleted file mode 100644 (file)
index 21ce743..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<%= render :partial => 'script_configure' %>
-
-<div id="dashboard">
-  <%= render :partial => 'header', :locals => {:back => true} %>
-
-  <div id="edit-layout" class="admin">
-    <p class="note"><%= message('dashboard.click_to_choose_layout') -%>: </p><br/>
-
-    <% {'100%', 'layout100.png',
-        '50%-50%', 'layout5050.png',
-        '30%-70%', 'layout3070.png',
-        '70%-30%', 'layout7030.png',
-        '33%-33%-33%', 'layout333333.png'
-       }.each_pair do |layout, picto| %>
-      <div class="select-layout <%= 'selected' if @dashboard.layout==layout -%>" style="text-align:center;width: 20%;">
-        <%= link_to image_tag(picto), dashboard_action(:set_layout, :layout => layout), :method => :post %>
-      </div>
-    <% end %>
-
-    <div style="clear:both;"></div>
-  </div>
-
-  <div id="widget_defs" style="display: none;"></div>
-
-  <%
-     columns=@dashboard.column_layout.split('-')
-     for index in 1..columns.size()
-  %>
-    <div class="dashboard-column-wrapper" style="width: <%= columns[index-1] -%>;margin: 0 -1px 0 0;">
-      <div class="dashboard-column" id="dashboard-column-<%= index -%>" style="margin: 0 <%= index<columns.size() ? "5px" : "0px" -%> 0 <%= index>1 ? "5px" : "0px" -%>;">
-        <div class="column-handle" style="display: none"></div>
-
-        <%
-           @dashboard.widgets.select { |widget| widget.column_index==index && widget.java_definition }.sort_by { |widget| widget.row_index }.each do |widget|
-        %>
-          <div class="block" id="block_<%= widget.id -%>">
-            <%= render :partial => 'configure_widget', :locals => {:widget => widget} %>
-          </div>
-        <%
-           end
-        %>
-      </div>
-    </div>
-  <% end %>
-  <div style="clear: both;"></div>
-</div>
index 133f6c9d130a83770dd6afe1b7fcd746ede47802..102169320843033a224bab77cf4bfbb5db256fd3 100644 (file)
Binary files a/sonar-server/src/main/webapp/images/layout100.png and b/sonar-server/src/main/webapp/images/layout100.png differ
index 5a226881da345c0df0cefe7ebc30782c5509ade4..d862e953f2bba803c22e32d89ae73ab5a0b262e9 100644 (file)
Binary files a/sonar-server/src/main/webapp/images/layout3070.png and b/sonar-server/src/main/webapp/images/layout3070.png differ
index dfe7e5cb0aa3dcad99cfaad62faa8265adf0720a..1e1928a5267166095d1f0e78cb946ca7eb991842 100644 (file)
Binary files a/sonar-server/src/main/webapp/images/layout333333.png and b/sonar-server/src/main/webapp/images/layout333333.png differ
index 65b18dc1235e7eb363cceaea1b32c810e682e7b3..2f154a738a6f898f1cbc24ca563f7f0fbf6cfd65 100644 (file)
Binary files a/sonar-server/src/main/webapp/images/layout5050.png and b/sonar-server/src/main/webapp/images/layout5050.png differ
index e759a514f2388ee516abbd3bd91a7083c992782d..22393592f788597488b48d2d23cdab7ab4f8117c 100644 (file)
Binary files a/sonar-server/src/main/webapp/images/layout7030.png and b/sonar-server/src/main/webapp/images/layout7030.png differ
index f3efd9ce346762bbbe6b463bc52cc1b00b176bab..ef75713a52ac3037cc8a980a62f959134ea96eaf 100644 (file)
   z-index: 1000;
 }
 
-/* CONFIGURE LAYOUT */
-#dashboard .select-layout {
-  text-align: center;
-  float: left;
-  margin: 0;
-  padding: 0;
-}
-
-#dashboard .select-layout.selected img {
-  border: 3px solid #4B9FD5;
-}
-
 /* WIDGETS */
 #dashboard .widget {
   position: relative;
 }
 
 /*CONFIGURATION*/
+#dashboard #configure {
+    position: relative;
+    height: 260px;
+    margin: 5px 0 10px 0;
+}
+
+#dashboard #widget_defs, #dashboard #edit-layout {
+    height: 250px;
+    background-color: #FFF6BF;
+    border: 2px solid #FFD324;
+    padding: 3px;
+    -moz-border-radius: 3px;
+    -webkit-border-radius: 3px;
+}
+
 #dashboard #widget_defs {
-  height: 250px;
-  overflow-y: auto;
-  background-color: #FFF6BF;
-  border: 2px solid #FFD324;
-  padding: 3px;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  margin: 5px 0 10px 0;
+    margin-right: 190px;
+    overflow-y: auto;
+}
+
+#dashboard #edit-layout {
+    width: 172px;
+    position: absolute;
+    right: 0;
+    top: 0;
+}
+
+#dashboard #edit-layout p {
+    margin-bottom: 5px;
 }
 
 #dashboard #widget_defs td {
   text-decoration: none;
 }
 
+#dashboard .select-layout {
+    float: left;
+}
+
+#dashboard .select-layout img {
+    border: 3px solid #FFF6BF;
+}
+
+#dashboard .select-layout.selected img {
+    border: 3px solid #4B9FD5;
+}
+
 /*OPERATIONS*/
 #dashboard #dashboard-operations {
   position: relative;
   box-shadow: 8px 8px 8px #ddd;
   -moz-box-shadow: 8px 8px 8px #ddd;
   -webkit-box-shadow: 8px 8px 8px #ddd;
-}
\ No newline at end of file
+}