Fix add/edit contributor modal's method to pass contributor ID

This commit is contained in:
Benjamin Renard 2015-03-10 00:49:10 +01:00
parent 0085ea0d55
commit 393fbfd294

View file

@ -451,7 +451,7 @@ on_click_add_contributor_btn=function() {
$('#add_contributor_modal').data('group-uuid',$('#view-group').data('uuid'))
$($('#add_contributor_modal h4')[0]).html('Ajouter un participant');
$($('#add_contributor_modal #add_contributor_submit')[0]).html('Ajouter');
$('#view-group #edit_id')[0].value='-1';
$('#add_contributor_modal').data('edit-id','-1');
$('#add_contributor_modal #add_contributor_email').attr('disabled',false);
$('#add_contributor_modal').modal('show');
}
@ -469,7 +469,7 @@ on_valid_add_contributor_modal=function(e) {
e.preventDefault();
var group=groups[$('#add_contributor_modal').data('group-uuid')];
var name=$('#add_contributor_name')[0].value;
edit_id=$('#view-group #edit_id')[0].value;
var edit_id=$('#add_contributor_modal').data('edit-id');
if (name=='') {
alert('Vous devez saisir un nom !');
return;
@ -480,7 +480,7 @@ on_valid_add_contributor_modal=function(e) {
return;
}
duplicate=group.contributorByEmail(email)
if (duplicate!=undefined && edit=='-1') {
if (duplicate!=undefined && edit_id=='-1') {
alert('Un contributor utilise déjà cet email !');
return;
}
@ -510,7 +510,7 @@ on_edit_contributor_btn_click=function(e) {
$('#add_contributor_modal').data('group-uuid',group.uuid);
contributor_email=$('#view-group #contributor')[0].value;
contributor=group.contributorByEmail(contributor_email);
$('#view-group #edit_id')[0].value=contributor_email;
$('#add_contributor_modal').data('edit-id',contributor_email);
$('#add_contributor_modal #add_contributor_name')[0].value=contributor.name;
$('#add_contributor_modal #add_contributor_email')[0].value=contributor.email;
$('#add_contributor_modal #add_contributor_email').attr('disabled',true);