Revision 1289:7fa299909144 plugins/redmine_bibliography/assets/javascripts
| plugins/redmine_bibliography/assets/javascripts/authors.js | ||
|---|---|---|
| 21 | 21 |
source: '/publications/autocomplete_for_author', |
| 22 | 22 |
minLength: 2, |
| 23 | 23 |
focus: function(event, ui) {
|
| 24 |
$this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.value);
|
|
| 24 |
$this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.name);
|
|
| 25 | 25 |
$this.closest('div').next().find("input[id$='institution']").val(ui.item.institution);
|
| 26 | 26 |
$this.closest('div').next().find("input[id$='email']").val(ui.item.email);
|
| 27 | 27 |
$this.closest('div').next().find("input[id$='search_author_class']").val(ui.item.search_author_class);
|
| ... | ... | |
| 30 | 30 |
return false; |
| 31 | 31 |
}, |
| 32 | 32 |
select: function(event, ui){
|
| 33 |
$this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.value);
|
|
| 33 |
$this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.name);
|
|
| 34 | 34 |
$this.closest('div').next().find("input[id$='institution']").val(ui.item.institution);
|
| 35 | 35 |
$this.closest('div').next().find("input[id$='email']").val(ui.item.email);
|
| 36 | 36 |
$this.closest('div').next().find("input[id$='search_author_class']").val(ui.item.search_author_class);
|
| ... | ... | |
| 40 | 40 |
.data( "autocomplete" )._renderItem = function( ul, item ) {
|
| 41 | 41 |
return $( "<li></li>" ) |
| 42 | 42 |
.data( "item.autocomplete", item ) |
| 43 |
.append( "<a>" + item.institution + "</a>" )
|
|
| 43 |
.append( "<a>" + item.label + "</a>" )
|
|
| 44 | 44 |
.appendTo( ul ); |
| 45 | 45 |
}; |
| 46 | 46 |
}); |
| 47 | 47 |
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
function identify_author_status(status, object_id) {
|
|
| 52 |
$('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) {
|
|
| 53 |
|
|
| 54 |
if(status == "no"){
|
|
| 55 |
s.value = ""; |
|
| 56 |
s.readOnly = false; |
|
| 57 |
} |
|
| 58 |
|
|
| 59 |
if(status == "correct"){
|
|
| 60 |
s.readOnly = false; |
|
| 61 |
} |
|
| 62 |
if(status == "yes"){
|
|
| 63 |
s.readOnly = true; |
|
| 64 |
} |
|
| 65 |
}); |
|
| 66 |
} |
|
| 67 |
|
|
| 68 | 48 |
function toggle_div(div_id){
|
| 69 | 49 |
$("#" + div_id).toggle(0.3);
|
| 70 | 50 |
} |
| 71 | 51 |
|
| 72 |
function toggle_input_field(field){
|
|
| 73 |
if (field.classNames().inspect().include("readonly") === false){
|
|
| 74 |
field.readOnly = true; |
|
| 75 |
field.addClassName('readonly');
|
|
| 76 |
} else {
|
|
| 77 |
field.readOnly = false; |
|
| 78 |
field.removeClassName('readonly');
|
|
| 79 |
} |
|
| 80 |
} |
|
| 81 |
|
|
| 82 |
function toggle_edit_save_button(object_id){
|
|
| 83 |
$button = $('publication_authorships_attributes_' + object_id + '_edit_save_button');
|
|
| 84 |
if ($button.value == "Edit author"){
|
|
| 85 |
$button.value = "Save author"; |
|
| 86 |
} else {
|
|
| 87 |
$button.value = "Edit author"; |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
|
|
| 91 | 52 |
function toggle_save_author(form_object_id, $this){
|
| 92 | 53 |
$('publication_authorships_attributes_' + form_object_id + '_edit_author_info').select('input').each(function(s) {
|
| 93 | 54 |
toggle_input_field(s, $this); |
Also available in: Unified diff