# HG changeset patch # User luisf # Date 1377970617 -3600 # Node ID fa92d13876d007069bac14be954a0bcbd307d13d # Parent 1053a56bccec774af1b91fc337ca5708e058d781 Authorship Edit/Save buttons now working properly in the publication#new view. diff -r 1053a56bccec -r fa92d13876d0 plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb --- a/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb Sat Aug 31 17:57:33 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb Sat Aug 31 18:36:57 2013 +0100 @@ -1,7 +1,8 @@ <%- content_for :header_tags do -%> <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' -%> <%= javascript_include_tag 'bibliography', :plugin => 'redmine_bibliography' -%> - <%= javascript_tag "$('.author_save_btn').live('click', toggle_fields);" -%> + <%= javascript_tag "$('.author_save_btn').live('click', disable_fields);" -%> + <%= javascript_tag "$('.author_edit_btn').live('click', enable_fields);" -%> <%- end -%>
@@ -29,7 +30,7 @@

><%= h l("text_author_institution") %>

<%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") } %>

><%= h l("text_author_email") %>

- + <%= hidden_field_tag(:search_author_class, '', :name => form_tag_name(f.object_name,:search_author_class ), :id => form_tag_id( f.object_name, :search_author_class )) -%> <%= hidden_field_tag(:search_author_id, '', :name => form_tag_name(f.object_name,:search_author_id ), :id => form_tag_id( f.object_name, :search_author_id )) -%> @@ -38,6 +39,9 @@

<%= button_to_function l(:label_save_author), '', :id => form_tag_id(f.object_name, :edit_save_button), :class => 'author_save_btn' -%> + + <%= button_to_function l(:label_edit_author), '', :id => form_tag_id(f.object_name, :edit_button), :class => 'author_edit_btn' -%> + <%= link_to_remove_fields l("remove_author"), f %>

diff -r 1053a56bccec -r fa92d13876d0 plugins/redmine_bibliography/assets/javascripts/bibliography.js --- a/plugins/redmine_bibliography/assets/javascripts/bibliography.js Sat Aug 31 17:57:33 2013 +0100 +++ b/plugins/redmine_bibliography/assets/javascripts/bibliography.js Sat Aug 31 18:36:57 2013 +0100 @@ -5,6 +5,23 @@ $author_info = $this.closest('div').prev(); $author_info.children('.description').toggle(); $author_info.find('p :input').attr("readonly", true); + $author_info.find('p :input').addClass('readonly'); + + $this.siblings('.author_edit_btn').show(); + $this.hide(); return false; -} \ No newline at end of file +} + +function enable_fields(){ + $this = $(this); + $author_info = $this.closest('div').prev(); + $author_info.children('.description').toggle(); + $author_info.find('p :input').attr("readonly", false); + $author_info.find('p :input').removeClass('readonly'); + + $this.siblings('.author_save_btn').show(); + $this.hide(); + + return false; +} diff -r 1053a56bccec -r fa92d13876d0 plugins/redmine_bibliography/assets/stylesheets/bibliography.css --- a/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Sat Aug 31 17:57:33 2013 +0100 +++ b/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Sat Aug 31 18:36:57 2013 +0100 @@ -4,7 +4,7 @@ color: #777; } -input.readonly { +.readonly { border: none; padding: 0; margin: 0; @@ -71,3 +71,7 @@ background-image: url(../../../images/loading.gif); } +.author_edit_btn { + display:none; +} +