Mercurial > hg > soundsoftware-site
changeset 1393:67abd7b08753 luisf
Adding more information to the autocomplete dropdown (when searching for an author/user in the publication#new/edit views).
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 26 Sep 2013 11:44:57 +0100 |
parents | d262df85ac97 |
children | 0f918e37e1d6 581999ce44ea |
files | plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb plugins/redmine_bibliography/assets/javascripts/authors.js |
diffstat | 2 files changed, 6 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb Wed Sep 25 17:48:24 2013 +0100 +++ b/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb Thu Sep 26 11:44:57 2013 +0100 @@ -1,5 +1,5 @@ <%= raw @results.map {|result| { - 'label' => "#{result.name} <em>#{result.mail.partition('@')[2]}</em>", + 'label' => result.name, 'value' => result.name, 'search_author_class' => result.class.name, 'search_author_id' => result.id,
--- a/plugins/redmine_bibliography/assets/javascripts/authors.js Wed Sep 25 17:48:24 2013 +0100 +++ b/plugins/redmine_bibliography/assets/javascripts/authors.js Thu Sep 26 11:44:57 2013 +0100 @@ -17,12 +17,7 @@ source: '/publications/autocomplete_for_author', minLength: 2, focus: function(event, ui) { - $this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.name); - $this.closest('div').next().find("input[id$='institution']").val(ui.item.institution); - $this.closest('div').next().find("input[id$='email']").val(ui.item.email); - $this.closest('div').next().find("input[id$='search_author_class']").val(ui.item.search_author_class); - $this.closest('div').next().find("input[id$='search_author_id']").val(ui.item.search_author_id); - + $this.val(ui.item.label); return false; }, select: function(event, ui){ @@ -34,10 +29,10 @@ } }) .data( "autocomplete" )._renderItem = function( ul, item ) { - return $( "<li></li>" ) - .data( "item.autocomplete", item ) - .append( "<a>" + item.label + "</a>" ) - .appendTo( ul ); + return $( "<li>" ) + .data("item.autocomplete", item ) + .append( "<a>" + item.label + "<br><em>" + item.email + "</em><br>" + item.intitution + "</a>" ) + .appendTo(ul); }; });