Benjamin Renard commited on 2014-01-06 02:03:17
Showing 2 changed files, with 13 additions and 11 deletions.
... | ... |
@@ -59,7 +59,8 @@ on_group_choice_click=function(e) { |
59 | 59 |
* View group |
60 | 60 |
****************/ |
61 | 61 |
view_group=function(group) { |
62 |
- $('#view-group h1').html(group.name); |
|
62 |
+ $('#view-group h1 span:first').html(group.name); |
|
63 |
+ $('#view-group #group_name')[0].value=group.name; |
|
63 | 64 |
set_contributors(group); |
64 | 65 |
on_contributor_change(); |
65 | 66 |
$('#view-group').css('display','block'); |
... | ... |
@@ -78,7 +79,7 @@ set_contributors=function(group) { |
78 | 79 |
} |
79 | 80 |
|
80 | 81 |
on_contributor_change=function(e) { |
81 |
- show_contributions(groups[$('#view-group h1').html()],$('#view-group #contributor')[0].value); |
|
82 |
+ show_contributions(groups[$('#view-group #group_name')[0].value],$('#view-group #contributor')[0].value); |
|
82 | 83 |
} |
83 | 84 |
|
84 | 85 |
show_contributions=function(group,contributor_name) { |
... | ... |
@@ -108,7 +109,7 @@ show_contributions=function(group,contributor_name) { |
108 | 109 |
* Add contributor |
109 | 110 |
*********************/ |
110 | 111 |
on_click_add_contributor_btn=function() { |
111 |
- $('#add_contributor_modal #group_name')[0].value=$($('#view-group h1')[0]).html(); |
|
112 |
+ $('#add_contributor_modal #group_name')[0].value=$('#view-group #group_name')[0].value; |
|
112 | 113 |
$('#add_contributor_modal').modal('show'); |
113 | 114 |
} |
114 | 115 |
|
... | ... |
@@ -157,7 +158,7 @@ on_click_del_contributor_btn=function() { |
157 | 158 |
} |
158 | 159 |
|
159 | 160 |
on_confirm_del_contributor=function(contributor) { |
160 |
- var group=groups[$($('#view-group h1')[0]).html()]; |
|
161 |
+ var group=groups[$('#view-group #group_name')[0].value]; |
|
161 | 162 |
group.removeContributor(contributor); |
162 | 163 |
set_contributors(group); |
163 | 164 |
groups.save(); |
... | ... |
@@ -177,7 +178,7 @@ on_show_add_contribution_modal=function(e) { |
177 | 178 |
} |
178 | 179 |
|
179 | 180 |
on_click_add_contribution_btn=function() { |
180 |
- $('#add_contribution_modal #group_name')[0].value=$($('#view-group h1')[0]).html(); |
|
181 |
+ $('#add_contribution_modal #group_name')[0].value=$('#view-group #group_name')[0].value; |
|
181 | 182 |
$('#add_contribution_modal #edit_id')[0].value='-1'; |
182 | 183 |
$('#add_contribution_modal').modal('show'); |
183 | 184 |
} |
... | ... |
@@ -245,7 +246,7 @@ on_close_add_contribution_modal=function () { |
245 | 246 |
} |
246 | 247 |
|
247 | 248 |
on_contribution_delete_btn_click=function(e) { |
248 |
- var group=groups[$($('#view-group h1')[0]).html()]; |
|
249 |
+ var group=groups[$('#view-group #group_name')[0].value]; |
|
249 | 250 |
contribution_id=$($(e.target).parents('div')[0]).data('id'); |
250 | 251 |
contribution=group.contributions[contribution_id]; |
251 | 252 |
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) { |
258 | 259 |
} |
259 | 260 |
|
260 | 261 |
on_contribution_edit_btn_click=function(e) { |
261 |
- var group=groups[$($('#view-group h1')[0]).html()]; |
|
262 |
- $('#add_contribution_modal #group_name')[0].value=$($('#view-group h1')[0]).html(); |
|
262 |
+ var group=groups[$('#view-group #group_name')[0].value]; |
|
263 |
+ $('#add_contribution_modal #group_name')[0].value=$('#view-group #group_name')[0].value; |
|
263 | 264 |
contribution_id=$($(e.target).parents('div')[0]).data('id'); |
264 | 265 |
contribution=group.contributions[contribution_id]; |
265 | 266 |
$('#add_contribution_modal #add_contribution_contributor_name')[0].value=contribution.contributor.name; |
... | ... |
@@ -291,7 +292,7 @@ on_confirm_clear_local_data=function(data) { |
291 | 292 |
*********************/ |
292 | 293 |
|
293 | 294 |
on_display_balance_btn_click=function(e) { |
294 |
- group=groups[$($('#view-group h1')[0]).html()]; |
|
295 |
+ group=groups[$('#view-group #group_name')[0].value]; |
|
295 | 296 |
display_balance(group); |
296 | 297 |
} |
297 | 298 |
|
... | ... |
@@ -313,7 +314,7 @@ display_balance=function(group) { |
313 | 314 |
*********************/ |
314 | 315 |
|
315 | 316 |
on_remove_group_btn_click=function(e) { |
316 |
- group=groups[$($('#view-group h1')[0]).html()]; |
|
317 |
+ group=groups[$('#view-group #group_name')[0].value]; |
|
317 | 318 |
myconfirm('Etes-vous sûre de vouloir supprimer le group '+group.name+' ?',on_confirm_remove_group,null,group); |
318 | 319 |
|
319 | 320 |
} |
... | ... |
@@ -74,8 +74,9 @@ body{ |
74 | 74 |
<div class="container"> |
75 | 75 |
|
76 | 76 |
<div id='view-group' class='part hidden-part'> |
77 |
- <h1>Noël</h1> |
|
77 |
+ <h1><span>Noël</span><small><span id='edit_group_btn' class='glyphicon glyphicon-edit btn btn-sm'></span></small></h1> |
|
78 | 78 |
<form class="form-horizontal" role="form"> |
79 |
+ <input type='hidden' id='group_name' value='Noël'/> |
|
79 | 80 |
<div class="form-group"> |
80 | 81 |
<div class="input-group"> |
81 | 82 |
<span class="input-group-addon">Participant</span> |
82 | 83 |