TG-118 : move OLA/.gitignore to OLA/backend/gitignore (import scripts file)

This commit is contained in:
mpenchenat 2017-03-13 15:44:34 +01:00
parent 33644596ec
commit ab583fb496
5 changed files with 141 additions and 0 deletions

View File

@ -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
View 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'
});
});

View 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 ------------------
});
})();

View File

@ -0,0 +1,22 @@
(function () {
'use strict';
angular.module('clientApp')
.controller('UserSpaceCtrl', ['$scope', '$state',
function ($scope, $state) {
init();
// ---------------------------------------------------------------
function init() {
}
// ---------------------------------------------------------------
// Public method -------------------------------------------------
// ---------------------------------------------------------------
}]);
})();

View 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));
}
}
]);
})();