Mercurial > hg > soundsoftware-site
diff plugins/redmine_bibliography/assets/javascripts/authors.js @ 1284:3ce07a57ce68 redmine-2.2-integration
Correctly adds the author info to the input fields; corrected toggle function.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Tue, 14 May 2013 15:51:20 +0100 |
parents | 006057cf8f16 |
children | 22551cc54749 |
line wrap: on
line diff
--- a/plugins/redmine_bibliography/assets/javascripts/authors.js Tue May 14 14:24:45 2013 +0100 +++ b/plugins/redmine_bibliography/assets/javascripts/authors.js Tue May 14 15:51:20 2013 +0100 @@ -15,39 +15,51 @@ } $(".author_search").live('keyup.autocomplete', function(){ - $(this).autocomplete({ + $this = $(this); + + $this.autocomplete({ source: '/publications/autocomplete_for_author', minLength: 2, select: function(event, ui){ - alert("gOtChA " + ui.item.id + " " + ui.item.type); + $this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.value); + $this.closest('div').next().find("input[id$='institution']").val(ui.item.institution); + $this.closest('div').next().find("input[id$='email']").val(ui.item.email); } }); }); + + + function identify_author_status(status, object_id) { $('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) { - if(status == "no"){ - s.value = ""; - s.readOnly = false; - }; - if(status == "correct"){s.readOnly = false;}; - if(status == "yes"){s.readOnly = true;}; + if(status == "no"){ + s.value = ""; + s.readOnly = false; + } + + if(status == "correct"){ + s.readOnly = false; + } + if(status == "yes"){ + s.readOnly = true; + } }); } function toggle_div(div_id){ - Effect.toggle(div_id, "appear", {duration:0.3}); + $("#" + div_id).toggle(0.3); } function toggle_input_field(field){ - if (field.classNames().inspect().include("readonly") == false){ + if (field.classNames().inspect().include("readonly") === false){ field.readOnly = true; field.addClassName('readonly'); } else { field.readOnly = false; field.removeClassName('readonly'); - }; + } } function toggle_edit_save_button(object_id){