scm: git: fix creating and updating repository
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9616 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -46,7 +46,11 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@repository = Repository.factory(params[:repository_scm], params[:repository])
|
||||
attrs = pickup_extra_info
|
||||
@repository = Repository.factory(params[:repository_scm], attrs[:attrs])
|
||||
if attrs[:attrs_extra].keys.any?
|
||||
@repository.merge_extra_info(attrs[:attrs_extra])
|
||||
end
|
||||
@repository.project = @project
|
||||
if request.post? && @repository.save
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
@@ -59,7 +63,11 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
@repository.attributes = params[:repository]
|
||||
attrs = pickup_extra_info
|
||||
@repository.attributes = attrs[:attrs]
|
||||
if attrs[:attrs_extra].keys.any?
|
||||
@repository.merge_extra_info(attrs[:attrs_extra])
|
||||
end
|
||||
@repository.project = @project
|
||||
if request.put? && @repository.save
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
@@ -68,6 +76,20 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def pickup_extra_info
|
||||
p = {}
|
||||
p_extra = {}
|
||||
params[:repository].each do |k, v|
|
||||
if k =~ /^extra_/
|
||||
p_extra[k] = v
|
||||
else
|
||||
p[k] = v
|
||||
end
|
||||
end
|
||||
{:attrs => p, :attrs_extra => p_extra}
|
||||
end
|
||||
private :pickup_extra_info
|
||||
|
||||
def committers
|
||||
@committers = @repository.committers
|
||||
@users = @project.users
|
||||
|
||||
Reference in New Issue
Block a user