diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-03 11:04:26 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-03 11:04:26 +0000 |
commit | 7fb6c24c478db3b8f60cc41baa771402339fb21b (patch) | |
tree | 61af03cf74de96e5cffeb36fe1e6934ce0cf606e /sonar-server/src/main/webapp/WEB-INF/app/controllers | |
parent | 1c83344e651d1b69b4e44f5e4dac5f3fa0a7f414 (diff) | |
download | sonarqube-7fb6c24c478db3b8f60cc41baa771402339fb21b.tar.gz sonarqube-7fb6c24c478db3b8f60cc41baa771402339fb21b.zip |
SONAR-1643 change URL format for permalinks and breadcrumb
Diffstat (limited to 'sonar-server/src/main/webapp/WEB-INF/app/controllers')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb | 22 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb | 2 |
2 files changed, 12 insertions, 12 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 b554f01d01a..293a45ff67d 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 @@ -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 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 69b6296a12b..a27e5c595dc 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 @@ -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] |