# HG changeset patch # User luisf # Date 1380127366 -3600 # Node ID cfa9122bb5845b8733654a5d98dea9d6a16d568c # Parent 765e83814c28320d709adbe8b6204aaf604b2c1f Removed unnecessary code; added useful comment. diff -r 765e83814c28 -r cfa9122bb584 plugins/redmine_bibliography/app/helpers/publications_helper.rb --- a/plugins/redmine_bibliography/app/helpers/publications_helper.rb Tue Sep 24 18:20:21 2013 +0100 +++ b/plugins/redmine_bibliography/app/helpers/publications_helper.rb Wed Sep 25 17:42:46 2013 +0100 @@ -21,9 +21,6 @@ s.html_safe end - - - def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del') end @@ -31,8 +28,10 @@ def link_to_add_author_fields(name, f, association, action) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| + # renders _authorship_fields.html.erb render(association.to_s.singularize + "_fields", :f => builder) end + link_to_function(name, "add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')", { :class => 'icon icon-add', :id => "add_another_author" }) end @@ -59,32 +58,6 @@ str.to_sym end - ####### - ### DELETE ME - - def choose_author_link(object_name, items) - # called by autocomplete_for_author (publications' action/view) - # creates the select list based on the results array - # results is an array with both Users and Authorships objects - - @author_options = [] - @results.each do |result| - email_bit = result.mail.partition('@')[2] - if email_bit != "" - email_bit = "(@#{email_bit})" - end - @author_options << ["#{result.name} #{email_bit}", "#{result.class.to_s}_#{result.id.to_s}"] - end - - if @results.size > 0 - s = select_tag( form_tag_name(object_name, :author_search_results), options_for_select(@author_options), { :id => form_tag_id(object_name, :author_search_results), :size => 3} ) - else - s = "No Authors found that match your search… sorry!" - end - end - - - def render_authorships_list(publication) s = '

'