changeset 603:7b39f35803f3 feature_36

Created JS functions to simulate author being saved. Not finished.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 18 Aug 2011 13:02:03 +0100
parents e48cb6081076
children 48c027b30576
files vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml vendor/plugins/redmine_bibliography/assets/javascripts/authors.js vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css vendor/plugins/redmine_bibliography/config/locales/en.yml
diffstat 4 files changed, 42 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Wed Aug 17 17:13:38 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Thu Aug 18 13:02:03 2011 +0100
@@ -1,6 +1,8 @@
+<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %>
+
+
 <div id="authors" class="fields">
   <h4><%= l("label_author_1") %></h4>
-  <small>(<%= link_to l(:label_search_existing_author), {}, :onclick => 'Effect.toggle("' + form_tag_id( f.object_name, :search_author ).to_s + '", "appear", {duration:0.3}); return false;' %>)</small>
 
   <div id="<%= form_tag_id( f.object_name, :search_author ) %>">
     <div class="splitcontentleft">
@@ -25,7 +27,7 @@
     </div>	
   </div>
   
-  <div class="box">
+  <div class="box" id="<%= form_tag_id( f.object_name, :edit_author_info ) %>">
     <p>
       <%= f.text_field :name_on_paper, :size => 25 %><br />
       <em><%= h l("text_author_name_on_paper") %></em><br />
@@ -35,5 +37,15 @@
       <em><%= h l("text_author_email") %></em><br />
     </p>
   </div>
+
+  <div class="box" id="<%= form_tag_id( f.object_name, :show_author_info ) %>" style="display: none">
+	
+
+  </div>
+
+
+  <%= button_to l(:label_save_author), {}, :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;" %>
+
+
   <%= link_to_remove_fields l("remove_author"), f %>
 </div>
--- a/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js	Wed Aug 17 17:13:38 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js	Thu Aug 18 13:02:03 2011 +0100
@@ -40,3 +40,26 @@
 		break;
 	}
 }
+
+function toggle_div(div_id){	
+	Effect.toggle(div_id, "appear", {duration:0.3});
+}
+
+function toggle_input_field(field_id){
+	$(field_id).addClassName('readonly');
+	$(field_id).next('em').hide();
+}
+
+function toggle_save_author(form_object_id){
+	toggle_input_field("publication_authorships_attributes_" + form_object_id + "_name_on_paper");
+	toggle_input_field("publication_authorships_attributes_" + form_object_id + "_institution");
+	toggle_input_field("publication_authorships_attributes_" + form_object_id + "_email");
+
+	toggle_div("publication_authorships_attributes_" + form_object_id +"_search_author");
+}
+
+function edit_author(form_object_id){
+	
+	
+}
+
--- a/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css	Wed Aug 17 17:13:38 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css	Thu Aug 18 13:02:03 2011 +0100
@@ -2,4 +2,8 @@
   font-size: 12px;
   cursor: move;
   color: #777;
+}
+
+input.readonly {
+        border: none;
 }
\ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml	Wed Aug 17 17:13:38 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml	Thu Aug 18 13:02:03 2011 +0100
@@ -29,7 +29,7 @@
   label_add_another_author: "Add another author"
   field_search_name: "Search author"
   field_search_results: "Authors"
-  label_search_existing_author: "Search Author"
+  label_save_author: "Save Author"
   label_author_information: "Author Information"
 
   remove_author: "Remove this author"