Merge branch 'master' of https://github.com/sagidayan/SE-Hub into QA
This commit is contained in:
commit
02dc0c58ee
11 changed files with 101 additions and 70 deletions
|
@ -42,9 +42,9 @@ def create_course(token):
|
||||||
{<br>
|
{<br>
|
||||||
'courseName': 'Advance Math',<br>
|
'courseName': 'Advance Math',<br>
|
||||||
'campusName': 'JCE',<br>
|
'campusName': 'JCE',<br>
|
||||||
'startDate': '2015-14-3'<br>
|
'startDate': {'year': 2015, 'month' : 4, 'day' : 3}<br>
|
||||||
'endDate': '2015-29-6'<br>
|
'endDate': {'year': 2016, 'month' : 5, 'day' : 14}<br>
|
||||||
'taskFlag': 'False'<br>
|
'taskFlag': false<br>
|
||||||
}<br>
|
}<br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
@ -67,8 +67,7 @@ def create_course(token):
|
||||||
try:
|
try:
|
||||||
payload = json.loads(request.data)
|
payload = json.loads(request.data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return bad_request(e)
|
return bad_request()
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
start_date = datetime.date(payload['startDate']['year'],payload['startDate']['month'],payload['startDate']['day'])
|
start_date = datetime.date(payload['startDate']['year'],payload['startDate']['month'],payload['startDate']['day'])
|
||||||
|
|
|
@ -24,6 +24,7 @@ class User(db.Model):
|
||||||
'seToken' : self.seToken,
|
'seToken' : self.seToken,
|
||||||
'avatar_url' : self.avatar_url,
|
'avatar_url' : self.avatar_url,
|
||||||
'isFirstLogin' : self.isFirstLogin,
|
'isFirstLogin' : self.isFirstLogin,
|
||||||
|
'campusName': self.campusName,
|
||||||
'campuses_id_list': self.campuses_id_list,
|
'campuses_id_list': self.campuses_id_list,
|
||||||
'classes_id_list': self.classes_id_list
|
'classes_id_list': self.classes_id_list
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,7 @@ body.noscroll
|
||||||
.se-menu li:hover{
|
.se-menu li:hover{
|
||||||
background-color: #E2E2E2;
|
background-color: #E2E2E2;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.se-menu li:active{
|
.se-menu li:active{
|
||||||
|
|
|
@ -37,6 +37,10 @@ app.config(['$routeProvider', '$locationProvider',
|
||||||
.when('/home', {
|
.when('/home', {
|
||||||
templateUrl: 'templates/views/home.html',
|
templateUrl: 'templates/views/home.html',
|
||||||
controller: 'homeController'
|
controller: 'homeController'
|
||||||
|
})
|
||||||
|
.when('/Settings', {
|
||||||
|
templateUrl: 'templates/views/settings.html',
|
||||||
|
controller: 'settingsController'
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,9 @@ angular.module('SeHub')
|
||||||
if (data.message == 'No User Found') {
|
if (data.message == 'No User Found') {
|
||||||
console.error("No User Found!");
|
console.error("No User Found!");
|
||||||
}
|
}
|
||||||
|
$scope.loadingData = false;
|
||||||
$scope.user = data;
|
$scope.user = data;
|
||||||
|
console.log(data);
|
||||||
if ($scope.user.isFirstLogin) {
|
if ($scope.user.isFirstLogin) {
|
||||||
$scope.menuObj = {};
|
$scope.menuObj = {};
|
||||||
$scope.isInRegisterMode = true;
|
$scope.isInRegisterMode = true;
|
||||||
|
@ -23,24 +24,11 @@ angular.module('SeHub')
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
apiService.getUserByToken(token).success(function(data) // Get user token
|
|
||||||
{
|
|
||||||
$scope.user = data;
|
|
||||||
$scope.loadingData = false;
|
|
||||||
|
|
||||||
apiService.getAllCampuses($scope.user.seToken).success(function(data) // Get all the campuses
|
|
||||||
{
|
|
||||||
$scope.campuses = data;
|
|
||||||
}).error(function() {
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.menuItems = [{
|
$scope.menuItems = [{
|
||||||
"title": "Home",
|
"title": "Home",
|
||||||
"icon": "fa fa-home",
|
"icon": "fa fa-home",
|
||||||
"style": "selected",
|
"style": "selected",
|
||||||
"route": "#/home"
|
"route": "/home"
|
||||||
}, {
|
}, {
|
||||||
"title": "My Campuses",
|
"title": "My Campuses",
|
||||||
"icon": "fa fa-university",
|
"icon": "fa fa-university",
|
||||||
|
@ -65,12 +53,26 @@ angular.module('SeHub')
|
||||||
"title": "Settings",
|
"title": "Settings",
|
||||||
"icon": "fa fa-cogs",
|
"icon": "fa fa-cogs",
|
||||||
"style": "",
|
"style": "",
|
||||||
"route": "#/Settings"
|
"route": "/Settings"
|
||||||
}, {
|
}, {
|
||||||
"title": "Log Out",
|
"title": "Log Out",
|
||||||
"icon": "fa fa-power-off",
|
"icon": "fa fa-power-off",
|
||||||
"style": "",
|
"style": "",
|
||||||
"route": "#/logout"
|
"route": "/logout"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
$scope.menuClicked = function(item){
|
||||||
|
var route = ""
|
||||||
|
for (var i = $scope.menuItems.length - 1; i >= 0; i--) {
|
||||||
|
if($scope.menuItems[i].title === item.title){
|
||||||
|
$scope.menuItems[i].style="selected";
|
||||||
|
route = $scope.menuItems[i].route;
|
||||||
|
}else{
|
||||||
|
$scope.menuItems[i].style = "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$location.path(route);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}]);
|
}]);
|
|
@ -56,9 +56,13 @@ angular.module('SeHub')
|
||||||
|
|
||||||
$scope.submitClicked = function(ev)
|
$scope.submitClicked = function(ev)
|
||||||
{
|
{
|
||||||
|
var emailValid = false;
|
||||||
if($scope.user.AcMail != null)
|
if($scope.user.AcMail != null)
|
||||||
{
|
{
|
||||||
var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user
|
var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user
|
||||||
|
|
||||||
|
console.log("Mail: " + fullMail);
|
||||||
|
|
||||||
apiService.sendValidationMail($scope.user.seToken, fullMail).success(function(data)
|
apiService.sendValidationMail($scope.user.seToken, fullMail).success(function(data)
|
||||||
{
|
{
|
||||||
console.log("DONE - 200");
|
console.log("DONE - 200");
|
||||||
|
@ -72,36 +76,38 @@ angular.module('SeHub')
|
||||||
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
|
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
|
||||||
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
|
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||||
|
{
|
||||||
|
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
|
||||||
|
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.createCampus = function(ev)
|
$scope.createCampus = function(ev)
|
||||||
{
|
{
|
||||||
$scope.createCampusClicked = true;
|
$scope.createCampusClicked = true;
|
||||||
|
|
||||||
if(!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing)
|
if(!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing)
|
||||||
{
|
{
|
||||||
if($scope.user.campusSuffixMail != null)
|
if($scope.user.campusMail != null)
|
||||||
{
|
{
|
||||||
validateEmail($scope.user.campusSuffixMail);
|
validateEmail($scope.user.campusMail); // Verify the email according to "xxx@name.suffix"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validateEmail = function(email) // TODO ADD IT
|
validateEmail = function(email)
|
||||||
{
|
{
|
||||||
var result = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
|
var result = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
|
||||||
|
if (!result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||||
console.log("Email: " + email);
|
|
||||||
|
|
||||||
if (!result.test(email))
|
|
||||||
{
|
{
|
||||||
console.log(email + ", Error in email, should alert");
|
console.log(email + ", Error in email, should alert");
|
||||||
alert('Please provide a valid e-mail address');
|
// alert('Please provide a valid e-mail address');
|
||||||
|
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
|
||||||
|
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(email));
|
||||||
}
|
}
|
||||||
|
if(result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||||
if(result.test(email))
|
|
||||||
{
|
{
|
||||||
console.log("Im good");
|
console.log("Im good");
|
||||||
apiService.sendValidationMail($scope.user.seToken, email).success(function(data)
|
apiService.sendValidationMail($scope.user.seToken, email).success(function(data)
|
||||||
|
@ -119,26 +125,4 @@ angular.module('SeHub')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO FOR LATER - toast
|
|
||||||
// TODO FOR LATER
|
|
||||||
|
|
||||||
// $scope.getPopWindowPosition = function()
|
|
||||||
// {
|
|
||||||
// return Object.keys($scope.toastPosition).filter(function(pos)
|
|
||||||
// {
|
|
||||||
// return $scope.toastPosition[pos];
|
|
||||||
// }).join(' ');
|
|
||||||
// };
|
|
||||||
|
|
||||||
// $scope.toastPosition =
|
|
||||||
// {
|
|
||||||
// bottom: false,
|
|
||||||
// top: true,
|
|
||||||
// left: false,
|
|
||||||
// right: true
|
|
||||||
// };
|
|
||||||
|
|
||||||
// TODO FOR LATER
|
|
||||||
// TODO FOR LATER
|
|
||||||
}]);
|
}]);
|
||||||
|
|
30
templates/js/controllers/settingsController.js
Normal file
30
templates/js/controllers/settingsController.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
angular.module('SeHub')
|
||||||
|
.controller('settingsController', ['$scope', '$rootScope', 'apiService', '$cookies', '$location', function($scope, $rootScope, apiService, $cookies, $location) {
|
||||||
|
|
||||||
|
var token = $cookies['com.sehub.www'];
|
||||||
|
|
||||||
|
$scope.loadingData = true;
|
||||||
|
$scope.isInRegisterMode = false;
|
||||||
|
|
||||||
|
$scope.title = "Settings"
|
||||||
|
|
||||||
|
apiService.getUserByToken(token).success(function(data) {
|
||||||
|
if (data.message == 'No User Found') {
|
||||||
|
console.error("No User Found!");
|
||||||
|
}
|
||||||
|
$scope.loadingData = false;
|
||||||
|
$scope.user = data;
|
||||||
|
console.log(data);
|
||||||
|
if ($scope.user.isFirstLogin) {
|
||||||
|
$scope.menuObj = {};
|
||||||
|
$scope.isInRegisterMode = true;
|
||||||
|
$scope.loadingData = false;
|
||||||
|
$location.path('/register')
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}]);
|
|
@ -3,15 +3,12 @@ var DEBUG = true;
|
||||||
var service = angular.module('seHub.services', []);
|
var service = angular.module('seHub.services', []);
|
||||||
|
|
||||||
service.factory('apiService', ['$http', function($http) {
|
service.factory('apiService', ['$http', function($http) {
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getUserByToken: function(token){
|
getUserByToken: function(token){
|
||||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserByToken/" + token;
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserByToken/" + token;
|
||||||
req = {
|
req = {
|
||||||
method : "GET",
|
method : "GET",
|
||||||
url : url
|
url : url
|
||||||
|
|
||||||
};
|
};
|
||||||
return $http(req);
|
return $http(req);
|
||||||
},
|
},
|
||||||
|
@ -36,9 +33,17 @@ service.factory('apiService', ['$http', function($http) {
|
||||||
data: payload
|
data: payload
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return $http(req);
|
||||||
|
},
|
||||||
|
updateUser: function(token, payLoad){
|
||||||
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/updateUser/" + token;
|
||||||
|
|
||||||
|
req = {
|
||||||
|
method: "POST",
|
||||||
|
url: url,
|
||||||
|
data: payLoad
|
||||||
|
};
|
||||||
return $http(req);
|
return $http(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
|
@ -21,9 +21,6 @@
|
||||||
</md-toolbar>
|
</md-toolbar>
|
||||||
<div layout="row" flex>
|
<div layout="row" flex>
|
||||||
<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="$mdMedia('gt-sm')">
|
<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="$mdMedia('gt-sm')">
|
||||||
<!-- <div class="user-pane-menu">
|
|
||||||
<img ng-src="{{user.avatar_url}}" alt="">
|
|
||||||
</div> -->
|
|
||||||
<md-content class="se-menu">
|
<md-content class="se-menu">
|
||||||
<div ng-if="!isInRegisterMode">
|
<div ng-if="!isInRegisterMode">
|
||||||
<div class="user-box" layout="row" layout-padding>
|
<div class="user-box" layout="row" layout-padding>
|
||||||
|
@ -41,15 +38,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<a ng-repeat="item in menuItems" ng-href="{{item.route}}">
|
<a ng-repeat="item in menuItems" ng-click="menuClicked(item)">
|
||||||
<li ng-class="[item.style]"><i ng-class="item.icon"></i> {{item.title}}</li>
|
<li ng-class="[item.style]"><i ng-class="item.icon"></i> {{item.title}}</li>
|
||||||
<md-divider ng-if="!$last"></md-divider>
|
<md-divider ng-if="!$last"></md-divider>
|
||||||
</a>
|
</a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="loadingData">
|
|
||||||
<md-progress-circular></md-progress-circular>
|
|
||||||
</div>
|
|
||||||
<div ng-if="isInRegisterMode"> <!-- User Needs To Register -->
|
<div ng-if="isInRegisterMode"> <!-- User Needs To Register -->
|
||||||
<md-card layout-padding>
|
<md-card layout-padding>
|
||||||
<div layout=-"row">
|
<div layout=-"row">
|
||||||
|
@ -91,6 +85,7 @@
|
||||||
<!-- Controllers -->
|
<!-- Controllers -->
|
||||||
<script src="templates/js/controllers/mainController.js"></script>
|
<script src="templates/js/controllers/mainController.js"></script>
|
||||||
<script src="templates/js/controllers/homeController.js"></script>
|
<script src="templates/js/controllers/homeController.js"></script>
|
||||||
|
<script src="templates/js/controllers/settingsController.js"></script>
|
||||||
<script src="templates/js/controllers/registerController.js"></script>
|
<script src="templates/js/controllers/registerController.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<div>
|
<div>
|
||||||
<md-input-container ng-if="userHasNoName">
|
<md-input-container ng-if="userHasNoName">
|
||||||
<label>Full Name: </label>
|
<label>Full Name: </label>
|
||||||
<input ng-model="user.name" required>
|
<input ng-model="user.name" ng-minlength="1" required>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</div>
|
</div>
|
||||||
<br></br>
|
<br></br>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<div class = "createCampus" ng-if="createCampusClicked">
|
<div class = "createCampus" ng-if="createCampusClicked">
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label>Academic Suffix Email</label>
|
<label>Academic Suffix Email</label>
|
||||||
<input type="text" ng-model="user.campusSuffixMail" ng-minlength="1" required/>
|
<input type="text" ng-model="user.campusMail" ng-minlength="1" required/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label>Campus Name</label>
|
<label>Campus Name</label>
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
<div>
|
<div>
|
||||||
<md-input-container>
|
<md-input-container>
|
||||||
<label>Academic Email</label>
|
<label>Academic Email</label>
|
||||||
<input type="text" ng-model="user.AcMail" required/>
|
<input type="text" ng-model="user.AcMail" ng-length="1" required/>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
10
templates/views/settings.html
Normal file
10
templates/views/settings.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<div>
|
||||||
|
<div class="loader" ng-if="loadingData">
|
||||||
|
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
||||||
|
</div>
|
||||||
|
<md-content layout-padding>
|
||||||
|
<md-card layout-padding>
|
||||||
|
<h1><i class="fa fa-cogs"></i> {{title}}</h1>
|
||||||
|
</md-card>
|
||||||
|
</md-content>
|
||||||
|
</div>
|
Loading…
Reference in a new issue