Mercurial > hg > soundsoftware-site
comparison plugins/redmine_bibliography/assets/javascripts/authors.js @ 1394:0f918e37e1d6 biblio_alt_search_auth
Major interface changes; will use virtual attributes to identify search results.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 27 Sep 2013 18:43:29 +0100 |
parents | 67abd7b08753 |
children | 35732ac4324a |
comparison
equal
deleted
inserted
replaced
1393:67abd7b08753 | 1394:0f918e37e1d6 |
---|---|
8 function remove_fields(link) { | 8 function remove_fields(link) { |
9 $(link).prev("input[type=hidden]").val("1"); | 9 $(link).prev("input[type=hidden]").val("1"); |
10 $(link).closest(".fields").hide(); | 10 $(link).closest(".fields").hide(); |
11 } | 11 } |
12 | 12 |
13 $(".author_search").live('keyup.autocomplete', function(){ | 13 $(".author_name_on_paper").live('keyup.autocomplete', function(){ |
14 $this = $(this); | 14 $this = $(this); |
15 | 15 |
16 $this.autocomplete({ | 16 $this.autocomplete({ |
17 source: '/publications/autocomplete_for_author', | 17 source: '/publications/autocomplete_for_author', |
18 minLength: 2, | 18 minLength: 2, |
19 focus: function(event, ui) { | 19 focus: function(event, ui) { |
20 $this.val(ui.item.label); | 20 $this.val(ui.item.label); |
21 return false; | 21 return false; |
22 }, | 22 }, |
23 select: function(event, ui){ | 23 select: function(event, ui){ |
24 $this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.name); | 24 $this.closest('div').find("input[id$='institution']").val(ui.item.institution); |
25 $this.closest('div').next().find("input[id$='institution']").val(ui.item.institution); | 25 $this.closest('div').find("input[id$='email']").val(ui.item.email); |
26 $this.closest('div').next().find("input[id$='email']").val(ui.item.email); | 26 |
27 $this.closest('div').next().find("input[id$='search_author_class']").val(ui.item.search_author_class); | 27 $this.closest('div').find("input[id$='search_author_class']").val(ui.item.search_author_class); |
28 $this.closest('div').next().find("input[id$='search_author_id']").val(ui.item.search_author_id); | 28 $this.closest('div').find("input[id$='search_author_id']").val(ui.item.search_author_id); |
29 $this.closest('div').find("input[id$='search_author_tie']").attr('checked', 'checked'); | |
30 | |
31 | |
32 | |
33 // triggers the save button | |
34 $this.closest('div').next('div').find('.author_save_btn').click(); | |
29 } | 35 } |
30 }) | 36 }) |
31 .data( "autocomplete" )._renderItem = function( ul, item ) { | 37 .data( "autocomplete" )._renderItem = function( ul, item ) { |
32 return $( "<li>" ) | 38 return $( "<li>" ) |
33 .data("item.autocomplete", item ) | 39 .data("item.autocomplete", item ) |
34 .append( "<a>" + item.label + "<br><em>" + item.email + "</em><br>" + item.intitution + "</a>" ) | 40 .append( "<a>" + item.label + "<br><em>" + item.email + "</em><br>" + item.intitution + "</a>" ) |
35 .appendTo(ul); | 41 .appendTo(ul); |
36 }; | 42 }; |
37 }); | 43 }); |
38 | 44 |
39 | |
40 $("input[id$='identify_author_yes']").live("click", function() { | |
41 console.log("aaaa"); | |
42 }); | |
43 | |
44 $("input[id$='identify_author_no']").live("click", function() { | |
45 $this.closest('div').next().find("input[id$='name_on_paper']").val(''); | |
46 $this.closest('div').next().find("input[id$='institution']").val(''); | |
47 $this.closest('div').next().find("input[id$='email']").val(''); | |
48 $this.closest('div').next().find("input[id$='search_author_class']").val(''); | |
49 }); | |
50 |