TG-118 : move OLA/.gitignore to OLA/backend/gitignore (import scripts file)
This commit is contained in:
parent
33644596ec
commit
ab583fb496
@ -50,6 +50,7 @@
|
||||
<!-- build:js({.tmp,app}) scripts/scripts.js -->
|
||||
<script src="scripts/app.js"></script>
|
||||
<script src="scripts/controllers/login.js"></script>
|
||||
<script src="scripts/controllers/userSpace.js"></script>
|
||||
<!-- endbuild -->
|
||||
</body>
|
||||
</html>
|
||||
|
39
frontend/app/scripts/app.js
Executable file
39
frontend/app/scripts/app.js
Executable file
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name clientApp
|
||||
* @description
|
||||
* # clientApp
|
||||
*
|
||||
* Main module of the application.
|
||||
*/
|
||||
var app = angular.module('clientApp', [
|
||||
'ngAnimate',
|
||||
'ngCookies',
|
||||
'ngSanitize',
|
||||
'ngMaterial',
|
||||
'ui.router'
|
||||
]);
|
||||
|
||||
app.config(function ($stateProvider, $urlRouterProvider) {
|
||||
|
||||
//Set default route
|
||||
$urlRouterProvider.otherwise('/login');
|
||||
|
||||
//Common state
|
||||
$stateProvider
|
||||
|
||||
// Common state ------------------------------------------------------------------
|
||||
.state('login', {
|
||||
url: '/login',
|
||||
templateUrl: 'views/login.html',
|
||||
controller: 'LoginCtrl'
|
||||
})
|
||||
|
||||
.state('userspace', {
|
||||
url: '/espace-etudiant',
|
||||
templateUrl: 'views/userSpace.html',
|
||||
controller: 'UserSpaceCtrl'
|
||||
});
|
||||
});
|
27
frontend/app/scripts/controllers/login.js
Executable file
27
frontend/app/scripts/controllers/login.js
Executable file
@ -0,0 +1,27 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name frontendApp.controller:MainCtrl
|
||||
* @description
|
||||
* # MainCtrl
|
||||
* Controller of the frontendApp
|
||||
*/
|
||||
angular.module('clientApp')
|
||||
.controller('LoginCtrl', function ($scope, $state) {
|
||||
|
||||
$scope.login = login;
|
||||
|
||||
// Public methods -------------------
|
||||
|
||||
function login() {
|
||||
console.log('login');
|
||||
|
||||
$state.go('userspace');
|
||||
}
|
||||
|
||||
// Private methods ------------------
|
||||
});
|
||||
|
||||
})();
|
22
frontend/app/scripts/controllers/userSpace.js
Executable file
22
frontend/app/scripts/controllers/userSpace.js
Executable file
@ -0,0 +1,22 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('clientApp')
|
||||
.controller('UserSpaceCtrl', ['$scope', '$state',
|
||||
function ($scope, $state) {
|
||||
|
||||
init();
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function init() {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Public method -------------------------------------------------
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
}]);
|
||||
|
||||
})();
|
52
frontend/app/scripts/services/DataService.js
Executable file
52
frontend/app/scripts/services/DataService.js
Executable file
@ -0,0 +1,52 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('clientApp')
|
||||
.factory('DataService', ['$http', '$q',
|
||||
function ($http, $q) {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PUBLIC API.
|
||||
// ---------------------------------------------------------------------------
|
||||
return ({
|
||||
login: login,
|
||||
logout: logout
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PUBLIC METHODS.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function login(credentials) {
|
||||
// var request = $http.post(apiServer + '/api/AppUsers/login', credentials);
|
||||
// return request.then(handleSuccess, handleError);
|
||||
}
|
||||
|
||||
function logout() {
|
||||
// var request = $http.post(apiServer + '/api/AppUsers/logout', {});
|
||||
// return request.then(handleSuccess, handleError);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PRIVATE METHODS.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function handleSuccess(response) {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
function handleError(response) {
|
||||
if (response.data === '' ||
|
||||
!angular.isDefined(response.status) ||
|
||||
response.statusText === '') {
|
||||
|
||||
return ($q.reject("An unknown error occurred."));
|
||||
}
|
||||
|
||||
// Otherwise, use expected error message.
|
||||
return ($q.reject('Error ' + response.status + ' (' + response.statusText + '): ' + response.data));
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
})();
|
Reference in New Issue
Block a user