From f26472ba5bbb06f1bab9da68b47ee08429e4321b Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Wed, 24 Jun 2015 12:52:44 +0300 Subject: [PATCH 1/5] #64 #35 New Task Tweaks --- templates/views/newTask.html | 71 +++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/templates/views/newTask.html b/templates/views/newTask.html index aa62983..7fc293d 100644 --- a/templates/views/newTask.html +++ b/templates/views/newTask.html @@ -1,6 +1,7 @@
+

Task Info:

@@ -28,45 +29,47 @@
-
-
- Submit -
+
+
+ Submit +
+ +
+ +
+

+ Add A component: +

+
+
+ Select Type: + + {{component.type}} + +
+
+ + + + +
+
+ + Mandatory?: {{ newComp.isMandatory}} + +
+
+
+ Add To Task +
+
+
-
- -
-

- Add A component: -

-
-
- Select Type: - - {{component.type}} - -
-
- - - - -
-
- - Mandatory?: {{ newComp.isMandatory}} - -
-
-
- Add To Task -
-
-
+
From d32b09b7126f8bceb631608a4bd3dfdb28898f48 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Wed, 24 Jun 2015 13:07:17 +0300 Subject: [PATCH 2/5] Fixed Token Issue in Register Controller --- templates/js/controllers/registerController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index 279fddd..6656f1d 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -30,7 +30,7 @@ angular.module('SeHub') $scope.userHasNoName = true; } - apiService.getAllCampuses($scope.user.seToken).success(function(data) // Get all the campuses + apiService.getAllCampuses(token).success(function(data) // Get all the campuses { $scope.campuses = data; }).error(function() @@ -78,7 +78,7 @@ angular.module('SeHub') console.log("Mail: " + fullMail); - apiService.sendValidationMail($scope.user.seToken, fullMail).success(function(data) + apiService.sendValidationMail(token, fullMail).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.') @@ -123,7 +123,7 @@ angular.module('SeHub') if(result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked { console.log("Im good"); - apiService.sendValidationMail($scope.user.seToken, email).success(function(data) + apiService.sendValidationMail(token, email).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.') From 23d287e59ac0aed474628f45dd7244bfdec33819 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Wed, 24 Jun 2015 13:16:19 +0300 Subject: [PATCH 3/5] POST -> PUT in update user --- templates/js/services/apiService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index d6d1a03..92871d4 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -37,7 +37,7 @@ service.factory('apiService', ['$http', function($http) { var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/updateUser/" + token; req = { - method: "POST", + method: "PUT", url: url, data: payLoad }; From 5f53e3ff850b9404e874de98257217460f8231e4 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Wed, 24 Jun 2015 13:28:27 +0300 Subject: [PATCH 4/5] Fixing Register POPUP --- .../js/controllers/registerController.js | 235 ++++++++---------- 1 file changed, 110 insertions(+), 125 deletions(-) diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index 6656f1d..4ded290 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -1,141 +1,126 @@ angular.module('SeHub') -.controller('registerController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) -{ - $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; - - apiService.getUserByToken(token).success(function(data) // Get user token - { - $scope.user = data; - - if(data.message == 'No User Found') - console.error("No User Found!"); - console.log(data); - - if($scope.user.name === ";") - { - $scope.user.name = ""; - $scope.user.name = $scope.user.username; - $scope.userHasNoName = true; + .controller('registerController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) { + $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" } - apiService.getAllCampuses(token).success(function(data) // Get all the campuses - { - $scope.campuses = data; - }).error(function() - { - // TODO - }); - }); + $rootScope.seToken = $cookies['com.sehub.www']; + var token = $rootScope.seToken; - $scope.dropdownClicked = function() - { - if($scope.campus){ - $scope.campusChecked = true; - $scope.campusObj = null; - for (var i = $scope.campuses.length - 1; i >= 0; i--) { - if($scope.campuses[i].title == $scope.campus){ - $scope.campusObj = $scope.campuses[i]; - console.log($scope.campusObj); // TODO REMOVE!! + apiService.getUserByToken(token).success(function(data) // Get user token + { + $scope.user = data; + + if (data.message == 'No User Found') + console.error("No User Found!"); + console.log(data); + + if ($scope.user.name === ";") { + $scope.user.name = ""; + $scope.user.name = $scope.user.username; + $scope.userHasNoName = true; } + + apiService.getAllCampuses(token).success(function(data) // Get all the campuses + { + $scope.campuses = data; + }).error(function() { + // TODO + }); + }); + + $scope.dropdownClicked = function() { + if ($scope.campus) { + $scope.campusChecked = true; + $scope.campusObj = null; + for (var i = $scope.campuses.length - 1; i >= 0; i--) { + if ($scope.campuses[i].title == $scope.campus) { + $scope.campusObj = $scope.campuses[i]; + console.log($scope.campusObj); // TODO REMOVE!! + } + }; + }; + + }; + + $scope.submitClicked = function(ev) { + var emailValid = false; + + if ($scope.user.AcMail != null) { + var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user + + apiService.updateUser(token, $scope.user).success(function(data) { + + }).error(function() { + // TODO Error + console.log("Error occured on updateUser"); + }); + + console.log("Mail: " + fullMail); + + apiService.sendValidationMail(token, fullMail).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)) + .then(function() { + // 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 + + }); // Pop-up alert for e-mail verification + }).error(function() { + $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)); + }); + } 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.createCampusClicked = true; - $scope.submitClicked = function(ev) - { - var emailValid = false; - var jsonUpdateUser = - { - "lecturerStat": "$scope.user.isLecturer", - "campName": "$scope.campusName" - } - - if($scope.user.AcMail != null) - { - var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user - - apiService.updateUser($scope.user.seToken, jsonUpdateUser).success(function(data) + if (!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing) { - - }).error(function() - { - // TODO Error - console.log("Error occured on updateUser"); - }); - - console.log("Mail: " + fullMail); - - apiService.sendValidationMail(token, fullMail).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.') - .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.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.user.campusMail != null) - { - validateEmail($scope.user.campusMail); // Verify the email according to "xxx@name.suffix" + if ($scope.user.campusMail != null) { + validateEmail($scope.user.campusMail); // Verify the email according to "xxx@name.suffix" + } } } - } - validateEmail = function(email) - { - 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 - { - $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 - { - console.log("Im good"); - apiService.sendValidationMail(token, email).success(function(data) + validateEmail = function(email) { + 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("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(email)); // 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.') + .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 { - $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(email)); - }); + console.log("Im good"); + apiService.sendValidationMail(token, email).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(email)); // 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(email)); + }); + } } - } -}]); + }]); \ No newline at end of file From 049c36c9169ea471e6582c34272d119bba5be920 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Wed, 24 Jun 2015 13:42:32 +0300 Subject: [PATCH 5/5] Fixed HRef --- templates/js/controllers/tasksController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/js/controllers/tasksController.js b/templates/js/controllers/tasksController.js index 416dc63..705ddb2 100644 --- a/templates/js/controllers/tasksController.js +++ b/templates/js/controllers/tasksController.js @@ -7,7 +7,7 @@ angular.module('SeHub') { var taskName = name; console.log("task created! " + taskName); - $window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page + $location.path("/tasks/new"); // Reference to 'newTask' page }