view vendor/plugins/redmine_bibliography/assets/javascripts/authors.js @ 519:3be6bc3c2a17 feature_36

Correctly searches and sends the parameters for both users and authors.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 15 Jul 2011 17:21:05 +0100
parents b24091590b63
children 724c97fc03dc
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).up().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];
		}		
	)
}