changeset 212:f5860b03d365 feature_72

added js to external repository URL text field and checkbox.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 08 Feb 2011 15:07:08 +0000
parents bb7cac2ac146
children 00e958b1f6f8
files app/views/projects/settings/_repository.rhtml public/javascripts/repository.js public/javascripts/ssamr_registration.js
diffstat 3 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/app/views/projects/settings/_repository.rhtml	Tue Feb 08 13:15:47 2011 +0000
+++ b/app/views/projects/settings/_repository.rhtml	Tue Feb 08 15:07:08 2011 +0000
@@ -1,3 +1,6 @@
+
+<%= javascript_include_tag 'repository' %>
+
 <% remote_form_for :repository, @repository, 
                    :url => { :controller => 'repositories', :action => 'edit', :id => @project },
                    :builder => TabularFormBuilder,
@@ -15,14 +18,14 @@
 
 <p>
 	<%= 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) %>
 </p>
 
 
 <p>
 	<%= 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) %>
 </p>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public/javascripts/repository.js	Tue Feb 08 15:07:08 2011 +0000
@@ -0,0 +1,7 @@
+function toggle_ext_url(){
+	if($('repository_is_external').checked)
+	    $('repository_external_url').enable();
+	else
+	    $('repository_external_url').disable();
+}
+
--- a/public/javascripts/ssamr_registration.js	Tue Feb 08 13:15:47 2011 +0000
+++ b/public/javascripts/ssamr_registration.js	Tue Feb 08 15:07:08 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;
 		}
 	}
 );