From 393fbfd294aa1e9a0ae93226fe287438879836f5 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 10 Mar 2015 00:49:10 +0100 Subject: [PATCH] Fix add/edit contributor modal's method to pass contributor ID --- inc/myco.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/myco.js b/inc/myco.js index 2579afb..dcde4c4 100644 --- a/inc/myco.js +++ b/inc/myco.js @@ -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);