Use object attribute for editing.

This commit is contained in:
Alexis Lahouze 2015-07-20 12:59:26 +02:00
parent cf9d15b932
commit 9df93e1ef1
2 changed files with 8 additions and 8 deletions

View File

@ -33,7 +33,7 @@ accountantApp
function($scope, $rootScope, $routeParams, Accounts) {
$scope.valueClass = function(account, value) {
if(!account) {
if(!account || !value) {
return;
}
@ -78,7 +78,7 @@ accountantApp
* Start account edition.
*/
$scope.editAccount = function(account) {
account.edit = true;
account.editing = true;
};
/*

View File

@ -60,10 +60,10 @@
</td>
</tr>
<tr id="account_{{account.id}}" class="form-inline" ng-if="!account.edit" ng-repeat-start="account in accounts">
<tr id="account_{{account.id}}" class="form-inline" ng-if="!account.editing" ng-repeat-start="account in accounts">
<td><a href="account/{{ account.id }}/entries">{{ account.name }}</a></td>
<td>{{ account.current }}</td>
<td>{{ account.pointed }}</td>
<td><span ng-class="valueClass(account, account.current)">{{ account.current }}</span></td>
<td><span ng-class="valueClass(account, account.pointed)">{{ account.pointed }}</span></td>
<td>{{ account.authorized_overdraft }}</td>
<td>
<div class="btn-group">
@ -85,13 +85,13 @@
</td>
</tr>
<tr id="account_{{account.id}}" class="form-inline" ng-if="account.edit" ng-repeat-end>
<tr id="account_{{account.id}}" class="form-inline" ng-if="account.editing" ng-repeat-end>
<td>
<input type="text" class="form-control" ng-model="account.name" />
</td>
<td>{{ account.current }}</td>
<td>{{ account.pointed }}</td>
<td><span ng-class="valueClass(account, account.current)">{{ account.current }}</span></td>
<td><span ng-class="valueClass(account, account.pointed)">{{ account.pointed }}</span></td>
<td>
<input type="text" class="form-control"