Revision 1388:cfa9122bb584 plugins/redmine_bibliography

View differences:

plugins/redmine_bibliography/app/helpers/publications_helper.rb
21 21
    s.html_safe
22 22
  end
23 23

  
24

  
25

  
26

  
27 24
  def link_to_remove_fields(name, f)
28 25
    f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del')
29 26
  end
......
31 28
  def link_to_add_author_fields(name, f, association, action)
32 29
    new_object = f.object.class.reflect_on_association(association).klass.new
33 30
    fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
31
      # renders _authorship_fields.html.erb
34 32
      render(association.to_s.singularize + "_fields", :f => builder)
35 33
    end
34

  
36 35
    link_to_function(name, "add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')", { :class => 'icon icon-add', :id => "add_another_author" })
37 36
  end
38 37

  
......
59 58
    str.to_sym
60 59
  end
61 60

  
62
  #######
63
  ### DELETE ME
64

  
65
  def choose_author_link(object_name, items)
66
    # called by autocomplete_for_author (publications' action/view)
67
    # creates the select list based on the results array
68
    # results is an array with both Users and Authorships objects
69

  
70
    @author_options = []
71
    @results.each do |result|
72
      email_bit = result.mail.partition('@')[2]
73
      if email_bit != ""
74
          email_bit = "(@#{email_bit})"
75
      end
76
      @author_options << ["#{result.name} #{email_bit}", "#{result.class.to_s}_#{result.id.to_s}"]
77
    end
78

  
79
   if @results.size > 0
80
     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} )
81
   else
82
     s = "<em>No Authors found that match your search… sorry!</em>"
83
   end
84
  end
85

  
86

  
87

  
88 61
  def render_authorships_list(publication)
89 62
    s = '<p>'
90 63

  

Also available in: Unified diff