Use object attribute for editing.
This commit is contained in:
parent
cf9d15b932
commit
9df93e1ef1
@ -33,7 +33,7 @@ accountantApp
|
|||||||
function($scope, $rootScope, $routeParams, Accounts) {
|
function($scope, $rootScope, $routeParams, Accounts) {
|
||||||
|
|
||||||
$scope.valueClass = function(account, value) {
|
$scope.valueClass = function(account, value) {
|
||||||
if(!account) {
|
if(!account || !value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ accountantApp
|
|||||||
* Start account edition.
|
* Start account edition.
|
||||||
*/
|
*/
|
||||||
$scope.editAccount = function(account) {
|
$scope.editAccount = function(account) {
|
||||||
account.edit = true;
|
account.editing = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -60,10 +60,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</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><a href="account/{{ account.id }}/entries">{{ account.name }}</a></td>
|
||||||
<td>{{ account.current }}</td>
|
<td><span ng-class="valueClass(account, account.current)">{{ account.current }}</span></td>
|
||||||
<td>{{ account.pointed }}</td>
|
<td><span ng-class="valueClass(account, account.pointed)">{{ account.pointed }}</span></td>
|
||||||
<td>{{ account.authorized_overdraft }}</td>
|
<td>{{ account.authorized_overdraft }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
@ -85,13 +85,13 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>
|
<td>
|
||||||
<input type="text" class="form-control" ng-model="account.name" />
|
<input type="text" class="form-control" ng-model="account.name" />
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>{{ account.current }}</td>
|
<td><span ng-class="valueClass(account, account.current)">{{ account.current }}</span></td>
|
||||||
<td>{{ account.pointed }}</td>
|
<td><span ng-class="valueClass(account, account.pointed)">{{ account.pointed }}</span></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<input type="text" class="form-control"
|
<input type="text" class="form-control"
|
||||||
|
Loading…
Reference in New Issue
Block a user