Fix edit/del contrib btn binding

This commit is contained in:
Benjamin Renard 2015-03-10 00:23:57 +01:00
parent 668ec09cad
commit c939ca1cb7

View file

@ -185,9 +185,6 @@ show_contributions=function(group,contributor_email,contributions) {
_current_displayed_contributions_group=group; _current_displayed_contributions_group=group;
show_more_contributions(); show_more_contributions();
$('.contribution_delete_btn').bind('click',on_contribution_delete_btn_click);
$('.contribution_edit_btn').bind('click',on_contribution_edit_btn_click);
} }
show_more_contributions=function(count) { show_more_contributions=function(count) {
@ -211,7 +208,12 @@ show_more_contributions=function(count) {
cat='<br/><span class="category"><span class="cat-color" style="background-color: '+_current_displayed_contributions_group.categories[_current_displayed_contributions[idx].category]['color']+'"></span> '+_current_displayed_contributions_group.categories[_current_displayed_contributions[idx].category]['name']+"</span>"; cat='<br/><span class="category"><span class="cat-color" style="background-color: '+_current_displayed_contributions_group.categories[_current_displayed_contributions[idx].category]['color']+'"></span> '+_current_displayed_contributions_group.categories[_current_displayed_contributions[idx].category]['name']+"</span>";
} }
col_actions='<td><div class="btn-group" data-uuid="'+_current_displayed_contributions[idx].uuid+'"><button type="button" class="btn btn-default btn-sm contribution_edit_btn"><span class="glyphicon glyphicon-edit"></span></button><button type="button" class="btn btn-default btn-sm contribution_delete_btn"><span class="glyphicon glyphicon-trash"></span></button></div></td>'; col_actions='<td><div class="btn-group" data-uuid="'+_current_displayed_contributions[idx].uuid+'"><button type="button" class="btn btn-default btn-sm contribution_edit_btn"><span class="glyphicon glyphicon-edit"></span></button><button type="button" class="btn btn-default btn-sm contribution_delete_btn"><span class="glyphicon glyphicon-trash"></span></button></div></td>';
tbody.append('<tr><td>'+_current_displayed_contributions[idx].getTitle()+cat+'</td><td>'+_current_displayed_contributions[idx].cost.toFixed(2)+' €<br/><span class="date">'+moment(_current_displayed_contributions[idx].date).format('DD/MM/YYYY')+'</span></td>'+col_actions+'</tr>'); var tr=$('<tr><td>'+_current_displayed_contributions[idx].getTitle()+cat+'</td><td>'+_current_displayed_contributions[idx].cost.toFixed(2)+' €<br/><span class="date">'+moment(_current_displayed_contributions[idx].date).format('DD/MM/YYYY')+'</span></td>'+col_actions+'</tr>');
tr.find('.contribution_delete_btn').bind('click',on_contribution_delete_btn_click);
tr.find('.contribution_edit_btn').bind('click',on_contribution_edit_btn_click);
tbody.append(tr);
} }
} }
} }