Revision 1284:3ce07a57ce68 plugins/redmine_bibliography/assets

View differences:

plugins/redmine_bibliography/assets/javascripts/authors.js
15 15
}
16 16

  
17 17
$(".author_search").live('keyup.autocomplete', function(){
18
     $(this).autocomplete({
18
     $this = $(this);
19

  
20
     $this.autocomplete({
19 21
        source: '/publications/autocomplete_for_author',
20 22
        minLength: 2,
21 23
        select: function(event, ui){
22
            alert("gOtChA " + ui.item.id + " " + ui.item.type);
24
            $this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.value);
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);
23 27
        }
24 28
    });
25 29
});
26 30

  
31

  
32

  
33

  
27 34
function identify_author_status(status, object_id) {
28 35
    $('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) {
29
	if(status == "no"){
30
	    s.value = "";
31
	    s.readOnly = false;
32
	};
33 36

  
34
	if(status == "correct"){s.readOnly = false;};
35
	if(status == "yes"){s.readOnly = true;};
37
        if(status == "no"){
38
            s.value = "";
39
            s.readOnly = false;
40
        }
41

  
42
        if(status == "correct"){
43
            s.readOnly = false;
44
        }
45
        if(status == "yes"){
46
            s.readOnly = true;
47
        }
36 48
    });
37 49
}
38 50

  
39 51
function toggle_div(div_id){
40
    Effect.toggle(div_id, "appear", {duration:0.3});
52
    $("#" + div_id).toggle(0.3);
41 53
}
42 54

  
43 55
function toggle_input_field(field){
44
    if (field.classNames().inspect().include("readonly") == false){
56
    if (field.classNames().inspect().include("readonly") === false){
45 57
			field.readOnly = true;
46 58
			field.addClassName('readonly');
47 59
    } else {
48 60
			field.readOnly = false;
49 61
			field.removeClassName('readonly');
50
    };
62
    }
51 63
}
52 64

  
53 65
function toggle_edit_save_button(object_id){

Also available in: Unified diff