diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-05 16:35:27 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-05 16:35:27 +0000 |
commit | 78bd24c6f738ea946622bfab5b6ea8a2040f5bde (patch) | |
tree | d170a86a5fe88326435223b19b5670fe2c5df439 /app/controllers/members_controller.rb | |
parent | 229b2f8d2af251e1bce0fa11946c41095c19f834 (diff) | |
download | redmine-78bd24c6f738ea946622bfab5b6ea8a2040f5bde.tar.gz redmine-78bd24c6f738ea946622bfab5b6ea8a2040f5bde.zip |
Resourcified project memberships.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8789 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/members_controller.rb')
-rw-r--r-- | app/controllers/members_controller.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 6d5dd4733..ae2f57a13 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -17,15 +17,15 @@ class MembersController < ApplicationController model_object Member - before_filter :find_model_object, :except => [:new, :autocomplete_for_member] - before_filter :find_project_from_association, :except => [:new, :autocomplete_for_member] - before_filter :find_project, :only => [:new, :autocomplete_for_member] + before_filter :find_model_object, :except => [:create, :autocomplete] + before_filter :find_project_from_association, :except => [:create, :autocomplete] + before_filter :find_project_by_project_id, :only => [:create, :autocomplete] before_filter :authorize - def new + def create members = [] - if params[:member] && request.post? - attrs = params[:member].dup + if params[:membership] && request.post? + attrs = params[:membership].dup if (user_ids = attrs.delete(:user_ids)) user_ids.each do |user_id| members << Member.new(attrs.merge(:user_id => user_id)) @@ -63,8 +63,11 @@ class MembersController < ApplicationController end end - def edit - if request.post? and @member.update_attributes(params[:member]) + def update + if params[:membership] + @member.role_ids = params[:membership][:role_ids] + end + if request.put? && @member.save respond_to do |format| format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } format.js { @@ -79,7 +82,7 @@ class MembersController < ApplicationController end def destroy - if request.post? && @member.deletable? + if request.delete? && @member.deletable? @member.destroy end respond_to do |format| @@ -92,7 +95,7 @@ class MembersController < ApplicationController end end - def autocomplete_for_member + def autocomplete @principals = Principal.active.like(params[:q]).find(:all, :limit => 100) - @project.principals render :layout => false end |