Revision 1393:67abd7b08753 plugins/redmine_bibliography
| plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb | ||
|---|---|---|
| 1 | 1 |
<%= raw @results.map {|result| {
|
| 2 |
'label' => "#{result.name} <em>#{result.mail.partition('@')[2]}</em>",
|
|
| 2 |
'label' => result.name,
|
|
| 3 | 3 |
'value' => result.name, |
| 4 | 4 |
'search_author_class' => result.class.name, |
| 5 | 5 |
'search_author_id' => result.id, |
| plugins/redmine_bibliography/assets/javascripts/authors.js | ||
|---|---|---|
| 17 | 17 |
source: '/publications/autocomplete_for_author', |
| 18 | 18 |
minLength: 2, |
| 19 | 19 |
focus: function(event, ui) {
|
| 20 |
$this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.name);
|
|
| 21 |
$this.closest('div').next().find("input[id$='institution']").val(ui.item.institution);
|
|
| 22 |
$this.closest('div').next().find("input[id$='email']").val(ui.item.email);
|
|
| 23 |
$this.closest('div').next().find("input[id$='search_author_class']").val(ui.item.search_author_class);
|
|
| 24 |
$this.closest('div').next().find("input[id$='search_author_id']").val(ui.item.search_author_id);
|
|
| 25 |
|
|
| 20 |
$this.val(ui.item.label); |
|
| 26 | 21 |
return false; |
| 27 | 22 |
}, |
| 28 | 23 |
select: function(event, ui){
|
| ... | ... | |
| 34 | 29 |
} |
| 35 | 30 |
}) |
| 36 | 31 |
.data( "autocomplete" )._renderItem = function( ul, item ) {
|
| 37 |
return $( "<li></li>" )
|
|
| 38 |
.data( "item.autocomplete", item )
|
|
| 39 |
.append( "<a>" + item.label + "</a>" ) |
|
| 40 |
.appendTo( ul );
|
|
| 32 |
return $( "<li>" ) |
|
| 33 |
.data("item.autocomplete", item )
|
|
| 34 |
.append( "<a>" + item.label + "<br><em>" + item.email + "</em><br>" + item.intitution + "</a>" )
|
|
| 35 |
.appendTo(ul);
|
|
| 41 | 36 |
}; |
| 42 | 37 |
}); |
| 43 | 38 |
|
Also available in: Unified diff