aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-05-05 23:15:26 +0200
committerDavid Gageot <david@gageot.net>2012-05-07 07:18:14 +0200
commitd24dd54841b21a279639941df64a7a86ac98f2db (patch)
tree01584cda6b98b7142fb13588b6b375935e02309f /sonar-server
parent68e826e238d0fc16b06675bedd2f3805c17bc117 (diff)
downloadsonarqube-d24dd54841b21a279639941df64a7a86ac98f2db.tar.gz
sonarqube-d24dd54841b21a279639941df64a7a86ac98f2db.zip
Merge 'Configure Widgets' and 'Edit Layout'
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb11
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_script_configure.html.erb37
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb62
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/edit_layout.html.erb46
-rw-r--r--sonar-server/src/main/webapp/images/layout100.pngbin321 -> 259 bytes
-rw-r--r--sonar-server/src/main/webapp/images/layout3070.pngbin369 -> 350 bytes
-rw-r--r--sonar-server/src/main/webapp/images/layout333333.pngbin431 -> 390 bytes
-rw-r--r--sonar-server/src/main/webapp/images/layout5050.pngbin364 -> 309 bytes
-rw-r--r--sonar-server/src/main/webapp/images/layout7030.pngbin355 -> 334 bytes
-rw-r--r--sonar-server/src/main/webapp/stylesheets/dashboard.css62
11 files changed, 99 insertions, 120 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
index 9fff94fdb0c..05758277929 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
@@ -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
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb
index 88350d6c99c..fad3fe9d7c1 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb
@@ -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
index 2a3a58e8f15..00000000000
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_script_configure.html.erb
+++ /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>
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 dcc59429cde..13099c79231 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
@@ -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>
<%
@@ -27,5 +42,42 @@
</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
index 21ce743163e..00000000000
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/edit_layout.html.erb
+++ /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>
diff --git a/sonar-server/src/main/webapp/images/layout100.png b/sonar-server/src/main/webapp/images/layout100.png
index 133f6c9d130..10216932084 100644
--- a/sonar-server/src/main/webapp/images/layout100.png
+++ b/sonar-server/src/main/webapp/images/layout100.png
Binary files differ
diff --git a/sonar-server/src/main/webapp/images/layout3070.png b/sonar-server/src/main/webapp/images/layout3070.png
index 5a226881da3..d862e953f2b 100644
--- a/sonar-server/src/main/webapp/images/layout3070.png
+++ b/sonar-server/src/main/webapp/images/layout3070.png
Binary files differ
diff --git a/sonar-server/src/main/webapp/images/layout333333.png b/sonar-server/src/main/webapp/images/layout333333.png
index dfe7e5cb0aa..1e1928a5267 100644
--- a/sonar-server/src/main/webapp/images/layout333333.png
+++ b/sonar-server/src/main/webapp/images/layout333333.png
Binary files differ
diff --git a/sonar-server/src/main/webapp/images/layout5050.png b/sonar-server/src/main/webapp/images/layout5050.png
index 65b18dc1235..2f154a738a6 100644
--- a/sonar-server/src/main/webapp/images/layout5050.png
+++ b/sonar-server/src/main/webapp/images/layout5050.png
Binary files differ
diff --git a/sonar-server/src/main/webapp/images/layout7030.png b/sonar-server/src/main/webapp/images/layout7030.png
index e759a514f23..22393592f78 100644
--- a/sonar-server/src/main/webapp/images/layout7030.png
+++ b/sonar-server/src/main/webapp/images/layout7030.png
Binary files differ
diff --git a/sonar-server/src/main/webapp/stylesheets/dashboard.css b/sonar-server/src/main/webapp/stylesheets/dashboard.css
index f3efd9ce346..ef75713a52a 100644
--- a/sonar-server/src/main/webapp/stylesheets/dashboard.css
+++ b/sonar-server/src/main/webapp/stylesheets/dashboard.css
@@ -14,18 +14,6 @@
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;
@@ -52,15 +40,35 @@
}
/*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 {
@@ -87,6 +95,18 @@
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;
@@ -194,4 +214,4 @@
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
+}