changeset 715:3c1257f96b79 feature_36_js_refactoring

not working: tried to add js to edit/save button
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 28 Sep 2011 18:08:41 +0100
parents 1ea217fdcdbf
children d6b9fd02bb89
files vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml vendor/plugins/redmine_bibliography/assets/javascripts/authors.js
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Wed Sep 28 16:41:30 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Wed Sep 28 18:08:41 2011 +0100
@@ -48,7 +48,7 @@
   <%- if params[:action] == 'new' -%>
     <%= button_to_function l(:label_save_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button ), :class => 'edit-save-button' } %>
   <%- else -%>
-    <%= button_to_function l(:label_edit_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %>
+    <%= button_to_function l(:label_edit_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button ), :class => 'edit-save-button' } %>
   <%- end -%>
 
 
--- a/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js	Wed Sep 28 16:41:30 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js	Wed Sep 28 18:08:41 2011 +0100
@@ -99,12 +99,7 @@
 			Publication.Authorships.add()
 		}
 		
-		// $(this).previous('div').down('.edit-save-button').observe('click', function(event){
-		    //	  alert(Event.element(event).innerHTML);
-		//		alert($(this).id);
-		//	 })
-	
-	
+		
 	// ~ Pulication.Authorships					
 	};
 
@@ -117,6 +112,13 @@
 		
 		add: function(){
 			alert("Button Pressed");
+
+			self.previous('div').down('.edit-save-button').observe('click', function(event){
+				alert(Event.element(event).innerHTML);
+				alert(self.id);
+			})
+		
+		
 		},