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

Benjamin Renard commited on 2015-03-09 23:49:10
Showing 1 changed files, with 4 additions and 4 deletions.

... ...
@@ -451,7 +451,7 @@ on_click_add_contributor_btn=function() {
451 451
   $('#add_contributor_modal').data('group-uuid',$('#view-group').data('uuid'))
452 452
   $($('#add_contributor_modal h4')[0]).html('Ajouter un participant');
453 453
   $($('#add_contributor_modal #add_contributor_submit')[0]).html('Ajouter');
454
-  $('#view-group #edit_id')[0].value='-1';
454
+  $('#add_contributor_modal').data('edit-id','-1');
455 455
   $('#add_contributor_modal #add_contributor_email').attr('disabled',false);
456 456
   $('#add_contributor_modal').modal('show');
457 457
 }
... ...
@@ -469,7 +469,7 @@ on_valid_add_contributor_modal=function(e) {
469 469
   e.preventDefault();
470 470
   var group=groups[$('#add_contributor_modal').data('group-uuid')];
471 471
   var name=$('#add_contributor_name')[0].value;
472
-  edit_id=$('#view-group #edit_id')[0].value;
472
+  var edit_id=$('#add_contributor_modal').data('edit-id');
473 473
   if (name=='') {
474 474
     alert('Vous devez saisir un nom !');
475 475
     return;
... ...
@@ -480,7 +480,7 @@ on_valid_add_contributor_modal=function(e) {
480 480
     return;
481 481
   }
482 482
   duplicate=group.contributorByEmail(email)
483
-  if (duplicate!=undefined && edit=='-1') {
483
+  if (duplicate!=undefined && edit_id=='-1') {
484 484
     alert('Un contributor utilise déjà cet email !');
485 485
     return;
486 486
   }
... ...
@@ -510,7 +510,7 @@ on_edit_contributor_btn_click=function(e) {
510 510
   $('#add_contributor_modal').data('group-uuid',group.uuid);
511 511
   contributor_email=$('#view-group #contributor')[0].value;
512 512
   contributor=group.contributorByEmail(contributor_email);
513
-  $('#view-group #edit_id')[0].value=contributor_email;
513
+  $('#add_contributor_modal').data('edit-id',contributor_email);
514 514
   $('#add_contributor_modal #add_contributor_name')[0].value=contributor.name;
515 515
   $('#add_contributor_modal #add_contributor_email')[0].value=contributor.email;
516 516
   $('#add_contributor_modal #add_contributor_email').attr('disabled',true);
517 517