# HG changeset patch # User luisf # Date 1375182190 -3600 # Node ID 8633c9040b3baa109e45eabfaca502ffd70165d4 # Parent 99e0ed523b177fa4a139a4f2f3513330dedc0ed6# Parent 7c0909052511a3d3f1932f4c85ffd109f190ed24 Merge from default branch diff -r 99e0ed523b17 -r 8633c9040b3b app/controllers/projects_controller.rb --- a/app/controllers/projects_controller.rb Fri Jul 12 15:27:07 2013 +0100 +++ b/app/controllers/projects_controller.rb Tue Jul 30 12:03:10 2013 +0100 @@ -196,6 +196,7 @@ @issue_category ||= IssueCategory.new @member ||= @project.members.new @trackers = Tracker.sorted.all + @repository ||= @project.repository @wiki ||= @project.wiki end diff -r 99e0ed523b17 -r 8633c9040b3b app/models/repository.rb --- a/app/models/repository.rb Fri Jul 12 15:27:07 2013 +0100 +++ b/app/models/repository.rb Tue Jul 30 12:03:10 2013 +0100 @@ -51,6 +51,8 @@ 'password', 'path_encoding', 'log_encoding', + 'is_external', + 'external_url', 'is_default' safe_attributes 'url', diff -r 99e0ed523b17 -r 8633c9040b3b app/views/projects/settings/_repositories.html.erb --- a/app/views/projects/settings/_repositories.html.erb Fri Jul 12 15:27:07 2013 +0100 +++ b/app/views/projects/settings/_repositories.html.erb Tue Jul 30 12:03:10 2013 +0100 @@ -1,41 +1,61 @@ -<% if @project.repositories.any? %> - - - - - - - - - - - - <% @project.repositories.sort.each do |repository| %> - - - - - - - - <% end %> - -
<%= l(:field_identifier) %><%= l(:field_repository_is_default) %><%= l(:label_scm) %><%= l(:label_repository) %>
- <%= link_to repository.identifier, - {:controller => 'repositories', :action => 'show',:id => @project, :repository_id => repository.identifier_param} if repository.identifier.present? %> - <%= checked_image repository.is_default? %><%=h repository.scm_name %><%=h repository.url %> - <% if User.current.allowed_to?(:manage_repository, @project) %> - <%= link_to(l(:label_user_plural), committers_repository_path(repository), + +<%= javascript_include_tag 'repository' %> + +<% if @repository %> + +<%= form_for @repository, + :as => :repository, + :remote => true, + :url => { :controller => 'repositories', :action => 'update', :id => @repository }, + :method => 'put' do |f| %> + +<%= error_messages_for 'repository' %> + +
+ +

+ <%= l(:text_settings_repo_explanation).html_safe %> + <% if @repository.is_external %> +

<%= l(:text_settings_repo_is_external).html_safe %> + <% else %> +

<%= l(:text_settings_repo_is_internal).html_safe %> + <% end %> +

+ + +

+ <%= label_tag('repository_is_external', l(:label_is_external_repository)) %> + <%= check_box :repository, :is_external, :onclick => "toggle_ext_url()" %> +
<%= l(:setting_external_repository).html_safe %> +

+ +

+ <%= label_tag('repository_external_url', l(:label_repository_external_url)) %> + <%= text_field :repository, :external_url, :disabled => !(@repository and @repository.is_external) %> +
<%= l(:setting_external_repository_url).html_safe %> +

+ +

<%= l(:text_settings_repo_need_help).html_safe %>

+ +
+ +
+<% if @repository && !@repository.new_record? %> +<%= link_to(l(:label_user_plural), + { + :controller => 'repositories', + :action => 'committers', + :id => @repository + }, :class => 'icon icon-user') %> - <%= link_to(l(:button_edit), edit_repository_path(repository), - :class => 'icon icon-edit') %> - <%= delete_link repository_path(repository) %> - <% end %> -
-<% else %> -

<%= l(:label_no_data) %>

+<% end %> + + +<%= submit_tag(l(:button_save)) %> + <% end %> -<% if User.current.allowed_to?(:manage_repository, @project) %> -

<%= link_to l(:label_repository_new), new_project_repository_path(@project), :class => 'icon icon-add' %>

+<% else %> + <%= l(:text_settings_repo_creation).html_safe %> <% end %> + diff -r 99e0ed523b17 -r 8633c9040b3b public/javascripts/repository.js --- a/public/javascripts/repository.js Fri Jul 12 15:27:07 2013 +0100 +++ b/public/javascripts/repository.js Tue Jul 30 12:03:10 2013 +0100 @@ -1,7 +1,8 @@ -function toggle_ext_url(){ - if($('repository_is_external').checked) - $('repository_external_url').enable(); - else - $('repository_external_url').disable(); +function toggle_ext_url() { + if (document.getElementById('repository_is_external').checked) { + document.getElementById('repository_external_url').disabled = false; + } else { + document.getElementById('repository_external_url').disabled = true; + } }