class ProfilesController < ApplicationController
SECTION=Navigation::SECTION_CONFIGURATION
- verify :method => :post, :only => ['create', 'delete', 'copy', 'set_as_default', 'restore', 'set_projects', 'rename'], :redirect_to => { :action => 'index' }
+ # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
+ verify :method => :post, :only => ['create', 'delete', 'copy', 'set_as_default', 'restore', 'set_projects', 'rename', 'change_parent'], :redirect_to => { :action => 'index' }
# the backup action is allow to non-admin users : see http://jira.codehaus.org/browse/SONAR-2039
before_filter :admin_required, :except => [ 'index', 'show', 'projects', 'permalinks', 'export', 'backup', 'inheritance' ]
end
+ #
+ #
+ # POST /profiles/change_parent?id=<profile id>&parent_name=<parent profile name>
+ #
+ #
+ def change_parent
+ id = params[:id].to_i
+ parent_name = params[:parent_name]
+ if parent_name.blank?
+ java_facade.changeParentProfile(id, nil)
+ else
+ java_facade.changeParentProfile(id, parent_name)
+ end
+ redirect_to :action => 'inheritance', :id => id
+ end
+
+
#
#
# GET /profiles/permalinks?id=<profile id>
RULE_PRIORITIES = Sonar::RulePriority.as_options.reverse\r
\r
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)\r
- verify :method => :post, :only => ['activate_rule', 'update_param', 'bulk_edit', 'create', 'update', 'delete', 'change_parent', 'revert_rule'], :redirect_to => { :action => 'index' }\r
+ verify :method => :post, :only => ['activate_rule', 'update_param', 'bulk_edit', 'create', 'update', 'delete', 'revert_rule'], :redirect_to => { :action => 'index' }\r
\r
before_filter :admin_required, :except => [ 'index', 'export' ]\r
\r
end\r
\r
end\r
-\r
-
- #
- #
- # POST /rules_configuration/change_parent?id=<profile id>&parent_name=<parent profile name>
- #
- #
- def change_parent
- id = params[:id].to_i
- parent_name = params[:parent_name]
- if parent_name.blank?
- java_facade.changeParentProfile(id, nil)
- else
- java_facade.changeParentProfile(id, parent_name)
- end
- redirect_to :action => 'index', :id => params[:id]
- end
#
<% if !@profile.provided? %>
<% form_tag({:action => 'change_parent'}, {:method => 'post'}) do %>
- <%= hidden_field_tag "id", @id %>
+ <%= hidden_field_tag "id", @profile.id %>
Parent profile: <%= select_tag "parent_name", options_for_select(@select_parent, @profile.parent_name), :disabled => !is_admin? %>
<%= submit_tag "Change", :id => 'submit_parent', :disabled => !is_admin? %>
<% end %>