# HG changeset patch # User luisf # Date 1313668923 -3600 # Node ID 7b39f35803f3e805add5def06828b8a5f31a04b3 # Parent e48cb60810763ccd81d4c5fe110ded28b31f2af6 Created JS functions to simulate author being saved. Not finished. diff -r e48cb6081076 -r 7b39f35803f3 vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml --- 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' %> + +

<%= l("label_author_1") %>

- (<%= 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;' %>)
@@ -25,7 +27,7 @@
-
+

<%= f.text_field :name_on_paper, :size => 25 %>
<%= h l("text_author_name_on_paper") %>
@@ -35,5 +37,15 @@ <%= h l("text_author_email") %>

+ + + + + <%= 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 %>
diff -r e48cb6081076 -r 7b39f35803f3 vendor/plugins/redmine_bibliography/assets/javascripts/authors.js --- 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){ + + +} + diff -r e48cb6081076 -r 7b39f35803f3 vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css --- 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 diff -r e48cb6081076 -r 7b39f35803f3 vendor/plugins/redmine_bibliography/config/locales/en.yml --- 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"