Revision 1355:3d01be97cb5a
| app/controllers/repositories_controller.rb | ||
|---|---|---|
| 60 | 60 |
end |
| 61 | 61 |
|
| 62 | 62 |
def edit |
| 63 |
@repository = @project.repository |
|
| 64 |
params[:repository_scm]='Mercurial' |
|
| 65 |
if !@repository |
|
| 66 |
@repository = Repository.factory(params[:repository_scm]) |
|
| 67 |
@repository.project = @project if @repository |
|
| 68 |
end |
|
| 69 |
if request.post? && @repository |
|
| 70 |
attrs = pickup_extra_info |
|
| 71 |
@repository.safe_attributes = attrs[:attrs] |
|
| 72 |
if attrs[:attrs_extra].keys.any? |
|
| 73 |
@repository.merge_extra_info(attrs[:attrs_extra]) |
|
| 74 |
end |
|
| 75 |
@repository.project = @project |
|
| 76 |
redirect_to settings_project_path(@project, :tab => 'repositories') |
|
| 77 |
end |
|
| 78 | 63 |
end |
| 79 | 64 |
|
| 80 | 65 |
def update |
| app/models/repository.rb | ||
|---|---|---|
| 51 | 51 |
'password', |
| 52 | 52 |
'path_encoding', |
| 53 | 53 |
'log_encoding', |
| 54 |
'is_external', |
|
| 55 |
'external_url', |
|
| 54 | 56 |
'is_default' |
| 55 | 57 |
|
| 56 | 58 |
safe_attributes 'url', |
| app/views/projects/settings/_repositories.html.erb | ||
|---|---|---|
| 1 | 1 |
|
| 2 | 2 |
<%= javascript_include_tag 'repository' %> |
| 3 | 3 |
|
| 4 |
<% if @repository %> |
|
| 5 |
|
|
| 4 | 6 |
<%= form_for @repository, |
| 5 | 7 |
:as => :repository, |
| 6 |
:url => { :controller => 'repositories', :action => 'edit', :id => @project },
|
|
| 7 | 8 |
:remote => true, |
| 8 |
:method => 'post' do |f| %> |
|
| 9 |
:url => { :controller => 'repositories', :action => 'update', :id => @repository },
|
|
| 10 |
:method => 'put' do |f| %> |
|
| 9 | 11 |
|
| 10 | 12 |
<%= error_messages_for 'repository' %> |
| 11 | 13 |
|
| 12 | 14 |
<div class="box tabular"> |
| 13 | 15 |
|
| 14 | 16 |
<p> |
| 15 |
<% if @repository %> |
|
| 16 | 17 |
<%= l(:text_settings_repo_explanation).html_safe %></ br> |
| 17 | 18 |
<% if @repository.is_external %> |
| 18 | 19 |
<p><%= l(:text_settings_repo_is_external).html_safe %></ br> |
| ... | ... | |
| 44 | 45 |
{
|
| 45 | 46 |
:controller => 'repositories', |
| 46 | 47 |
:action => 'committers', |
| 47 |
:id => @project
|
|
| 48 |
:id => @repository
|
|
| 48 | 49 |
}, |
| 49 | 50 |
:class => 'icon icon-user') %> |
| 50 | 51 |
<% end %> |
| ... | ... | |
| 52 | 53 |
|
| 53 | 54 |
<%= submit_tag(l(:button_save)) %> |
| 54 | 55 |
|
| 56 |
<% end %> |
|
| 57 |
|
|
| 55 | 58 |
<% else %> |
| 56 | 59 |
<%= l(:text_settings_repo_creation).html_safe %></ br> |
| 57 | 60 |
<% end %> |
| 58 | 61 |
|
| 59 |
<% end %> |
|
| public/javascripts/repository.js | ||
|---|---|---|
| 1 |
function toggle_ext_url(){
|
|
| 2 |
if($('repository_is_external').checked)
|
|
| 3 |
$('repository_external_url').enable();
|
|
| 4 |
else |
|
| 5 |
$('repository_external_url').disable();
|
|
| 1 |
function toggle_ext_url() {
|
|
| 2 |
if (document.getElementById('repository_is_external').checked) {
|
|
| 3 |
document.getElementById('repository_external_url').disabled = false;
|
|
| 4 |
} else {
|
|
| 5 |
document.getElementById('repository_external_url').disabled = true;
|
|
| 6 |
} |
|
| 6 | 7 |
} |
| 7 | 8 |
|
Also available in: Unified diff