Fix angular style issues.
This commit is contained in:
parent
032dd9bdc6
commit
a872788def
@ -24,12 +24,12 @@ angular.module('accountant.accounts', [
|
||||
'ngBootbox'
|
||||
])
|
||||
|
||||
.config(['$resourceProvider', function($resourceProvider) {
|
||||
.config(function($resourceProvider) {
|
||||
// Keep trailing slashes to avoid redirect by flask..
|
||||
$resourceProvider.defaults.stripTrailingSlashes = false;
|
||||
}])
|
||||
})
|
||||
|
||||
.factory('Account', ['$resource', function($resource) {
|
||||
.factory('Account', function($resource) {
|
||||
var Account = $resource(
|
||||
'/api/account/:id', {
|
||||
id: '@id'
|
||||
@ -54,16 +54,16 @@ angular.module('accountant.accounts', [
|
||||
};
|
||||
|
||||
return Account;
|
||||
}])
|
||||
})
|
||||
|
||||
.controller('AccountController', function($scope, $ngBootbox, Account, Notification) {
|
||||
var vm=this;
|
||||
|
||||
.controller('AccountController', [
|
||||
'$scope', '$ngBootbox', 'Account', 'Notification',
|
||||
function($scope, $ngBootbox, Account, Notification) {
|
||||
/*
|
||||
* Return the class for an account current value compared to authorized
|
||||
* overdraft.
|
||||
*/
|
||||
$scope.rowClass = function(account) {
|
||||
vm.rowClass = function(account) {
|
||||
// eslint-disable-next-line camelcase
|
||||
if (!account || !account.authorized_overdraft || !account.current) {
|
||||
return;
|
||||
@ -80,7 +80,7 @@ angular.module('accountant.accounts', [
|
||||
/*
|
||||
* Return the class for a value compared to account authorized overdraft.
|
||||
*/
|
||||
$scope.valueClass = function(account, value) {
|
||||
vm.valueClass = function(account, value) {
|
||||
if (!account || !value) {
|
||||
return;
|
||||
}
|
||||
@ -96,7 +96,7 @@ angular.module('accountant.accounts', [
|
||||
/*
|
||||
* Add an empty account.
|
||||
*/
|
||||
$scope.add = function() {
|
||||
vm.add = function() {
|
||||
var account = new Account({
|
||||
// eslint-disable-next-line camelcase
|
||||
authorized_overdraft: 0
|
||||
@ -109,7 +109,7 @@ angular.module('accountant.accounts', [
|
||||
/*
|
||||
* Cancel account edition. Remove it from array if a new one.
|
||||
*/
|
||||
$scope.cancelEdit = function(rowform, account, $index) {
|
||||
vm.cancelEdit = function(rowform, account, $index) {
|
||||
if (account.id) {
|
||||
rowform.$cancel();
|
||||
} else {
|
||||
@ -121,7 +121,7 @@ angular.module('accountant.accounts', [
|
||||
/*
|
||||
* Save account.
|
||||
*/
|
||||
$scope.save = function(account) {
|
||||
vm.save = function(account) {
|
||||
// var account = $scope.accounts[$index];
|
||||
|
||||
// account = angular.merge(account, $data);
|
||||
@ -138,7 +138,7 @@ angular.module('accountant.accounts', [
|
||||
/*
|
||||
* Delete an account.
|
||||
*/
|
||||
$scope.delete = function(account, $index) {
|
||||
vm.delete = function(account, $index) {
|
||||
var id = account.id;
|
||||
|
||||
$ngBootbox.confirm(
|
||||
@ -157,11 +157,10 @@ angular.module('accountant.accounts', [
|
||||
};
|
||||
|
||||
// Load accounts.
|
||||
$scope.accounts = Account.query();
|
||||
}]
|
||||
)
|
||||
vm.accounts = Account.query();
|
||||
})
|
||||
|
||||
.directive('accountFormDialog', function(Account, $ngBootbox, Notification) {
|
||||
.directive('accountFormDialog', function(Account, $ngBootbox, Notification, $log) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
@ -189,7 +188,7 @@ angular.module('accountant.accounts', [
|
||||
angular.copy(scope.data, scope.account);
|
||||
|
||||
// Save account
|
||||
console.log(scope.account);
|
||||
$log.log(scope.account);
|
||||
return scope.account.$save().then(
|
||||
function(data) {
|
||||
Notification.success('Account #' + data.id + ' saved.');
|
||||
@ -201,7 +200,7 @@ angular.module('accountant.accounts', [
|
||||
function(data) {
|
||||
Notification.error('Error while saving account #' + data.id);
|
||||
scope.account.getSolds();
|
||||
console.log(data);
|
||||
$log.log(data);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user