Mercurial > hg > soundsoftware-site
changeset 1380:fa92d13876d0 luisf
Authorship Edit/Save buttons now working properly in the publication#new view.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Sat, 31 Aug 2013 18:36:57 +0100 |
parents | 1053a56bccec |
children | 5b8bd53fd65c b51b5ae3734c |
files | plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb plugins/redmine_bibliography/assets/javascripts/bibliography.js plugins/redmine_bibliography/assets/stylesheets/bibliography.css |
diffstat | 3 files changed, 29 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 -%> <div id="authors" class="fields"> @@ -29,7 +30,7 @@ <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_institution") %></p> <p><%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") } %></p> <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_email") %></p> - + <%= 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 @@ <div> <p> <%= 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 %> </p> </div>
--- 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; +}
--- 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; +} +