Revision 1426:7367cd232b1e plugins/redmine_bibliography/assets/javascripts
| plugins/redmine_bibliography/assets/javascripts/authors.js | ||
|---|---|---|
| 10 | 10 |
$(link).closest(".fields").hide();
|
| 11 | 11 |
} |
| 12 | 12 |
|
| 13 |
$(".author_search").live('keyup.autocomplete', function(){
|
|
| 14 |
$this = $(this); |
|
| 13 |
function authorship_autocomplete(url){
|
|
| 14 |
$(".author_name_on_paper").live('keyup.autocomplete', function(){
|
|
| 15 |
$this = $(this); |
|
| 15 | 16 |
|
| 16 |
$this.autocomplete({
|
|
| 17 |
source: '/publications/autocomplete_for_author', |
|
| 18 |
minLength: 2, |
|
| 19 |
focus: function(event, ui) {
|
|
| 20 |
$this.val(ui.item.label); |
|
| 21 |
return false; |
|
| 22 |
}, |
|
| 23 |
select: function(event, ui){
|
|
| 24 |
$this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.name);
|
|
| 25 |
$this.closest('div').next().find("input[id$='institution']").val(ui.item.institution);
|
|
| 26 |
$this.closest('div').next().find("input[id$='email']").val(ui.item.email);
|
|
| 27 |
$this.closest('div').next().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);
|
|
| 29 |
} |
|
| 30 |
}) |
|
| 31 |
.data( "autocomplete" )._renderItem = function( ul, item ) {
|
|
| 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); |
|
| 36 |
}; |
|
| 37 |
}); |
|
| 17 |
$this.autocomplete({
|
|
| 18 |
source: url, |
|
| 19 |
minLength: 2, |
|
| 20 |
focus: function(event, ui) {
|
|
| 21 |
$this.val(ui.item.label); |
|
| 22 |
return false; |
|
| 23 |
}, |
|
| 24 |
select: function(event, ui){
|
|
| 25 |
$this.closest('div').find("input[id$='institution']").val(ui.item.institution);
|
|
| 26 |
$this.closest('div').find("input[id$='email']").val(ui.item.email);
|
|
| 38 | 27 |
|
| 28 |
$this.closest('div').find("input[id$='search_author_class']").val(ui.item. search_author_class);
|
|
| 29 |
$this.closest('div').find("input[id$='search_author_id']").val(ui.item. search_author_id);
|
|
| 39 | 30 |
|
| 40 |
$("input[id$='identify_author_yes']").live("click", function() {
|
|
| 41 |
console.log("aaaa");
|
|
| 42 |
}); |
|
| 31 |
$this.closest('div').find("input[id$='search_author_tie']").attr('checked', ' checked');
|
|
| 32 |
$this.closest('div').find("input[id$='search_author_tie']").next('span'). replaceWith(ui.item.authorship_link);
|
|
| 43 | 33 |
|
| 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 |
|
|
| 34 |
// triggers the save button |
|
| 35 |
$this.closest('div').next('div').find('.author_save_btn').click();
|
|
| 36 |
} |
|
| 37 |
}) |
|
| 38 |
.data( "autocomplete" )._renderItem = function( ul, item ) {
|
|
| 39 |
return $( "<li>" ) |
|
| 40 |
.data("item.autocomplete", item )
|
|
| 41 |
.append( "<a>" + item.label + "<br><em>" + item.email + "</em><br>" + item. institution + "</a>" ) |
|
| 42 |
.appendTo(ul); |
|
| 43 |
}; |
|
| 44 |
}); |
|
| 45 |
} |
|
| plugins/redmine_bibliography/assets/javascripts/bibliography.js | ||
|---|---|---|
| 2 | 2 |
|
| 3 | 3 |
function disable_fields(){
|
| 4 | 4 |
$this = $(this); |
| 5 |
|
|
| 5 | 6 |
$author_info = $this.closest('div').prev();
|
| 6 |
$author_info.children('.description').toggle();
|
|
| 7 |
// $author_info.children('.description').toggle();
|
|
| 7 | 8 |
$author_info.find('p :input').attr("readonly", true);
|
| 8 | 9 |
$author_info.find('p :input').addClass('readonly');
|
| 9 | 10 |
|
| 11 |
// Always hides on save |
|
| 12 |
$this.closest('div').prev().find('p.search_author_tie').hide();
|
|
| 13 |
|
|
| 10 | 14 |
$this.siblings('.author_edit_btn').show();
|
| 11 | 15 |
$this.hide(); |
| 12 | 16 |
|
| ... | ... | |
| 15 | 19 |
|
| 16 | 20 |
function enable_fields(){
|
| 17 | 21 |
$this = $(this); |
| 22 |
|
|
| 18 | 23 |
$author_info = $this.closest('div').prev();
|
| 19 |
$author_info.children('.description').toggle();
|
|
| 24 |
// $author_info.children('.description').toggle();
|
|
| 20 | 25 |
$author_info.find('p :input').attr("readonly", false);
|
| 21 | 26 |
$author_info.find('p :input').removeClass('readonly');
|
| 22 | 27 |
|
| 28 |
// Always shows on edit |
|
| 29 |
$this.closest('div').prev().find('p.search_author_tie').show();
|
|
| 30 |
|
|
| 23 | 31 |
$this.siblings('.author_save_btn').show();
|
| 24 | 32 |
$this.hide(); |
| 25 | 33 |
|
| 26 | 34 |
return false; |
| 27 | 35 |
} |
| 36 |
|
|
| plugins/redmine_bibliography/assets/javascripts/new_publication.js | ||
|---|---|---|
| 4 | 4 |
// adds the events to the edit/save authorship button |
| 5 | 5 |
$('.author_save_btn').live('click', disable_fields);
|
| 6 | 6 |
$('.author_edit_btn').live('click', enable_fields);
|
| 7 |
|
|
| 8 |
|
|
| 7 | 9 |
}); |
Also available in: Unified diff