To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / plugins / redmine_bibliography / assets / javascripts / authors.js @ 1392:d262df85ac97
History | View | Annotate | Download (2.34 KB)
| 1 | 1278:f8bb7ccc6fac | luis | function add_author_fields(link, association, content, action) { |
|---|---|---|---|
| 2 | var new_id = new Date().getTime(); |
||
| 3 | var regexp = new RegExp("new_" + association, "g"); |
||
| 4 | |||
| 5 | $(link).before(content.replace(regexp, new_id));
|
||
| 6 | 469:ae87ae455cfb | luis | } |
| 7 | |||
| 8 | 1278:f8bb7ccc6fac | luis | function remove_fields(link) { |
| 9 | $(link).prev("input[type=hidden]").val("1"); |
||
| 10 | $(link).closest(".fields").hide(); |
||
| 11 | 481:dd242ea99fd3 | luis | } |
| 12 | |||
| 13 | 1281:e9bfba17e791 | luis | $(".author_search").live('keyup.autocomplete', function(){ |
| 14 | 1284:3ce07a57ce68 | luis | $this = $(this); |
| 15 | |||
| 16 | $this.autocomplete({
|
||
| 17 | 1282:8d30e7644b75 | luis | source: '/publications/autocomplete_for_author', |
| 18 | 1283:006057cf8f16 | luis | minLength: 2, |
| 19 | 1288:7e89ba7fac48 | luis | focus: function(event, ui) { |
| 20 | 1289:7fa299909144 | luis | $this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.name); |
| 21 | 1288:7e89ba7fac48 | luis | $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 | |||
| 26 | return false; |
||
| 27 | }, |
||
| 28 | 1283:006057cf8f16 | luis | select: function(event, ui){ |
| 29 | 1289:7fa299909144 | luis | $this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.name); |
| 30 | 1284:3ce07a57ce68 | luis | $this.closest('div').next().find("input[id$='institution']").val(ui.item.institution); |
| 31 | $this.closest('div').next().find("input[id$='email']").val(ui.item.email); |
||
| 32 | 1286:d0d6bbe9f2e0 | luis | $this.closest('div').next().find("input[id$='search_author_class']").val(ui.item.search_author_class); |
| 33 | $this.closest('div').next().find("input[id$='search_author_id']").val(ui.item.search_author_id); |
||
| 34 | 1283:006057cf8f16 | luis | } |
| 35 | 1288:7e89ba7fac48 | luis | }) |
| 36 | .data( "autocomplete" )._renderItem = function( ul, item ) { |
||
| 37 | return $( "<li></li>" ) |
||
| 38 | .data( "item.autocomplete", item )
|
||
| 39 | 1289:7fa299909144 | luis | .append( "<a>" + item.label + "</a>" ) |
| 40 | 1288:7e89ba7fac48 | luis | .appendTo( ul ); |
| 41 | }; |
||
| 42 | }); |
||
| 43 | 1281:e9bfba17e791 | luis | |
| 44 | 1292:bb51e86fa182 | luis | |
| 45 | $("input[id$='identify_author_yes']").live("click", function() { |
||
| 46 | console.log("aaaa");
|
||
| 47 | }); |
||
| 48 | |||
| 49 | 1293:b7af3c2d1f0c | luis | $("input[id$='identify_author_no']").live("click", function() { |
| 50 | $this.closest('div').next().find("input[id$='name_on_paper']").val(''); |
||
| 51 | $this.closest('div').next().find("input[id$='institution']").val(''); |
||
| 52 | $this.closest('div').next().find("input[id$='email']").val(''); |
||
| 53 | $this.closest('div').next().find("input[id$='search_author_class']").val(''); |
||
| 54 | }); |