From c154b37973d677f15105ca086afa9c29963d7c71 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Wed, 1 Jul 2015 07:05:13 +0300 Subject: [PATCH] - home page new pattern added (work in progress) - task page - improvements for layout (api func under progress) - campuses (loading circle - under progress) --- templates/css/theme.css | 4 +- .../js/controllers/campusesController.js | 2 + templates/js/controllers/homeController.js | 43 ++++-- .../js/controllers/myClassesController.js | 1 - templates/js/controllers/tasksController.js | 4 +- templates/js/services/apiService.js | 134 +++++++++--------- templates/views/campuses.html | 4 +- templates/views/class.html | 5 +- templates/views/home.html | 48 +++++++ templates/views/myClasses.html | 4 +- templates/views/tasks.html | 34 ++--- 11 files changed, 176 insertions(+), 107 deletions(-) diff --git a/templates/css/theme.css b/templates/css/theme.css index c03dfb7..7653ec7 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -456,7 +456,7 @@ p.tasksFeed { padding-left: 4px; margin: 5px; - width:340; + width:99%; height: auto; background-color: aliceblue; @@ -465,7 +465,7 @@ p.messagesFeed { padding-left: 4px; margin: 5px; - width:690; + width:99%; height: auto; background-color: #f5f5f5; } \ No newline at end of file diff --git a/templates/js/controllers/campusesController.js b/templates/js/controllers/campusesController.js index 30f804b..d3d5219 100644 --- a/templates/js/controllers/campusesController.js +++ b/templates/js/controllers/campusesController.js @@ -1,6 +1,7 @@ angular.module('SeHub') .controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) { + $scope.loadingData = true; $scope.campusesEmpty = false; var token = $cookies['com.sehub.www']; @@ -34,6 +35,7 @@ angular.module('SeHub') { apiService.getCampusesByUser(token).success(function(data) // Get all the campuses { + $scope.loadingData = true; $scope.campuses = data; console.log("INSIDE " + $scope.campuses); init(); // Executing the function to initialize campuses display diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 2d6bd34..9bcab36 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -34,16 +34,6 @@ angular.module('SeHub') console.log("Student Mode!"); } - // apiService.getCourseByCampusName(token).success(function(data) - // { - // console.log("Campus Name is ON! " + token) - // $scope.course = data; - // }).error(function(err) - // { - // console.log("Error ===> " + err + " ===> getCourseByCampusName") - // }); - - $scope.addMessageClicked = function() { $scope.addMsg = true; // Reveal the "POST" Button @@ -78,6 +68,37 @@ angular.module('SeHub') $scope.msg.msgToAdd = null; } + $scope.displayTasks = function() + { + // apiService.getAllFutureTasks(token, courseId).success(function(data) // need to check courseId + // { + + // }).error(function(err) + // { + + // }); + + + } + + $scope.getCourses = function() + { + // apiService.getAllCoursesByCampus(token, campusId).success(function(data) // Shows all classes from this campus + // { + // $scope.loadingData = false; + // $scope.courses = data; + // console.log("success " + $scope.courses); + // init(); // Executing the function to initialize course display + // if($scope.courses && $scope.courses.length > 0) + // { + // $scope.coursesEmpty = false; + // } + // }).error(function(err) + // { + // console.log("error: " + err); + // }); + } + $scope.clearAllClicked = function() // Clear Screen from text { $scope.messages = []; @@ -95,4 +116,6 @@ angular.module('SeHub') // animation $scope.isEnterd = top.setIsEnterd; + $scope.getCourses(); // Get all the courses info + $scope.displayTasks(); // Display all tasks in task feed }]); \ No newline at end of file diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index 9aaca3b..2591b3c 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -131,7 +131,6 @@ angular.module('SeHub') init(); // Executing the function to initialize course display if($scope.courses && $scope.courses.length > 0) { - // $scope.coursesEmpty = true; $scope.coursesEmpty = false; } }).error(function(err) diff --git a/templates/js/controllers/tasksController.js b/templates/js/controllers/tasksController.js index 33196f4..cd4c459 100644 --- a/templates/js/controllers/tasksController.js +++ b/templates/js/controllers/tasksController.js @@ -3,10 +3,8 @@ angular.module('SeHub') { console.log("in controller"); - $scope.createTaskClicked = function(name) + $scope.createTaskClicked = function() { - var taskName = name; - console.log("task created! " + taskName); $location.path("/tasks/new"); // Reference to 'newTask' page } diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index d7697ef..81d9e7a 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -13,6 +13,14 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, + getUserById: function(token, id){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserById/" + token + "/" + id; + req = { + method : "GET", + url : url + }; + return $http(req); + }, getAllCampuses: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getAll/" + token; req = { @@ -21,25 +29,11 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - sendValidationMail: function(token, email){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/validation/sendmail/" + token; - payload = { - email: email - }; + getCampusesByUser: function(token){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getCampusesByUser/" + token; req = { - method: "POST", - url: url, - data: payload - }; - return $http(req); - }, - updateUser: function(token, payLoad){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/updateUser/" + token; - - req = { - method: "PUT", - url: url, - data: payLoad + method : "GET", + url : url }; return $http(req); }, @@ -48,7 +42,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - }; return $http(req); }, @@ -57,7 +50,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - }; return $http(req); }, @@ -66,17 +58,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - - }; - return $http(req); - }, - createMessage: function(token, payLoad){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/createMessage/" + token; - req = { - method : "POST", - url : url, - data: payLoad - }; return $http(req); }, @@ -85,25 +66,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - - }; - return $http(req); - }, - createCourse: function(token, payLoad){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/create/" + token; - req = { - method : "POST", - url : url, - data: payLoad - }; - return $http(req); - }, - getCampusesByUser: function(token){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getCampusesByUser/" + token; - req = { - method : "GET", - url : url - }; return $http(req); }, @@ -112,7 +74,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - }; return $http(req); }, @@ -121,7 +82,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - }; return $http(req); }, @@ -135,16 +95,6 @@ service.factory('apiService', ['$http', function($http) { }, getProjectsByUser: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/getProjectsByUser/" + token; - req = { - method : "GET", - url : url - - }; - return $http(req); - }, - - getUserById: function(token, id){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserById/" + token + "/" + id; req = { method : "GET", url : url @@ -156,14 +106,21 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - }; return $http(req); }, - joinCourse: function(token, courseId){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/joinCourse/" + token + "/" + courseId; + getCoursesByUserID: function(token, userId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + userId; req = { - method : "PUT", + method : "GET", + url : url + }; + return $http(req); + }, + getAllFutureTasks: function(token, courseId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token + "/" + courseId; + req = { + method : "GET", url : url }; return $http(req); @@ -186,13 +143,52 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - getCoursesByUserID: function(token, userId){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + userId; + createMessage: function(token, payLoad){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/createMessage/" + token; req = { - method : "GET", + method : "POST", + url : url, + data: payLoad + }; + return $http(req); + }, + sendValidationMail: function(token, email){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/validation/sendmail/" + token; + payload = { + email: email + }; + req = { + method: "POST", + url: url, + data: payload + }; + return $http(req); + }, + createCourse: function(token, payLoad){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/create/" + token; + req = { + method : "POST", + url : url, + data: payLoad + }; + return $http(req); + }, + joinCourse: function(token, courseId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/joinCourse/" + token + "/" + courseId; + req = { + method : "PUT", url : url }; return $http(req); + }, + updateUser: function(token, payLoad){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/updateUser/" + token; + req = { + method: "PUT", + url: url, + data: payLoad + }; + return $http(req); } }; }]); \ No newline at end of file diff --git a/templates/views/campuses.html b/templates/views/campuses.html index b04f311..c3e680b 100644 --- a/templates/views/campuses.html +++ b/templates/views/campuses.html @@ -1,7 +1,5 @@
- -

Pick A Campus

-
+

Pick A Campus

diff --git a/templates/views/class.html b/templates/views/class.html index d11ceed..0a8d051 100644 --- a/templates/views/class.html +++ b/templates/views/class.html @@ -55,7 +55,7 @@
@@ -85,4 +85,7 @@
+
+ +
\ No newline at end of file diff --git a/templates/views/home.html b/templates/views/home.html index bec06f6..0737ca4 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -88,6 +88,54 @@ + + + + + +
+ +
+
+
+ +
+
+
+
+ {{user.name}} +
+
+ class_name +
+
+
+
+
+
+ {{msg.text}} +
+
+
+
+
+
+
+ + +

Tab One

+ One +
+
+ + +

Tab Two

+ Two +
+
+
+
+
diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index 885731f..d00caf2 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -1,7 +1,7 @@
- +

My Classes

-
+
diff --git a/templates/views/tasks.html b/templates/views/tasks.html index d38e8b4..e68dc9a 100644 --- a/templates/views/tasks.html +++ b/templates/views/tasks.html @@ -1,17 +1,22 @@

Tasks

-
- Create Task -
- + -

Submitted

-

Submitted...

+ + + + + + + + +
Task NameDateGrade
+
@@ -26,23 +31,20 @@

Not Submitted ..

- - -

WhatEver

-

Bla Bla Bla..

-
-
+
+ Create Task +
-
-
- +
+
+ - {{project.title}} + {{task.title}}