Rename.
This commit is contained in:
parent
41647324ef
commit
50a192dbec
@ -19,7 +19,7 @@
|
||||
// The AccountController.
|
||||
accountantApp
|
||||
|
||||
.factory("Accounts", ["$resource", function($resource) {
|
||||
.factory("Account", ["$resource", function($resource) {
|
||||
return $resource(
|
||||
"/api/accounts/:id", {
|
||||
id: "@id"
|
||||
@ -29,8 +29,8 @@ accountantApp
|
||||
|
||||
.controller(
|
||||
"AccountController", [
|
||||
"$scope", "Accounts", "notificationService",
|
||||
function($scope, Accounts, notificationService) {
|
||||
"$scope", "Account", "notificationService",
|
||||
function($scope, Account, notificationService) {
|
||||
|
||||
/*
|
||||
* Return the class for an account current value compared to authorized
|
||||
@ -66,9 +66,11 @@ accountantApp
|
||||
/*
|
||||
* Add an empty account if not already added.
|
||||
*/
|
||||
$scope.addAccount = function() {
|
||||
var account = new Accounts();
|
||||
account.authorized_overdraft = 0;
|
||||
$scope.add = function() {
|
||||
var account = new Account({
|
||||
authorized_overdraft: 0
|
||||
});
|
||||
|
||||
$scope.accounts.splice(0, 0, account);
|
||||
};
|
||||
|
||||
@ -86,7 +88,7 @@ accountantApp
|
||||
/*
|
||||
* Save account.
|
||||
*/
|
||||
$scope.saveAccount = function($data, $index) {
|
||||
$scope.save = function($data, $index) {
|
||||
var account = $scope.accounts[$index];
|
||||
|
||||
account = angular.merge(account, $data);
|
||||
@ -120,9 +122,9 @@ accountantApp
|
||||
};
|
||||
|
||||
/*
|
||||
* Delete an account and emit accountDeletedEvent.
|
||||
* Delete an account.
|
||||
*/
|
||||
$scope.deleteAccount = function(account, $index) {
|
||||
$scope.delete = function(account, $index) {
|
||||
var id = account.id;
|
||||
|
||||
bootbox.confirm(
|
||||
@ -141,5 +143,5 @@ accountantApp
|
||||
};
|
||||
|
||||
// Load accounts.
|
||||
$scope.accounts = Accounts.query();
|
||||
$scope.accounts = Account.query();
|
||||
}]);
|
||||
|
@ -31,7 +31,7 @@
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-success btn-success"
|
||||
ng-click="addAccount()">Ajouter</button>
|
||||
ng-click="add()">Ajouter</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
|
||||
<td>
|
||||
<form editable-form name="rowform"
|
||||
onbeforesave="saveAccount($data, $index)" shown="!account.id">
|
||||
onbeforesave="save($data, $index)" shown="!account.id">
|
||||
<div class="btn-group btn-group-xs">
|
||||
<!-- Edit account. -->
|
||||
<button type="button" class="btn btn-success"
|
||||
@ -95,7 +95,7 @@
|
||||
<!-- Delete account, with confirm. -->
|
||||
<button type="button" class="btn btn-default"
|
||||
ng-if="account.id"
|
||||
ng-click="deleteAccount(account, $index)">
|
||||
ng-click="delete(account, $index)">
|
||||
<span class="fa fa-trash-o"></span>
|
||||
</button>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user