Fix angular style issues.

This commit is contained in:
Alexis Lahouze 2016-10-14 07:50:06 +02:00
parent a872788def
commit edac1ee6a9

View File

@ -27,7 +27,7 @@ angular.module('accountant', [
'Storage.Service'
])
.factory('sessionInjector', ['$storage', function($storage) {
.factory('sessionInjector', function($storage) {
var sessionInjector = {
request: function(config) {
var token = $storage.get('token');
@ -43,14 +43,14 @@ angular.module('accountant', [
};
return sessionInjector;
}])
})
.config(['$httpProvider', function($httpProvider) {
.config(function($httpProvider) {
// Define interceptors.
$httpProvider.interceptors.push('sessionInjector');
}])
})
.config(['$routeProvider', function($routeProvider) {
.config(function($routeProvider) {
// Defining template and controller in function of route.
$routeProvider
.when('/account/:accountId/operations', {
@ -71,9 +71,9 @@ angular.module('accountant', [
.otherwise({
redirectTo: '/accounts'
});
}])
})
.config(['$storageProvider', function($storageProvider) {
.config(function($storageProvider) {
// Configure storage
// Set global prefix for stored keys
$storageProvider.setPrefix('accountant');
@ -85,24 +85,24 @@ angular.module('accountant', [
// Change the enabled storage engines
// Defaults to ['memory', 'cookie', 'session', 'local']
$storageProvider.setEnabledStorageEngines(['local', 'session']);
}])
})
.run(function(editableOptions) {
editableOptions.theme = 'bs3'; // bootstrap3 theme. Can be also 'bs2', 'default'
})
.controller('MainController', [
'$scope', '$rootScope', '$http', 'authService', '$storage', '$ngBootbox',
function($scope, $rootScope, $http, authService, $storage, $ngBootbox) {
$scope.dialogShown = false;
.controller('MainController', function($scope, $rootScope, $http, authService, $storage, $ngBootbox) {
var vm = this;
$scope.showLoginForm = function() {
vm.dialogShown = false;
vm.showLoginForm = function() {
// First, if there are registered credentials, use them
if ($scope.dialogShown) {
return;
}
$scope.dialogShown = true;
vm.dialogShown = true;
$storage.clear();
@ -114,7 +114,7 @@ angular.module('accountant', [
label: 'Login',
className: 'btn-primary',
callback: function() {
$scope.dialogShown = false;
vm.dialogShown = false;
var email = $('#email').val();
var password = $('#password').val();
@ -144,15 +144,18 @@ angular.module('accountant', [
className: 'btn-default',
callback: function() {
authService.loginCancelled(null, 'Login cancelled by user action.');
$scope.dialogShown = false;
vm.dialogShown = false;
}
}
}
});
};
$rootScope.$on('event:auth-loginRequired', $scope.showLoginForm);
}
])
var onAuthLoginRequired = $rootScope.$on('event:auth-loginRequired', $scope.showLoginForm);
$scope.$on('$destroy', function() {
onAuthLoginRequired = angular.noop();
});
})
;