# HG changeset patch
# User Chris Cannam
# Date 1300723350 0
# Node ID ab672e427b9b985d7b9a44ed248f8b4306f80d9f
# Parent bde4f47b6427dc09622ddabf3161e5490d540f74# Parent ec56461d37700d87ca7865e7f320d19adb7f39b9
Merge from branch "feature_72"
diff -r bde4f47b6427 -r ab672e427b9b app/controllers/repositories_controller.rb
--- a/app/controllers/repositories_controller.rb Thu Feb 24 15:04:51 2011 +0000
+++ b/app/controllers/repositories_controller.rb Mon Mar 21 16:02:30 2011 +0000
@@ -36,7 +36,11 @@
def edit
@repository = @project.repository
+
if !@repository
+
+ params[:repository_scm]='Mercurial'
+
@repository = Repository.factory(params[:repository_scm])
@repository.project = @project if @repository
end
@@ -44,6 +48,7 @@
@repository.attributes = params[:repository]
@repository.save
end
+
render(:update) do |page|
page.replace_html "tab-content-repository", :partial => 'projects/settings/repository'
if @repository && !@project.repository
diff -r bde4f47b6427 -r ab672e427b9b app/helpers/repositories_helper.rb
--- a/app/helpers/repositories_helper.rb Thu Feb 24 15:04:51 2011 +0000
+++ b/app/helpers/repositories_helper.rb Mon Mar 21 16:02:30 2011 +0000
@@ -145,13 +145,19 @@
send(method, form, repository) if repository.is_a?(Repository) && respond_to?(method) && method != 'repository_field_tags'
end
+
+ def ssamr_scm_update(repository)
+ check_box_tag('repository_scm', value = "1", checked = false, onchange => remote_function(:url => { :controller => 'repositories', :action => 'ssamr_edit', :id => @project }, :method => :get, :with => "Form.serialize(this.form)"))
+
+ end
+
def scm_select_tag(repository)
scm_options = [["--- #{l(:actionview_instancetag_blank_option)} ---", '']]
Redmine::Scm::Base.all.each do |scm|
scm_options << ["Repository::#{scm}".constantize.scm_name, scm] if Setting.enabled_scm.include?(scm) || (repository && repository.class.name.demodulize == scm)
end
- select_tag('repository_scm',
+ select_tag('repository_scm',
options_for_select(scm_options, repository.class.name.demodulize),
:disabled => (repository && !repository.new_record?),
:onchange => remote_function(:url => { :controller => 'repositories', :action => 'edit', :id => @project }, :method => :get, :with => "Form.serialize(this.form)")
diff -r bde4f47b6427 -r ab672e427b9b app/models/repository/mercurial.rb
--- a/app/models/repository/mercurial.rb Thu Feb 24 15:04:51 2011 +0000
+++ b/app/models/repository/mercurial.rb Mon Mar 21 16:02:30 2011 +0000
@@ -19,7 +19,7 @@
class Repository::Mercurial < Repository
attr_protected :root_url
- validates_presence_of :url
+ # validates_presence_of :url
FETCH_AT_ONCE = 100 # number of changesets to fetch at once
diff -r bde4f47b6427 -r ab672e427b9b app/views/projects/settings/_repository.rhtml
--- a/app/views/projects/settings/_repository.rhtml Thu Feb 24 15:04:51 2011 +0000
+++ b/app/views/projects/settings/_repository.rhtml Mon Mar 21 16:02:30 2011 +0000
@@ -1,3 +1,6 @@
+
+<%= javascript_include_tag 'repository' %>
+
<% remote_form_for :repository, @repository,
:url => { :controller => 'repositories', :action => 'edit', :id => @project },
:builder => TabularFormBuilder,
@@ -6,23 +9,32 @@
<%= error_messages_for 'repository' %>
-<% if !@repository || !@repository.url %>
-
- <%= l(:text_settings_repo_creation) %>
+
+
+<% if @repository %>
+ <% if @repository.is_external %>
+ <%= l(:text_settings_repo_is_external) %> br>
+ <% else %>
+ <%= l(:text_settings_repo_is_internal) %> br>
<% end %>
-
<%= label_tag('repository_scm', l(:label_scm)) %><%= scm_select_tag(@repository) %>
-<%= repository_field_tags(f, @repository) if @repository %>
+ <% else %>
+ <%= l(:text_settings_repo_creation) %> br>
+<% end %>
+
+
+
<%= label_tag('repository_is_external', l(:label_is_external_repository)) %>
- <%= check_box :repository, :is_external %>
+ <%= check_box :repository, :is_external, :onclick => "toggle_ext_url()" %>
<%= l(:setting_external_repository) %>
<%= label_tag('repository_external_url', l(:label_repository_external_url)) %>
- <%= text_field :repository, :external_url %>
+ <%= text_field :repository, :external_url, :disabled => true %>
<%= l(:setting_external_repository_url) %>
@@ -32,12 +44,8 @@
<% if @repository && !@repository.new_record? %>
<%= link_to(l(:label_user_plural), {:controller => 'repositories', :action => 'committers', :id => @project}, :class => 'icon icon-user') %>
-<%= link_to(l(:button_delete), {:controller => 'repositories', :action => 'destroy', :id => @project},
- :confirm => l(:text_are_you_sure),
- :method => :post,
- :class => 'icon icon-del') %>
<% end %>
-<%= submit_tag((@repository.nil? || @repository.new_record?) ? l(:button_create) : l(:button_save), :disabled => @repository.nil?) %>
+<%= submit_tag(l(:button_save), :onclick => remote_function(:url => { :controller => 'repositories', :action => 'edit', :id => @project }, :method => :get, :with => "Form.serialize(this.form)")) %>
<% end %>
diff -r bde4f47b6427 -r ab672e427b9b config/locales/en-GB.yml
--- a/config/locales/en-GB.yml Thu Feb 24 15:04:51 2011 +0000
+++ b/config/locales/en-GB.yml Mon Mar 21 16:02:30 2011 +0000
@@ -905,6 +905,9 @@
text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?"
text_settings_repo_creation: The repository for a project should be set up automatically within a few minutes of the project being created.
You should not have to adjust any settings here; please check again in ten minutes.
+ text_settings_repo_is_internal: The repository for this project is an internal Mercurial Repository, hosted by SoundSoftware.ac.uk.
+ text_settings_repo_is_external: You are tracking an external repository, with a mirror Mercurial repository hosted by SoundSoftware.ac.uk.
+
default_role_manager: Manager
default_role_developer: Developer
default_role_reporter: Reporter
diff -r bde4f47b6427 -r ab672e427b9b config/locales/en.yml
--- a/config/locales/en.yml Thu Feb 24 15:04:51 2011 +0000
+++ b/config/locales/en.yml Mon Mar 21 16:02:30 2011 +0000
@@ -930,6 +930,10 @@
text_zoom_in: Zoom in
text_zoom_out: Zoom out
text_settings_repo_creation: The repository for a project should be set up automatically within a few minutes of the project being created.
You should not have to adjust any settings here.
Please check again in ten minutes, and
contact us if there is any problem.
+ text_settings_repo_is_internal: The repository for this project is an internal Mercurial Repository, hosted by SoundSoftware.ac.uk.
+ text_settings_repo_is_external: You are tracking an external repository, with a mirror Mercurial repository hosted by SoundSoftware.ac.uk.
+
+
default_role_manager: Manager
default_role_developer: Developer
diff -r bde4f47b6427 -r ab672e427b9b public/javascripts/repository.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/public/javascripts/repository.js Mon Mar 21 16:02:30 2011 +0000
@@ -0,0 +1,7 @@
+function toggle_ext_url(){
+ if($('repository_is_external').checked)
+ $('repository_external_url').enable();
+ else
+ $('repository_external_url').disable();
+}
+
diff -r bde4f47b6427 -r ab672e427b9b public/javascripts/ssamr_registration.js
--- a/public/javascripts/ssamr_registration.js Thu Feb 24 15:04:51 2011 +0000
+++ b/public/javascripts/ssamr_registration.js Mon Mar 21 16:02:30 2011 +0000
@@ -4,13 +4,12 @@
/* institution related functions */
Event.observe(window, 'load',
- function() {
-
+ function() {
if(!$('ssamr_user_details_institution_type_true').checked && $('ssamr_user_details_institution_type_true').checked){
- $('ssamr_user_details_other_institution').disable();
- $('ssamr_user_details_institution_id').enable();
- $('ssamr_user_details_institution_type_true').checked = true;
- $('ssamr_user_details_institution_type_false').checked = false;
+ $('ssamr_user_details_other_institution').disable();
+ $('ssamr_user_details_institution_id').enable();
+ $('ssamr_user_details_institution_type_true').checked = true;
+ $('ssamr_user_details_institution_type_false').checked = false;
}
}
);