diff --git a/inc/myco.js b/inc/myco.js index bfce0a8..a28c49c 100644 --- a/inc/myco.js +++ b/inc/myco.js @@ -59,7 +59,8 @@ on_group_choice_click=function(e) { * View group ****************/ view_group=function(group) { - $('#view-group h1').html(group.name); + $('#view-group h1 span:first').html(group.name); + $('#view-group #group_name')[0].value=group.name; set_contributors(group); on_contributor_change(); $('#view-group').css('display','block'); @@ -78,7 +79,7 @@ set_contributors=function(group) { } on_contributor_change=function(e) { - show_contributions(groups[$('#view-group h1').html()],$('#view-group #contributor')[0].value); + show_contributions(groups[$('#view-group #group_name')[0].value],$('#view-group #contributor')[0].value); } show_contributions=function(group,contributor_name) { @@ -108,7 +109,7 @@ show_contributions=function(group,contributor_name) { * Add contributor *********************/ on_click_add_contributor_btn=function() { - $('#add_contributor_modal #group_name')[0].value=$($('#view-group h1')[0]).html(); + $('#add_contributor_modal #group_name')[0].value=$('#view-group #group_name')[0].value; $('#add_contributor_modal').modal('show'); } @@ -157,7 +158,7 @@ on_click_del_contributor_btn=function() { } on_confirm_del_contributor=function(contributor) { - var group=groups[$($('#view-group h1')[0]).html()]; + var group=groups[$('#view-group #group_name')[0].value]; group.removeContributor(contributor); set_contributors(group); groups.save(); @@ -177,7 +178,7 @@ on_show_add_contribution_modal=function(e) { } on_click_add_contribution_btn=function() { - $('#add_contribution_modal #group_name')[0].value=$($('#view-group h1')[0]).html(); + $('#add_contribution_modal #group_name')[0].value=$('#view-group #group_name')[0].value; $('#add_contribution_modal #edit_id')[0].value='-1'; $('#add_contribution_modal').modal('show'); } @@ -245,7 +246,7 @@ on_close_add_contribution_modal=function () { } on_contribution_delete_btn_click=function(e) { - var group=groups[$($('#view-group h1')[0]).html()]; + var group=groups[$('#view-group #group_name')[0].value]; contribution_id=$($(e.target).parents('div')[0]).data('id'); contribution=group.contributions[contribution_id]; myconfirm('Etes-vous sûre de vouloir supprimer la participation '+contribution.getTitle()+' de '+contribution.contributor.name+' ?',on_confirm_contribution_delete,null,{'group':group,'contribution_id':contribution_id, 'contribution': contribution} ); @@ -258,8 +259,8 @@ on_confirm_contribution_delete=function(data) { } on_contribution_edit_btn_click=function(e) { - var group=groups[$($('#view-group h1')[0]).html()]; - $('#add_contribution_modal #group_name')[0].value=$($('#view-group h1')[0]).html(); + var group=groups[$('#view-group #group_name')[0].value]; + $('#add_contribution_modal #group_name')[0].value=$('#view-group #group_name')[0].value; contribution_id=$($(e.target).parents('div')[0]).data('id'); contribution=group.contributions[contribution_id]; $('#add_contribution_modal #add_contribution_contributor_name')[0].value=contribution.contributor.name; @@ -291,7 +292,7 @@ on_confirm_clear_local_data=function(data) { *********************/ on_display_balance_btn_click=function(e) { - group=groups[$($('#view-group h1')[0]).html()]; + group=groups[$('#view-group #group_name')[0].value]; display_balance(group); } @@ -313,7 +314,7 @@ display_balance=function(group) { *********************/ on_remove_group_btn_click=function(e) { - group=groups[$($('#view-group h1')[0]).html()]; + group=groups[$('#view-group #group_name')[0].value]; myconfirm('Etes-vous sûre de vouloir supprimer le group '+group.name+' ?',on_confirm_remove_group,null,group); } diff --git a/index.html b/index.html index 6a1f256..32d627b 100644 --- a/index.html +++ b/index.html @@ -74,8 +74,9 @@ body{
-

Noël

+

Noël

+
Participant