Revision 1283:006057cf8f16 plugins/redmine_bibliography/app

View differences:

plugins/redmine_bibliography/app/controllers/publications_controller.rb
226 226
    @object_name = "publications[authorships_attributes][#{object_id}][search_results]"
227 227

  
228 228
    # cc 20110909 -- revert to like instead of like_unique -- see #289
229
    authorships_list = Authorship.like(params[:q]).find(:all, :limit => 100)
230
    users_list = User.active.like(params[:q]).find(:all, :limit => 100)
229
    authorships_list = Authorship.like(params[:term]).find(:all, :limit => 100)
230
    users_list = User.active.like(params[:term]).find(:all, :limit => 100)
231 231

  
232
    logger.debug "Query for \"#{params[:q]}\" returned \"#{authorships_list.size}\" authorships and \"#{users_list.size}\" users"
232
    logger.debug "Query for \"#{params[:term]}\" returned \"#{authorships_list.size}\" authorships and \"#{users_list.size}\" users"
233 233

  
234 234
    @results = users_list
235 235

  
plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb
1
<% if params[:q] && params[:q].length > 1 %>
2
	<%= choose_author_link @object_name, @results %>
3
<% end %>
4

  
1
<%= raw @results.map {|result| {
2
      'id' => result.id,
3
      'label' => "#{result.name} (#{result.mail.partition('@')[2]})",
4
      'value' => result.name,
5
      'type' => result.class,
6
      }
7
    }.to_json
8
%>

Also available in: Unified diff