Mercurial > hg > soundsoftware-site
annotate vendor/plugins/redmine_bibliography/assets/javascripts/authors.js @ 518:b24091590b63 feature_36
virtual attribute to handle users; javascript handling users correctly
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 14 Jul 2011 17:10:24 +0100 |
parents | ea8b8768b4a0 |
children | 724c97fc03dc |
rev | line source |
---|---|
luis@469 | 1 function remove_fields(link) { |
luis@469 | 2 $(link).previous("input[type=hidden]").value = "1"; |
luis@469 | 3 $(link).up(".fields").hide(); |
luis@469 | 4 } |
luis@469 | 5 |
luis@468 | 6 function add_fields(link, association, content) { |
luis@468 | 7 var new_id = new Date().getTime(); |
luis@468 | 8 var regexp = new RegExp("new_" + association, "g") |
luis@469 | 9 $(link).up().insert({ |
luis@469 | 10 before: content.replace(regexp, new_id) |
luis@469 | 11 }); |
luis@481 | 12 } |
luis@481 | 13 |
luis@482 | 14 function update_author_info(link, author_info){ |
luis@518 | 15 |
luis@482 | 16 $(link).up('div').up('div').select('input[id^=publication_authorships_attributes]').each( |
luis@482 | 17 function(e){ |
luis@518 | 18 key = e.name.split("[").last().trim().sub(']',''); |
luis@518 | 19 |
luis@518 | 20 // test for undefined |
luis@482 | 21 e.value = author_info[key]; |
luis@482 | 22 } |
luis@482 | 23 ) |
luis@467 | 24 } |