view vendor/plugins/redmine_bibliography/assets/javascripts/authors.js @ 575:724c97fc03dc feature_36

Merge from 573:aed210f6095b. Fixing small issue when adding new authors.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 10 Aug 2011 14:40:05 +0100
parents b24091590b63
children c6cfe1f2eac1
line wrap: on
line source
function remove_fields(link) {
  $(link).previous("input[type=hidden]").value = "1";
  $(link).up(".fields").hide();
}

function add_fields(link, association, content) {
  var new_id = new Date().getTime();
  var regexp = new RegExp("new_" + association, "g")
  $(link).insert({
    before: content.replace(regexp, new_id)
  });
}

function update_author_info(link, author_info){
		
	$(link).up('div').up('div').select('input[id^=publication_authorships_attributes]').each(
		function(e){
			key = e.name.split("[").last().trim().sub(']','');
			
			// test for undefined			
			e.value = author_info[key];
		}		
	)
}