From 2671376db4592c8505498fd1ded93b9a715602d7 Mon Sep 17 00:00:00 2001 From: aranzaiger Date: Mon, 15 Jun 2015 19:54:15 +0300 Subject: [PATCH 1/6] added updateUser function --- SE_API/UserRoutes.py | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/SE_API/UserRoutes.py b/SE_API/UserRoutes.py index e487f2a..efad1bc 100644 --- a/SE_API/UserRoutes.py +++ b/SE_API/UserRoutes.py @@ -70,6 +70,57 @@ def getUserByToken(token): return bad_request("No User Found") +@user_routes.route('/api/users/updateUser/', methods=["GET"]) +@auto.doc() +def updateUser(token): + """ + >This Call will update user details +
+ Route Parameters
+ - seToken: 'seToken' +
+
+ Payload
+ - JSON Object, Example:
+ {
+ 'name': 'Campus name',
+ 'isLecturer': '@campus.ac.com',
+ }
+
+ Response +
+ 200 - User updated +
+ 400 - Bad Request + """ + + if not request.data: + return bad_request() + + try: + payload = json.loads(request.data) + except Exception as e: + return bad_request(e) + + user = get_user_by_token(token) + if user is None: + return bad_request("Not a user!") + + try: + user.name = payload['user'] + except Exception: + pass + + try: + user.isLecturer = payload['isLecturer'] + except Exception: + pass + + + return ok("User updated") + + + @user_routes.route('/api/users/help') def documentation(): return auto.html() \ No newline at end of file From 0a403286bf88e4f1b76ace6fda57be7f80d1a463 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 16 Jun 2015 09:35:41 +0300 Subject: [PATCH 2/6] API: Fixed Testing init route function --- SE_API/API.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SE_API/API.py b/SE_API/API.py index a1ad212..972c39e 100644 --- a/SE_API/API.py +++ b/SE_API/API.py @@ -214,7 +214,7 @@ def init_QA(): qa_student = User(username='qa_student', name='Student QA', avatar_url='http://ava.com', email='just@mail.com', isLecturer=False, accessToken='student_token_', seToken='_QA_TOKEN_TEST_STUDENT') qa_lecturer = User(username='qa_lecturer', name='Student QA', avatar_url='http://ava.com', email='just@mail.com', - isLecturer=False, accessToken='student_token_', seToken='_QA_TOKEN_TEST_LECTURER') + isLecturer=True, accessToken='student_token_', seToken='_QA_TOKEN_TEST_LECTURER') query = User.all().filter('username =', qa_student.username) for u in query.run(): is_student_exist = True From bd541b59c4a0298d865ba666cd16d5a1aede4473 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 16 Jun 2015 09:37:25 +0300 Subject: [PATCH 3/6] QA: Fixed a small test in UserAPI --- Testing/UserAPI_Test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Testing/UserAPI_Test.py b/Testing/UserAPI_Test.py index 7baa8cb..1af62c3 100644 --- a/Testing/UserAPI_Test.py +++ b/Testing/UserAPI_Test.py @@ -67,7 +67,7 @@ class UserTestPlan(unittest.TestCase): def test_Lecturer_isLecturer(self): r = requests.get(self.__class__.url_+'api/users/getUserByToken/'+__CONFIG__['TOKENS']['LECTURER']) self.assertEquals(r.status_code, 200) - self.assertFalse(r.json()['isLecturer']) + self.assertTrue(r.json()['isLecturer']) def test_isClassIdListEmpty_Lecturer(self): r = requests.get(self.__class__.url_+'api/users/getUserByToken/'+__CONFIG__['TOKENS']['LECTURER']) From 12552e9ca535d048e883c49200513af1b16f0ce5 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Tue, 16 Jun 2015 11:34:04 +0300 Subject: [PATCH 4/6] -create campus as lecturer added --- templates/css/theme.css | 7 ++ .../js/controllers/registerController.js | 71 +++++++++++-------- templates/views/register.html | 35 +++++---- 3 files changed, 70 insertions(+), 43 deletions(-) diff --git a/templates/css/theme.css b/templates/css/theme.css index a8b0155..de31d1a 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -133,6 +133,13 @@ body.noscroll margin-top: auto; } + +.createCampus +{ + position:relative; + /*float:right;*/ +} + /*div.img campusAvatar { border: 1px solid #0000ff; diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index b46bc91..706670b 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -3,7 +3,14 @@ angular.module('SeHub') { $scope.userHasNoName = false; $scope.campusChecked = false; + $scope.createCampusClicked = false; $scope.isEmpty = true; // if the academic email line is empty + $scope.jsonCreateCampus = + { + "title": "Create Campus", + "email": "email_ending", + "avatar": "self.avatar.url" + } $rootScope.seToken = $cookies['com.sehub.www']; var token = $rootScope.seToken; @@ -44,6 +51,7 @@ angular.module('SeHub') } }; }; + }; $scope.submitClicked = function(ev) @@ -56,6 +64,7 @@ angular.module('SeHub') console.log("DONE - 200"); $mdDialog.show($mdDialog.alert().title('E-mail Verification').content('A verification e-mail has been sent to your email address.') .ariaLabel('Email verification alert dialog').ok('Got it!').targetEvent(ev)); // Pop-up alert for e-mail verification + // TODO ADD delete cookies and redirect only after pressed 'Got it' $cookieStore.remove("com.sehub.www"); // Removing the cookies $window.location.href = 'http://se-hub.appspot.com'; // Reference to 'welcome' page }).error(function() @@ -66,38 +75,38 @@ angular.module('SeHub') }; }; - $scope.lecturerPrivilege = function(data) + + $scope.lecturer = function(ev) { - // console.log("Now " + data); - var isLecturer; - if(!data) // if i am a lecturer (when pressing -> getting last data value before pressing) = "!data" => I Am Lecturer + console.log("inside"); + $scope.createCampusClicked = true; + + if(!$scope.isLecturer) // if i am a lecturer (when pressing -> getting last data value before pressing) = "!isLecturer" it means => I Am Lecturer { - isLecturer = true; - console.log("im lecturer " + isLecturer); + // var jsonCreateCampus = + // { + // "title": "Create Campus", + // "email": "email_ending", + // "avatar": "self.avatar.url" + // } + console.log("YES lecturer " + $scope.jsonCreateCampus.title); + + if($scope.user.lecAcMail != null) + { + apiService.sendValidationMail($scope.user.seToken, $scope.user.lecAcMail).success(function(data) + { + console.log("DONE - 200"); + $mdDialog.show($mdDialog.alert().title('E-mail Verification').content('A verification e-mail has been sent to your email address.') + .ariaLabel('Email verification alert dialog').ok('Got it!').targetEvent(ev)); // Pop-up alert for e-mail verification + // TODO ADD delete cookies and redirect only after pressed 'Got it' + $cookieStore.remove("com.sehub.www"); // Removing the cookies + $window.location.href = 'http://se-hub.appspot.com'; // Reference to 'welcome' page + }).error(function() + { + $mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address or in the campus name.') + .ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev)); + }); + } } - } - - - // 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 - + } }]); diff --git a/templates/views/register.html b/templates/views/register.html index dad2074..99beeae 100644 --- a/templates/views/register.html +++ b/templates/views/register.html @@ -18,26 +18,37 @@

Are You A Lecturer?

- - Switch 1: {{ data.cb1 }} -
- -
-
- - - + +
+
+
+ Create Campus +
+ + + + + + + + + + + + +
+
+
+
From 11b7aef006f03a23f86a1afb82d03e5e4fc91cc4 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 16 Jun 2015 14:15:59 +0300 Subject: [PATCH 5/6] AngularJS: Added Home Route + Home Controller + Home View --- templates/css/theme.css | 8 +++++++- templates/js/app.js | 4 ++++ templates/js/controllers/homeController.js | 10 ++++++++++ templates/js/controllers/mainController.js | 3 +++ templates/views/home.html | 21 +++++++++++++++++++++ templates/views/index.html | 1 + 6 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 templates/js/controllers/homeController.js diff --git a/templates/css/theme.css b/templates/css/theme.css index de31d1a..9e53a78 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -154,4 +154,10 @@ body.noscroll border-left: 2px black solid; border-right: 2px black solid; border-radius: 1px black solid; -}*/ \ No newline at end of file +}*/ + +.gray-font{ + color: #7f7f7f; + font-size: 300%; + text-shadow:#e0e0e0 1px 1px 0; +} \ No newline at end of file diff --git a/templates/js/app.js b/templates/js/app.js index 9b93421..76bba8f 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -33,6 +33,10 @@ app.config(['$routeProvider', '$locationProvider', .when('/register', { templateUrl: 'templates/views/register.html', controller: 'registerController' + }) + .when('/home', { + templateUrl: 'templates/views/home.html', + controller: 'homeController' }); } diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js new file mode 100644 index 0000000..976e68e --- /dev/null +++ b/templates/js/controllers/homeController.js @@ -0,0 +1,10 @@ +/** + * Created by sagi on 6/16/15. + */ +angular.module('SeHub') +.controller('homeController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + + + +}]); \ No newline at end of file diff --git a/templates/js/controllers/mainController.js b/templates/js/controllers/mainController.js index 9da1fa1..09cb9b5 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -17,7 +17,10 @@ angular.module('SeHub') $scope.isInRegisterMode = true; $scope.loadingData = false; $location.path('/register') + }else{ + $location.path('/home') } + }) $scope.loadingData = false; diff --git a/templates/views/home.html b/templates/views/home.html index 989a927..881bf23 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -2,4 +2,25 @@
+ + +
+
+
+

+
+
+
+
+
+
+

Welcome To SE-Hub

+

+ This Is your Home Page +

+
+
+
+
+
\ No newline at end of file diff --git a/templates/views/index.html b/templates/views/index.html index fcc374d..563c811 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -68,6 +68,7 @@ + From ad528f910f1bbb02c2656afa396b7ea3cd462965 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 16 Jun 2015 14:32:57 +0300 Subject: [PATCH 6/6] UI: Changed The Fonts (Now Using Alef) with fallback options --- templates/css/theme.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/templates/css/theme.css b/templates/css/theme.css index 9e53a78..8db9124 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -1,3 +1,13 @@ +@import url(http://fonts.googleapis.com/earlyaccess/alefhebrew.css); + +body{ + font-family: "Alef Hebrew", + “Helvetica Neue”, + Helvetica, + Arial, + sans-serif; +} + .menuBtn { background-color: transparent; border: none;