]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1643 change URL format for permalinks and breadcrumb
authorsimonbrandhof <simon.brandhof@gmail.com>
Wed, 3 Nov 2010 11:04:26 +0000 (11:04 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Wed, 3 Nov 2010 11:04:26 +0000 (11:04 +0000)
sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_configure_widget.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_definition.html.erb
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/dashboards/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb

index b554f01d01ad7bd46abad05bd1e42cdb6b0f3e58..293a45ff67de142a466e07145c5eadcbd86b78f1 100644 (file)
@@ -44,7 +44,7 @@ class DashboardController < ApplicationController
   end
 
   def set_layout
-    dashboard=Dashboard.find(params[:id].to_i)
+    dashboard=Dashboard.find(params[:did].to_i)
     if dashboard.editable_by?(current_user)
       dashboard.column_layout=params[:layout]
       if dashboard.save
@@ -55,7 +55,7 @@ class DashboardController < ApplicationController
         end
       end
     end
-    redirect_to :action => 'index', :id => dashboard.id, :resource => params[:resource]
+    redirect_to :action => 'index', :did => dashboard.id, :id => params[:id]
   end
 
   def set_dashboard
@@ -84,7 +84,7 @@ class DashboardController < ApplicationController
   end
 
   def add_widget
-    dashboard=Dashboard.find(params[:id].to_i)
+    dashboard=Dashboard.find(params[:did].to_i)
     widget_id=nil
     if dashboard.editable_by?(current_user)
       definition=java_facade.getWidget(params[:widget])
@@ -97,12 +97,12 @@ class DashboardController < ApplicationController
         widget_id=new_widget.id
       end
     end
-    redirect_to :action => 'configure', :id => dashboard.id, :resource => params[:resource], :highlight => widget_id 
+    redirect_to :action => 'configure', :did => dashboard.id, :id => params[:id], :highlight => widget_id
   end
 
 
   def save_widget
-    widget=Widget.find(params[:id].to_i)
+    widget=Widget.find(params[:wid].to_i)
     #TODO check owner of dashboard
     definition=java_facade.getWidget(widget.widget_key)
     errors_by_property_key={}
@@ -124,7 +124,7 @@ class DashboardController < ApplicationController
       widget.save
       widget.properties.each {|p| p.save}
       render :update do |page|
-        page.redirect_to(url_for(:action => :configure, :id => widget.dashboard_id, :resource => params[:resource]))
+        page.redirect_to(url_for(:action => :configure, :did => widget.dashboard_id, :id => params[:id]))
       end
     else
       widget.configured=false
@@ -140,8 +140,8 @@ class DashboardController < ApplicationController
   def load_dashboard
     @active=nil
     if logged_in?
-      if params[:id]
-        @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['active_dashboards.dashboard_id=? AND active_dashboards.user_id=?', params[:id].to_i, current_user.id])
+      if params[:did]
+        @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['active_dashboards.dashboard_id=? AND active_dashboards.user_id=?', params[:did].to_i, current_user.id])
       elsif params[:name]
         @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['dashboards.name=? AND active_dashboards.user_id=?', params[:name], current_user.id])
       else
@@ -151,8 +151,8 @@ class DashboardController < ApplicationController
 
     if @active.nil?
       # anonymous or not found in user dashboards
-      if params[:id]
-        @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['active_dashboards.dashboard_id=? AND active_dashboards.user_id IS NULL', params[:id].to_i])
+      if params[:did]
+        @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['active_dashboards.dashboard_id=? AND active_dashboards.user_id IS NULL', params[:did].to_i])
       elsif params[:name]
         @active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['dashboards.name=? AND active_dashboards.user_id IS NULL', params[:name]])
       else
@@ -163,7 +163,7 @@ class DashboardController < ApplicationController
   end
 
   def load_resource
-    @resource=Project.by_key(params[:resource])
+    @resource=Project.by_key(params[:id])
     if @resource.nil?
       # TODO display error page
       redirect_to home_path
index 69b6296a12b2480ada529dede664988449829662..a27e5c595dcc009938be947228f06a37455d5099 100644 (file)
@@ -50,7 +50,7 @@ class DashboardsController < ApplicationController
       add_default_dashboards_if_first_user_dashboard
       last_active_dashboard=current_user.active_dashboards.max{|x,y| x.order_index<=>y.order_index}
       current_user.active_dashboards.create(:dashboard => @dashboard, :user_id => current_user.id, :order_index => (last_active_dashboard ? last_active_dashboard.order_index+1: 1))
-      redirect_to :controller => 'dashboard', :action => 'configure', :id => @dashboard.id, :resource => params[:resource]
+      redirect_to :controller => 'dashboard', :action => 'configure', :did => @dashboard.id, :id => params[:resource]
     else
       flash[:error]=@dashboard.errors.full_messages.join('<br/>')
       redirect_to :controller => 'dashboards', :action => 'index', :resource => params[:resource]
index 11f71379f6c7457a8a9824f1d73c8d5e1a41b865..ef27c1109befd04653abf8e2841681a5470069e6 100644 (file)
@@ -300,7 +300,7 @@ module ApplicationHelper
   def link_to_resource(resource, name=nil, options={})
     if resource.display_dashboard?
       if options[:dashboard]
-        link_to(name || resource.name, {:overwrite_params => {:controller => 'project', :action => 'index', :id => resource.copy_resource_id || resource.id}}, :title => options[:title])
+        link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => resource.copy_resource_id || resource.id}}, :title => options[:title])
       else
         # stay on the same page (for example components)
         link_to(name || resource.name, {:overwrite_params => {:id => resource.copy_resource_id || resource.id}}, :title => options[:title])
index db775bfe743cccb58cffa71eebb93950008320e3..94f8cbc6375b58e263c14075d7f3495873446693 100644 (file)
@@ -18,7 +18,7 @@
 
 
 <div class="widget_props" id="widget_props_<%= widget.id -%>" style="<%= 'display:none' if widget.configured -%>">
-  <% form_remote_tag :url => {:action => 'save_widget', :id => widget.id, :resource => params[:resource]}, :method => :post do -%>
+  <% form_remote_tag :url => {:action => 'save_widget', :wid => widget.id, :id => params[:id]}, :method => :post do -%>
     <table class="form">
       <tbody>
       <% definition.getProperties().each do |property_def|
index c68cee1a18bfd9fb4acda0241ddbf3b733d48cd0..040d8ba867f24b6db88b813f080e2374eb283661 100644 (file)
@@ -2,11 +2,11 @@
 <% if logged_in? %>
   <ul class="operations">
     <% if back %>
-      <li class="last"><%= link_to 'Back to dashboard', {:action => 'index', :id => @dashboard.id, :resource => @resource.id } -%></li>
+      <li class="last"><%= link_to 'Back to dashboard', {:action => 'index', :did => @dashboard.id, :id => @resource.id } -%></li>
     <% else %>
       <% if @dashboard.editable_by?(current_user) %>
-      <li><%= link_to 'Configure widgets', {:action => 'configure', :id => @dashboard.id, :resource => @resource.id } -%></li>
-      <li><%= link_to 'Edit layout', {:action => 'edit_layout', :id => @dashboard.id, :resource => @resource.id } -%></li>
+      <li><%= link_to 'Configure widgets', {:action => 'configure', :did => @dashboard.id, :id => @resource.id } -%></li>
+      <li><%= link_to 'Edit layout', {:action => 'edit_layout', :did => @dashboard.id, :id => @resource.id } -%></li>
       <% end %>
       <li class="last"><%= link_to 'Manage dashboards', {:controller => 'dashboards', :action => 'index', :resource => @resource.id } -%></li>
     <% end %>
index 03a6bcd7a70dd7508ea0bc79af209e4942c82b8f..592313173f9306c5a4a1cc4e661bcb1dc2efdcbf 100644 (file)
@@ -17,7 +17,7 @@
   %>
 <% else %>
   <div class="widget">
-  <p>Please <a href="<%= url_for :action => :configure, :id => @dashboard.id, :resource => @resource.id -%>">configure</a> the widget <b><%= definition.getTitle() -%></b>.</p>
+  <p>Please <a href="<%= url_for :action => :configure, :did => @dashboard.id, :id => @resource.id -%>">configure</a> the widget <b><%= definition.getTitle() -%></b>.</p>
   </div>
 <% end %>
 <div style="clear: both;"></div>
index 880d5a1ca9929554eb90e11a8fdd1b0cdd03e65f..ef2dd5203dbaf80296135eaf0b5983e80862b49f 100644 (file)
@@ -2,7 +2,7 @@
  <div class="widget_def" id="def_<%= definition.getId().tr('_', '') -%>">
 <p><b><%= h definition.getTitle() -%></b></p>
 <p><%= h definition.getDescription() -%></p>
-<%= form_tag :action => 'add_widget', :id => @dashboard.id, :resource => params[:resource], :widget => definition.getId() %>
+<%= form_tag :action => 'add_widget', :did => @dashboard.id, :id => params[:id], :widget => definition.getId() %>
   <input type="submit" value="Add widget" >
 </form>
   </div>
index 656b86a44290a7493600bff80dbbc2604fb741fe..bcb71d3b551b3d8c572e5ea2e7fb8d059f5fd84f 100644 (file)
@@ -14,7 +14,7 @@
         highlight_duration: 2,
         highlight_startcolor: '#cae3f2',
         highlight_endcolor: '#ffffff',
-        saveurl: '<%= url_for :action => 'set_dashboard', :id => @dashboard.id, :resource => @resource.id -%>'
+        saveurl: '<%= url_for :action => 'set_dashboard', :did => @dashboard.id, :id => @resource.id -%>'
     };
     var portal;
     function init_dashboard() {
index 5006a908a774b7ec54fe1c8127a02195b40fcec1..3dcb0ad4d025789bd3e55829e432acdda54cb131 100644 (file)
@@ -5,23 +5,23 @@
       <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', :id => @dashboard.id, :resource => @resource.id, :layout => "100"}, :method => :post %>
+        <%= 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', :id => @dashboard.id, :resource => @resource.id, :layout => "50-50"}, :method => :post %>
+        <%= 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', :id => @dashboard.id, :resource => @resource.id, :layout => "30-70"}, :method => :post %>
+        <%= 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', :id => @dashboard.id, :resource => @resource.id, :layout => "70-30"}, :method => :post %>
+        <%= 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', :id => @dashboard.id, :resource => @resource.id, :layout => "33-33-33"}, :method => :post %>
+        <%= 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 aff8b9578a0e1d7554b37c538159780a39e38d1b..489fef62fde0dfc247d5958e156fd8aa505e4687 100644 (file)
@@ -21,7 +21,7 @@
             @actives.each_with_index do |active,index| %>
             <tr id="dashboard-<%= u active.name -%>" class="<%= cycle('even','odd', :name => 'dashboards') -%>">
               <td>
-                <%= link_to active.name, {:controller => :dashboard, :action => :index, :id => active.dashboard_id, :resource => params[:resource]} -%>
+                <%= link_to active.name, {:controller => :dashboard, :action => :index, :did => active.dashboard_id, :id => params[:resource]} -%>
                 <% if active.dashboard.description.present? %>
                 <p class="small"><%= h active.dashboard.description -%></p>
                 <% end %>
@@ -43,7 +43,7 @@
               </td>
               <td>
                 <% if active.owner?(current_user) %>
-                  <%= link_to 'Configure widgets', {:controller => :dashboard, :action => 'configure', :id => active.dashboard_id, :resource => params[:resource]}, :id => "configure-#{u active.name}" %>
+                  <%= link_to 'Configure widgets', {:controller => :dashboard, :action => 'configure', :did => active.dashboard_id, :id => params[:resource]}, :id => "configure-#{u active.name}" %>
                   |
                   <%= link_to_remote "Edit", :update => "admin_form", :url => { :action => "edit", :id => active.dashboard_id, :resource => params[:resource] }, :id => "edit-#{u active.name}", :method => :get %>
                   |
index cedafc0abcb1a4caaa535096148c939260611ee9..aeefa08a45f1501ab575e954381cbd25c95a3d35 100644 (file)
@@ -35,7 +35,7 @@
 
         <% elsif (selected_section==Navigation::SECTION_RESOURCE) %>
           <% ActiveDashboard.user_dashboards(current_user).each do |active_dashboard| %>
-            <li class="<%= 'selected' if @dashboard && controller.controller_path=='dashboard' &&  active_dashboard.dashboard_id==@dashboard.id -%>"><a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= active_dashboard.dashboard_id -%>?resource=<%= @project.id -%>"><%= active_dashboard.dashboard.name -%></a></li>
+            <li class="<%= 'selected' if @dashboard && controller.controller_path=='dashboard' &&  active_dashboard.dashboard_id==@dashboard.id -%>"><a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= @project.id -%>?did=<%= active_dashboard.dashboard_id -%>"><%= active_dashboard.dashboard.name -%></a></li>
           <% end %>
           <li class="<%= 'selected' if request.request_uri.include?('/components/index') -%>"><a href="<%= ApplicationController.root_context -%>/components/index/<%= @project.id -%>">Components</a></li>
           <li class="<%= 'selected' if request.request_uri.include?('/drilldown/violations') -%>"><a href="<%= ApplicationController.root_context -%>/drilldown/violations/<%= @project.id -%>">Violations drilldown</a></li>