diff --git a/SE_API/UserRoutes.py b/SE_API/UserRoutes.py index ce51a1b..0bc26d1 100644 --- a/SE_API/UserRoutes.py +++ b/SE_API/UserRoutes.py @@ -60,7 +60,7 @@ def getUserByToken(token): 403 - No User Found """ query = User.all() - query.filter("seToken = ", token) + query.filter("seToken =", token) for u in query.run(limit=5): return Response(response=u.to_JSON(), diff --git a/models/User.py b/models/User.py index e1edb87..348266c 100644 --- a/models/User.py +++ b/models/User.py @@ -12,7 +12,7 @@ class User(db.Model): seToken = db.StringProperty(required=True) avatar_url = db.StringProperty(required=True) isFirstLogin = db.BooleanProperty(default=True) - campusName = db.StringProperty(default="") + campusName = db.StringProperty(required=True, default=" ") campuses_id_list = db.StringListProperty(default=[]) classes_id_list = db.StringListProperty(default=[]) diff --git a/templates/css/theme.css b/templates/css/theme.css index 8835d90..92d6805 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -213,9 +213,19 @@ body.noscroll .se-menu li:hover{ background-color: #E2E2E2; 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; + text-shadow:#e0e0e0 1px 1px 0; + font-weight: bold; } .user-box{ diff --git a/templates/js/app.js b/templates/js/app.js index 76bba8f..86cbcc1 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -37,6 +37,10 @@ app.config(['$routeProvider', '$locationProvider', .when('/home', { templateUrl: 'templates/views/home.html', controller: 'homeController' + }) + .when('/Settings', { + templateUrl: 'templates/views/settings.html', + controller: 'settingsController' }); } diff --git a/templates/js/controllers/mainController.js b/templates/js/controllers/mainController.js index c0ba8ce..bad88a9 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -10,8 +10,9 @@ angular.module('SeHub') 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; @@ -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 = [{ "title": "Home", "icon": "fa fa-home", @@ -44,33 +32,47 @@ angular.module('SeHub') }, { "title": "My Campuses", "icon": "fa fa-university", - "style": "selected", + "style": "", "route": "/campuses" }, { "title": "My Classes", "icon": "fa fa-graduation-cap", - "style": "selected", + "style": "", "route": "/campuses" }, { "title": "My Projects", "icon": "fa fa-cube", - "style": "selected", + "style": "", "route": "/campuses" }, { "title": "Tasks", "icon": "fa fa-clipboard", - "style": "selected", + "style": "", "route": "/campuses" }, { "title": "Settings", "icon": "fa fa-cogs", - "style": "selected", - "route": "/campuses" + "style": "", + "route": "/Settings" }, { "title": "Log Out", "icon": "fa fa-power-off", - "style": "selected", - "route": "/campuses" + "style": "", + "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); + } + + }]); \ No newline at end of file diff --git a/templates/js/controllers/settingsController.js b/templates/js/controllers/settingsController.js new file mode 100644 index 0000000..4968b42 --- /dev/null +++ b/templates/js/controllers/settingsController.js @@ -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') + } + + }); + + + + + }]); \ No newline at end of file diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 108b309..53bc627 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -11,7 +11,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - }; return $http(req); }, diff --git a/templates/views/index.html b/templates/views/index.html index 3abfe58..cd629d1 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -21,32 +21,28 @@
- -
-
- -
-
-
- {{user.name}} +
+
+
+
-
- {{user.email}} +
+
+ {{user.name}} +
+
+ {{user.email}} +
-
- - -
@@ -89,6 +85,7 @@ + diff --git a/templates/views/settings.html b/templates/views/settings.html new file mode 100644 index 0000000..0c4b980 --- /dev/null +++ b/templates/views/settings.html @@ -0,0 +1,10 @@ +
+
+ +
+ + +

{{title}}

+
+
+
\ No newline at end of file