From 06f94259282ea0bc113196bc6ae82d3b756935e6 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 16 Jun 2015 22:45:06 +0300 Subject: [PATCH 1/3] issue #33 - Main Menu Done --- templates/css/theme.css | 11 ++++++- templates/js/controllers/mainController.js | 18 ++++++------ templates/views/index.html | 34 ++++++++++++---------- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/templates/css/theme.css b/templates/css/theme.css index a1cac9b..83a3c64 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -214,8 +214,17 @@ body.noscroll background-color: #E2E2E2; font-weight: bold; } - .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/controllers/mainController.js b/templates/js/controllers/mainController.js index c0ba8ce..6216c2b 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -40,37 +40,37 @@ angular.module('SeHub') "title": "Home", "icon": "fa fa-home", "style": "selected", - "route": "/home" + "route": "#/home" }, { "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" }]; }]); \ No newline at end of file diff --git a/templates/views/index.html b/templates/views/index.html index 3abfe58..7183c20 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -25,26 +25,28 @@ --> -
-
- -
-
-
- {{user.name}} +
+
+
+
-
- {{user.email}} +
+
+ {{user.name}} +
+
+ {{user.email}} +
+ +
- -
From 24d8252d07e6144264c2ec1404f12156419d3b38 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 16 Jun 2015 23:08:37 +0300 Subject: [PATCH 2/3] API: Hot-Fix for the GetUserByToken Method --- SE_API/UserRoutes.py | 2 +- models/User.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 d59e690..2328f39 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(required=True, default="") + campusName = db.StringProperty(required=True, default=" ") campuses_id_list = db.StringListProperty(default=[]) classes_id_list = db.StringListProperty(default=[]) From f5be224cb25d09a16a3c7ca11380ed76fcdbef7b Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 16 Jun 2015 23:32:10 +0300 Subject: [PATCH 3/3] Menu is usable (issue #42) and starting settings --- templates/css/theme.css | 1 + templates/js/app.js | 4 +++ templates/js/controllers/mainController.js | 36 ++++++++++--------- .../js/controllers/settingsController.js | 30 ++++++++++++++++ templates/js/services/apiService.js | 1 - templates/views/index.html | 9 ++--- templates/views/settings.html | 10 ++++++ 7 files changed, 66 insertions(+), 25 deletions(-) create mode 100644 templates/js/controllers/settingsController.js create mode 100644 templates/views/settings.html diff --git a/templates/css/theme.css b/templates/css/theme.css index ff2f7ab..92d6805 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -213,6 +213,7 @@ body.noscroll .se-menu li:hover{ background-color: #E2E2E2; font-weight: bold; + cursor: pointer; } .se-menu li:active{ 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 6216c2b..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,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 = [{ "title": "Home", "icon": "fa fa-home", "style": "selected", - "route": "#/home" + "route": "/home" }, { "title": "My Campuses", "icon": "fa fa-university", @@ -65,12 +53,26 @@ angular.module('SeHub') "title": "Settings", "icon": "fa fa-cogs", "style": "", - "route": "#/Settings" + "route": "/Settings" }, { "title": "Log Out", "icon": "fa fa-power-off", "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); + } + + }]); \ 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 7183c20..cd629d1 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -21,9 +21,6 @@
-
@@ -41,15 +38,12 @@
-
- -
@@ -91,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