Merge branch 'master' into API_Dev
Conflict Fixed
This commit is contained in:
commit
354d194f32
9 changed files with 100 additions and 48 deletions
|
@ -60,7 +60,7 @@ def getUserByToken(token):
|
||||||
403 - No User Found
|
403 - No User Found
|
||||||
"""
|
"""
|
||||||
query = User.all()
|
query = User.all()
|
||||||
query.filter("seToken = ", token)
|
query.filter("seToken =", token)
|
||||||
|
|
||||||
for u in query.run(limit=5):
|
for u in query.run(limit=5):
|
||||||
return Response(response=u.to_JSON(),
|
return Response(response=u.to_JSON(),
|
||||||
|
|
|
@ -12,7 +12,7 @@ class User(db.Model):
|
||||||
seToken = db.StringProperty(required=True)
|
seToken = db.StringProperty(required=True)
|
||||||
avatar_url = db.StringProperty(required=True)
|
avatar_url = db.StringProperty(required=True)
|
||||||
isFirstLogin = db.BooleanProperty(default=True)
|
isFirstLogin = db.BooleanProperty(default=True)
|
||||||
campusName = db.StringProperty(default="")
|
campusName = db.StringProperty(required=True, default=" ")
|
||||||
campuses_id_list = db.StringListProperty(default=[])
|
campuses_id_list = db.StringListProperty(default=[])
|
||||||
classes_id_list = db.StringListProperty(default=[])
|
classes_id_list = db.StringListProperty(default=[])
|
||||||
|
|
||||||
|
|
|
@ -213,9 +213,19 @@ 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 .selected{
|
|
||||||
|
.se-menu li:active{
|
||||||
|
background-color: #B2B2B2;
|
||||||
|
text-shadow:#e0e0e0 1px 1px 0;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.se-menu .selected{
|
||||||
background-color: #E2E2E2;
|
background-color: #E2E2E2;
|
||||||
|
text-shadow:#e0e0e0 1px 1px 0;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-box{
|
.user-box{
|
||||||
|
|
|
@ -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,19 +24,6 @@ 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",
|
||||||
|
@ -44,33 +32,47 @@ angular.module('SeHub')
|
||||||
}, {
|
}, {
|
||||||
"title": "My Campuses",
|
"title": "My Campuses",
|
||||||
"icon": "fa fa-university",
|
"icon": "fa fa-university",
|
||||||
"style": "selected",
|
"style": "",
|
||||||
"route": "/campuses"
|
"route": "/campuses"
|
||||||
}, {
|
}, {
|
||||||
"title": "My Classes",
|
"title": "My Classes",
|
||||||
"icon": "fa fa-graduation-cap",
|
"icon": "fa fa-graduation-cap",
|
||||||
"style": "selected",
|
"style": "",
|
||||||
"route": "/campuses"
|
"route": "/campuses"
|
||||||
}, {
|
}, {
|
||||||
"title": "My Projects",
|
"title": "My Projects",
|
||||||
"icon": "fa fa-cube",
|
"icon": "fa fa-cube",
|
||||||
"style": "selected",
|
"style": "",
|
||||||
"route": "/campuses"
|
"route": "/campuses"
|
||||||
}, {
|
}, {
|
||||||
"title": "Tasks",
|
"title": "Tasks",
|
||||||
"icon": "fa fa-clipboard",
|
"icon": "fa fa-clipboard",
|
||||||
"style": "selected",
|
"style": "",
|
||||||
"route": "/campuses"
|
"route": "/campuses"
|
||||||
}, {
|
}, {
|
||||||
"title": "Settings",
|
"title": "Settings",
|
||||||
"icon": "fa fa-cogs",
|
"icon": "fa fa-cogs",
|
||||||
"style": "selected",
|
"style": "",
|
||||||
"route": "/campuses"
|
"route": "/Settings"
|
||||||
}, {
|
}, {
|
||||||
"title": "Log Out",
|
"title": "Log Out",
|
||||||
"icon": "fa fa-power-off",
|
"icon": "fa fa-power-off",
|
||||||
"style": "selected",
|
"style": "",
|
||||||
"route": "/campuses"
|
"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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}]);
|
}]);
|
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')
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}]);
|
|
@ -11,7 +11,6 @@ service.factory('apiService', ['$http', function($http) {
|
||||||
req = {
|
req = {
|
||||||
method : "GET",
|
method : "GET",
|
||||||
url : url
|
url : url
|
||||||
|
|
||||||
};
|
};
|
||||||
return $http(req);
|
return $http(req);
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,10 +21,8 @@
|
||||||
</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 class="user-box" layout="row" layout-padding>
|
<div class="user-box" layout="row" layout-padding>
|
||||||
<div flex="30"> <!-- Avatar -->
|
<div flex="30"> <!-- Avatar -->
|
||||||
<img ng-src="{{user.avatar_url}}" alt="">
|
<img ng-src="{{user.avatar_url}}" alt="">
|
||||||
|
@ -40,13 +38,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<a ng-repeat="item in menuItems" href="#">
|
<a ng-repeat="item in menuItems" ng-click="menuClicked(item)">
|
||||||
<li><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 ng-if="loadingData">
|
|
||||||
<md-progress-circular></md-progress-circular>
|
|
||||||
</div>
|
</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>
|
||||||
|
@ -89,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>
|
||||||
|
|
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