Revision 1284:3ce07a57ce68 plugins/redmine_bibliography/app

View differences:

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

  
24
  def choose_author_link(object_name, items)
25
    # called by autocomplete_for_author (publications' action/view)
26
    # creates the select list based on the results array
27
    # results is an array with both Users and Authorships objects
28 24

  
29
    @author_options = []
30
    @results.each do |result|
31
      email_bit = result.mail.partition('@')[2]
32
      if email_bit != ""
33
          email_bit = "(@#{email_bit})"
34
      end
35
      @author_options << ["#{result.name} #{email_bit}", "#{result.class.to_s}_#{result.id.to_s}"]
36
    end
37 25

  
38
   if @results.size > 0
39
     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} )
40
   else
41
     s = "<em>No Authors found that match your search… sorry!</em>"
42
   end
43
  end
44 26

  
45 27
  def link_to_remove_fields(name, f)
46 28
    f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del')
......
77 59
    str.to_sym
78 60
  end
79 61

  
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

  
80 88
  def render_authorships_list(publication)
81 89
    s = '<p>'
82 90

  
plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb
2 2
      'id' => result.id,
3 3
      'label' => "#{result.name} (#{result.mail.partition('@')[2]})",
4 4
      'value' => result.name,
5
      'type' => result.class,
5
      'type' => result.class.name,
6
      'institution' => result.institution,
7
      'email' => result.mail,
6 8
      }
7 9
    }.to_json
8
%>
10
%>

Also available in: Unified diff