Benjamin Renard commited on 2014-01-12 00:12:06
Showing 3 changed files, with 23 additions and 14 deletions.
| ... | ... |
@@ -305,8 +303,6 @@ on_contribution_edit_btn_click=function(e) {
|
| 305 | 303 |
contribution_id=$($(e.target).parents('div')[0]).data('id');
|
| 306 | 304 |
contribution=group.contributions[contribution_id]; |
| 307 | 305 |
$('#add_contribution_modal #add_contribution_contributor_name')[0].value=contribution.contributor.name;
|
| 308 |
- console.log($('#add_contribution_modal #add_contribution_contributor_name')[0]);
|
|
| 309 |
- console.log(contribution.contributor.name); |
|
| 310 | 306 |
$('#add_contribution_modal #add_contribution_title')[0].value=contribution.getTitle();
|
| 311 | 307 |
$('#add_contribution_modal #add_contribution_cost')[0].value=contribution.cost;
|
| 312 | 308 |
$('#add_contribution_modal #add_contribution_date')[0].value=moment(contribution.date).format('DD/MM/YYYY');
|
| ... | ... |
@@ -79,6 +79,9 @@ function Group(name,data) {
|
| 79 | 79 |
}; |
| 80 | 80 |
} |
| 81 | 81 |
|
| 82 |
+ /* |
|
| 83 |
+ * Contributors |
|
| 84 |
+ */ |
|
| 82 | 85 |
this.removeContributor=function(c) {
|
| 83 | 86 |
this.contributors=this.contributors.filter(function(v){
|
| 84 | 87 |
return (v.name!=c); |
| ... | ... |
@@ -99,6 +102,19 @@ function Group(name,data) {
|
| 99 | 102 |
return undefined; |
| 100 | 103 |
} |
| 101 | 104 |
|
| 105 |
+ this.addContributor=function(c) {
|
|
| 106 |
+ c.id=this.contributors.length; |
|
| 107 |
+ this.contributors.push(c); |
|
| 108 |
+ } |
|
| 109 |
+ |
|
| 110 |
+ this.replaceContributor=function(idx,c) {
|
|
| 111 |
+ c.id=idx; |
|
| 112 |
+ this.contributors[idx]=c; |
|
| 113 |
+ } |
|
| 114 |
+ |
|
| 115 |
+ /* |
|
| 116 |
+ * Contributions |
|
| 117 |
+ */ |
|
| 102 | 118 |
this.contributionsByContributorName=function(name) {
|
| 103 | 119 |
var ret=[]; |
| 104 | 120 |
for (idx in this.contributions) {
|
| ... | ... |
@@ -119,16 +135,9 @@ function Group(name,data) {
|
| 119 | 135 |
this.contributions[idx]=c; |
| 120 | 136 |
} |
| 121 | 137 |
|
| 122 |
- this.addContributor=function(c) {
|
|
| 123 |
- c.id=this.contributors.length; |
|
| 124 |
- this.contributors.push(c); |
|
| 125 |
- } |
|
| 126 |
- |
|
| 127 |
- this.replaceContributor=function(idx,c) {
|
|
| 128 |
- c.id=idx; |
|
| 129 |
- this.contributors[idx]=c; |
|
| 130 |
- } |
|
| 131 |
- |
|
| 138 |
+ /* |
|
| 139 |
+ * Balance |
|
| 140 |
+ */ |
|
| 132 | 141 |
this.balance=function() {
|
| 133 | 142 |
ret={}
|
| 134 | 143 |
for (idx in this.contributors) {
|
| ... | ... |
@@ -143,6 +152,9 @@ function Group(name,data) {
|
| 143 | 152 |
return ret; |
| 144 | 153 |
} |
| 145 | 154 |
|
| 155 |
+ /* |
|
| 156 |
+ * Contructor |
|
| 157 |
+ */ |
|
| 146 | 158 |
if (jQuery.type(data)=='object') {
|
| 147 | 159 |
try {
|
| 148 | 160 |
this.name=data.name; |
| ... | ... |
@@ -167,6 +179,7 @@ function Group(name,data) {
|
| 167 | 179 |
} |
| 168 | 180 |
} |
| 169 | 181 |
} |
| 182 |
+ } |
|
| 170 | 183 |
catch (e) {
|
| 171 | 184 |
alert('Une erreur est survenue en chargeant le groupe '+this.name+' depuis le cache');
|
| 172 | 185 |
} |
| ... | ... |
@@ -60,8 +60,6 @@ body{
|
| 60 | 60 |
<li class="dropdown"> |
| 61 | 61 |
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Groupe <b class="caret"></b></a> |
| 62 | 62 |
<ul id="group-choice" class="dropdown-menu"> |
| 63 |
- <li><a class='group-choice'>Quotidien</a></li> |
|
| 64 |
- <li><a class='group-choice'>Noël</a></li> |
|
| 65 | 63 |
<li class="divider"></li> |
| 66 | 64 |
<li><a href="#" id='add_group_btn' data-toggle="modal" data-target="#add_group_modal">Nouveau</a></li> |
| 67 | 65 |
</ul> |
| 68 | 66 |