Use object attribute for editing.
This commit is contained in:
parent
cf9d15b932
commit
9df93e1ef1
@ -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;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user