Mercurial > hg > soundsoftware-site
changeset 1362:8633c9040b3b luisf
Merge from default branch
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Tue, 30 Jul 2013 12:03:10 +0100 |
parents | 99e0ed523b17 (current diff) 7c0909052511 (diff) |
children | 855b4ae5ecdd |
files | |
diffstat | 4 files changed, 66 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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',
--- 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? %> -<table class="list"> - <thead> - <tr> - <th><%= l(:field_identifier) %></th> - <th><%= l(:field_repository_is_default) %></th> - <th><%= l(:label_scm) %></th> - <th><%= l(:label_repository) %></th> - <th></th> - </tr> - </thead> - <tbody> - <% @project.repositories.sort.each do |repository| %> - <tr class="<%= cycle 'odd', 'even' %>"> - <td> - <%= link_to repository.identifier, - {:controller => 'repositories', :action => 'show',:id => @project, :repository_id => repository.identifier_param} if repository.identifier.present? %> - </td> - <td align="center"><%= checked_image repository.is_default? %></td> - <td><%=h repository.scm_name %></td> - <td><%=h repository.url %></td> - <td class="buttons"> - <% 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' %> + +<div class="box tabular"> + +<p> + <%= l(:text_settings_repo_explanation).html_safe %></ br> + <% if @repository.is_external %> + <p><%= l(:text_settings_repo_is_external).html_safe %></ br> + <% else %> + <p><%= l(:text_settings_repo_is_internal).html_safe %></ br> + <% end %> +</p> + + +<p> + <%= label_tag('repository_is_external', l(:label_is_external_repository)) %> + <%= check_box :repository, :is_external, :onclick => "toggle_ext_url()" %> + <br/><em><%= l(:setting_external_repository).html_safe %></em> +</p> + +<p> + <%= label_tag('repository_external_url', l(:label_repository_external_url)) %> + <%= text_field :repository, :external_url, :disabled => !(@repository and @repository.is_external) %> + <br/><em><%= l(:setting_external_repository_url).html_safe %></em> +</p> + +<p><%= l(:text_settings_repo_need_help).html_safe %></p> + +</div> + +<div class="contextual"> +<% 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 %> - </td> - </tr> - <% end %> - </tbody> -</table> -<% else %> -<p class="nodata"><%= l(:label_no_data) %></p> +<% end %> +</div> + +<%= submit_tag(l(:button_save)) %> + <% end %> -<% if User.current.allowed_to?(:manage_repository, @project) %> - <p><%= link_to l(:label_repository_new), new_project_repository_path(@project), :class => 'icon icon-add' %></p> +<% else %> + <%= l(:text_settings_repo_creation).html_safe %></ br> <% end %> +
--- 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; + } }