comparison vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb @ 652:0c872fe77797 feature_36

Merge from 649:525f48af3f54
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 09 Sep 2011 14:19:25 +0100
parents 525f48af3f54
children f8d7e85ccd4e
comparison
equal deleted inserted replaced
651:f029431de4dd 652:0c872fe77797
21 # creates the select list based on the results array 21 # creates the select list based on the results array
22 # results is an array with both Users and Authorships objects 22 # results is an array with both Users and Authorships objects
23 23
24 @author_options = [] 24 @author_options = []
25 @results.each do |result| 25 @results.each do |result|
26 @author_options << ["#{result.name} (#{result.mail})", "#{result.class.to_s}_#{result.id.to_s}"] 26 email_bit = result.mail.partition('@')[2]
27 if email_bit != "":
28 email_bit = "(@#{email_bit})"
29 end
30 @author_options << ["#{result.name} #{email_bit}", "#{result.class.to_s}_#{result.id.to_s}"]
27 end 31 end
28 32
29 if @results.size > 0 33 if @results.size > 0
30 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} ) 34 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} )
31 s << observe_field( form_tag_id(object_name, :author_search_results), :on => 'click', :function => "alert('Element changed')", :with => 'q') 35 s << observe_field( form_tag_id(object_name, :author_search_results), :on => 'click', :function => "alert('Element changed')", :with => 'q')