summaryrefslogtreecommitdiffstats
path: root/app/controllers/repositories_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-14 11:34:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-14 11:34:08 +0000
commit21c97c6a1376a38a3951c57069317c17c81029f8 (patch)
tree8d38f129585767d4c1eb2c78d0b9b978aff14d70 /app/controllers/repositories_controller.rb
parent29348fafb7ca43cb00ef80f29e61167647df0cd8 (diff)
downloadredmine-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/repositories_controller.rb')
-rw-r--r--app/controllers/repositories_controller.rb34
1 files changed, 27 insertions, 7 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index f99ea0b35..12439cfab 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -21,10 +21,29 @@ require 'digest/sha1'
class RepositoriesController < ApplicationController
layout 'base'
- before_filter :find_project, :except => [:update_form]
- before_filter :authorize, :except => [:update_form]
+ before_filter :find_repository, :except => :edit
+ before_filter :find_project, :only => :edit
+ before_filter :authorize
accept_key_auth :revisions
+ def edit
+ @repository = @project.repository
+ if !@repository
+ @repository = Repository.factory(params[:repository_scm])
+ @repository.project = @project
+ end
+ if request.post?
+ @repository.attributes = params[:repository]
+ @repository.save
+ end
+ render(:update) {|page| page.replace_html "tab-content-repository", :partial => 'projects/settings/repository'}
+ end
+
+ def destroy
+ @repository.destroy
+ redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'repository'
+ end
+
def show
# check if new revisions have been committed in the repository
@repository.fetch_changesets if Setting.autofetch_changesets?
@@ -113,14 +132,15 @@ class RepositoriesController < ApplicationController
end
end
- def update_form
- @repository = Repository.factory(params[:repository_scm])
- render :partial => 'projects/repository', :locals => {:repository => @repository}
- end
-
private
def find_project
@project = Project.find(params[:id])
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
+ def find_repository
+ @project = Project.find(params[:id])
@repository = @project.repository
render_404 and return false unless @repository
@path = params[:path].squeeze('/') if params[:path]