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/projects_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/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 55 |
1 files changed, 9 insertions, 46 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0acd64009..148d54d48 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -73,16 +73,9 @@ class ProjectsController < ApplicationController else @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => (params[:custom_fields] ? params["custom_fields"][x.id.to_s] : nil)) } - @project.custom_values = @custom_values - if params[:repository_enabled] && params[:repository_enabled] == "1" - @project.repository = Repository.factory(params[:repository_scm]) - @project.repository.attributes = params[:repository] - end - if "1" == params[:wiki_enabled] - @project.wiki = Wiki.new - @project.wiki.attributes = params[:wiki] - end + @project.custom_values = @custom_values if @project.save + @project.enabled_module_names = params[:enabled_modules] flash[:notice] = l(:notice_successful_create) redirect_to :controller => 'admin', :action => 'projects' end @@ -107,6 +100,8 @@ class ProjectsController < ApplicationController @issue_category ||= IssueCategory.new @member ||= @project.members.new @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } + @repository ||= @project.repository + @wiki ||= @project.wiki end # Edit @project @@ -117,24 +112,6 @@ class ProjectsController < ApplicationController @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } @project.custom_values = @custom_values end - if params[:repository_enabled] - case params[:repository_enabled] - when "0" - @project.repository = nil - when "1" - @project.repository ||= Repository.factory(params[:repository_scm]) - @project.repository.update_attributes params[:repository] if @project.repository - end - end - if params[:wiki_enabled] - case params[:wiki_enabled] - when "0" - @project.wiki.destroy if @project.wiki - when "1" - @project.wiki ||= Wiki.new - @project.wiki.update_attributes params[:wiki] - end - end @project.attributes = params[:project] if @project.save flash[:notice] = l(:notice_successful_update) @@ -145,6 +122,11 @@ class ProjectsController < ApplicationController end end end + + def modules + @project.enabled_module_names = params[:enabled_modules] + redirect_to :action => 'settings', :id => @project, :tab => 'modules' + end def archive @project.archive if request.post? && @project.active? @@ -195,25 +177,6 @@ class ProjectsController < ApplicationController end end - # Add a new member to @project - def add_member - @member = @project.members.build(params[:member]) - if request.post? && @member.save - 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 => 'members'} } - end - else - settings - render :action => 'settings' - end - end - - # Show members list of @project - def list_members - @members = @project.members.find(:all) - end - # Add a new document to @project def add_document @categories = Enumeration::get_values('DCAT') |