Replace usage of view-group h1 HTML content as group name reference by an input[type=hidden]
This commit is contained in:
parent
1db9f37d04
commit
0da244586b
2 changed files with 13 additions and 11 deletions
21
inc/myco.js
21
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);
|
||||
|
||||
}
|
||||
|
|
|
@ -74,8 +74,9 @@ body{
|
|||
<div class="container">
|
||||
|
||||
<div id='view-group' class='part hidden-part'>
|
||||
<h1>Noël</h1>
|
||||
<h1><span>Noël</span><small><span id='edit_group_btn' class='glyphicon glyphicon-edit btn btn-sm'></span></small></h1>
|
||||
<form class="form-horizontal" role="form">
|
||||
<input type='hidden' id='group_name' value='Noël'/>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Participant</span>
|
||||
|
|
Loading…
Reference in a new issue