diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-14 11:34:08 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-14 11:34:08 +0000 |
commit | 21c97c6a1376a38a3951c57069317c17c81029f8 (patch) | |
tree | 8d38f129585767d4c1eb2c78d0b9b978aff14d70 /app/controllers/members_controller.rb | |
parent | 29348fafb7ca43cb00ef80f29e61167647df0cd8 (diff) | |
download | redmine-21c97c6a1376a38a3951c57069317c17c81029f8.tar.gz redmine-21c97c6a1376a38a3951c57069317c17c81029f8.zip |
Added project module concept.
A project module (eg. issue tracking, news, wiki,...) is a set of permissions that can enabled/disabled at project level.
For each project, modules can be enabled on the project settings view ('Modules' tab).
This requires a specific permission: 'Select project modules' (if this permission is turned off, only Redmine administrators can choose which modules a project uses).
When applying this migration, all modules are enabled for all existing projects.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@725 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/members_controller.rb')
-rw-r--r-- | app/controllers/members_controller.rb | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index dfaad7fa3..a1706e601 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -17,13 +17,23 @@ class MembersController < ApplicationController layout 'base' - before_filter :find_project, :authorize + before_filter :find_member, :except => :new + before_filter :find_project, :only => :new + before_filter :authorize + def new + @project.members << Member.new(params[:member]) if request.post? + respond_to do |format| + format.html { redirect_to :action => 'settings', :tab => 'members', :id => @project } + format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} } + end + end + def edit if request.post? and @member.update_attributes(params[:member]) respond_to do |format| format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } - format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/members'} } + format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} } end end end @@ -32,12 +42,18 @@ class MembersController < ApplicationController @member.destroy respond_to do |format| format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } - format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/members'} } + format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} } end end private def find_project + @project = Project.find(params[:id]) + rescue ActiveRecord::RecordNotFound + render_404 + end + + def find_member @member = Member.find(params[:id]) @project = @member.project rescue ActiveRecord::RecordNotFound |