To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / vendor / plugins / redmine_bibliography / assets / javascripts / authors.js @ 723:d41bf754c0f2

History | View | Annotate | Download (2.13 KB)

1 469:ae87ae455cfb luis
function remove_fields(link) {
2 623:a434a588f16c chris
    $(link).previous("input[type=hidden]").value = "1";
3
    $(link).up(".fields").hide();
4 469:ae87ae455cfb luis
}
5
6 468:0bb9c7baed07 luis
function add_fields(link, association, content) {
7 623:a434a588f16c chris
    var new_id = new Date().getTime();
8
    var regexp = new RegExp("new_" + association, "g")
9
    $(link).insert({
10
        before: content.replace(regexp, new_id)
11
    });
12 481:dd242ea99fd3 luis
}
13
14 600:c3c1091639ad luis
function identify_author_status(status, object_id) {
15 623:a434a588f16c chris
    $('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) {
16
        if(status == "no"){
17
            s.value = "";
18
            s.readOnly = false;
19
        };
20
21
        if(status == "correct"){s.readOnly = false;};
22
        if(status == "yes"){s.readOnly = true;};
23
    });
24 600:c3c1091639ad luis
}
25 603:7b39f35803f3 luis
26
function toggle_div(div_id){
27 623:a434a588f16c chris
    Effect.toggle(div_id, "appear", {duration:0.3});
28 603:7b39f35803f3 luis
}
29
30 605:8fc59e8ddd63 luis
function toggle_input_field(field){
31 623:a434a588f16c chris
    if (field.classNames().inspect().include("readonly") == false){
32 675:fccacd8505e3 luis
                        field.readOnly = true;
33
                        field.addClassName('readonly');
34 623:a434a588f16c chris
    } else {
35 675:fccacd8505e3 luis
                        field.readOnly = false;
36
                        field.removeClassName('readonly');
37 623:a434a588f16c chris
    };
38 603:7b39f35803f3 luis
}
39
40 605:8fc59e8ddd63 luis
function toggle_edit_save_button(object_id){
41 623:a434a588f16c chris
    $button = $('publication_authorships_attributes_' + object_id + '_edit_save_button');
42
    if ($button.value == "Edit author"){
43
        $button.value = "Save author";
44
    } else {
45
        $button.value = "Edit author";
46
    };
47 605:8fc59e8ddd63 luis
}
48
49
function toggle_save_author(form_object_id, $this){
50 623:a434a588f16c chris
    $('publication_authorships_attributes_' + form_object_id + '_edit_author_info').select('input').each(function(s) {
51
        toggle_input_field(s, $this);
52
    });
53 624:11c8e189f8fc chris
    $('publication_authorships_attributes_' + form_object_id + '_edit_author_info').select('p.description').each(function(s) {
54 623:a434a588f16c chris
        s.toggle();
55
    });
56
    toggle_edit_save_button(form_object_id);
57
    toggle_div("publication_authorships_attributes_" + form_object_id +"_search_author");
58 603:7b39f35803f3 luis
}
59
60 699:2b665b7e67f4 luis
function hide_all_bibtex_required_fields(){$$('p.bibtex').each(function(s){s.hide()})}
61 603:7b39f35803f3 luis
62 699:2b665b7e67f4 luis
// entrytype_fields is a jsno array with the fields requires by the selected bibtex entry
63
function show_required_bibtex_fields(entrytype_fields) {
64
        $$('p.bibtex').each(function(s){
65
                if(entrytype_fields.indexOf(s.down('input').id.split('_').last()) != -1){
66
                        s.show();
67
                        }
68
                else {
69
                        s.hide();
70
                        }
71 684:cd7e10c4ab86 luis
        })
72
}