diff vendor/plugins/redmine_bibliography/assets/javascripts/authors.js @ 623:a434a588f16c feature_36

More layout fixes
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 24 Aug 2011 15:44:55 +0100
parents 4ede44d53f76
children 11c8e189f8fc
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js	Wed Aug 24 15:19:33 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js	Wed Aug 24 15:44:55 2011 +0100
@@ -1,58 +1,60 @@
 function remove_fields(link) {
-  $(link).previous("input[type=hidden]").value = "1";
-  $(link).up(".fields").hide();
+    $(link).previous("input[type=hidden]").value = "1";
+    $(link).up(".fields").hide();
 }
 
 function add_fields(link, association, content) {
-  var new_id = new Date().getTime();
-  var regexp = new RegExp("new_" + association, "g")
-  $(link).insert({
-    before: content.replace(regexp, new_id)
-  });
+    var new_id = new Date().getTime();
+    var regexp = new RegExp("new_" + association, "g")
+    $(link).insert({
+	before: content.replace(regexp, new_id)
+    });
 }
 
 function identify_author_status(status, object_id) {
-	$('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) {
-		if(status == "no"){
-			s.value = "";
-			s.readOnly = false;
-		};
-		
-		if(status == "correct"){s.readOnly = false;};
-		if(status == "yes"){s.readOnly = true;};
-	});
+    $('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) {
+	if(status == "no"){
+	    s.value = "";
+	    s.readOnly = false;
+	};
+	
+	if(status == "correct"){s.readOnly = false;};
+	if(status == "yes"){s.readOnly = true;};
+    });
 }
 
 function toggle_div(div_id){	
-	Effect.toggle(div_id, "appear", {duration:0.3});
+    Effect.toggle(div_id, "appear", {duration:0.3});
 }
 
 function toggle_input_field(field){	
-	if(field.classNames().inspect().include("readonly") == false){
-		field.readOnly = true;	
-		field.addClassName('readonly').next('em').hide();
-	} else {
-		field.readOnly = false;
-		field.removeClassName('readonly').next('em').show();
-	};	
+    if (field.classNames().inspect().include("readonly") == false){
+	field.readOnly = true;	
+	field.addClassName('readonly');
+    } else {
+	field.readOnly = false;
+	field.removeClassName('readonly');
+    };	
 }
 
 function toggle_edit_save_button(object_id){
-	$button = $('publication_authorships_attributes_' + object_id + '_edit_save_button');
-	if($button.value == "Save Author"){
-		$button.value = "Edit Author";	
-	} else {
-		$button.value = "Save Author";
-	};
+    $button = $('publication_authorships_attributes_' + object_id + '_edit_save_button');
+    if ($button.value == "Edit author"){
+	$button.value = "Save author";
+    } else {
+	$button.value = "Edit author";
+    };
 }
 
 function toggle_save_author(form_object_id, $this){
-	$('publication_authorships_attributes_' + form_object_id + '_edit_author_info').select('input').each(function(s) {
-	  toggle_input_field(s, $this);
-	});
-	
-	toggle_edit_save_button(form_object_id);
-	toggle_div("publication_authorships_attributes_" + form_object_id +"_search_author");
+    $('publication_authorships_attributes_' + form_object_id + '_edit_author_info').select('input').each(function(s) {
+	toggle_input_field(s, $this);
+    });
+    $$('p.description').each(function(s) {
+	s.toggle();
+    });
+    toggle_edit_save_button(form_object_id);
+    toggle_div("publication_authorships_attributes_" + form_object_id +"_search_author");
 }
 
 function edit_author(form_object_id){