From 1d5655b0564618666744f55262c6d1263087a7b1 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Tue, 23 Jun 2015 19:04:41 +0300 Subject: [PATCH 1/2] - create course - added - show my classes - added --- templates/js/app.js | 4 +++ templates/js/controllers/homeController.js | 26 +++++++++++++++---- .../js/controllers/registerController.js | 2 +- templates/js/services/apiService.js | 11 ++++++++ templates/views/home.html | 6 +++-- templates/views/index.html | 1 + 6 files changed, 42 insertions(+), 8 deletions(-) diff --git a/templates/js/app.js b/templates/js/app.js index 9fb2986..1ab2ed6 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -57,6 +57,10 @@ app.config(['$routeProvider', '$locationProvider', .when('/projects', { templateUrl: 'templates/views/projects.html', controller: 'projectsController' + }) + .when('/newCourse', { + templateUrl: 'templates/views/newCourse.html', + controller: 'newCourseController' }); } ]); diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 9a13dbb..58c7c10 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -6,17 +6,28 @@ angular.module('SeHub') $scope.msgToPost = ""; $scope.oldText = ""; $scope.messages = []; + $scope.msg = {}; + + $rootScope.seToken = $cookies['com.sehub.www']; + var token = $rootScope.seToken; var imagePath = $scope.user.avatar_url; + //var campusName = ''; + $scope.course = ''; + // $scope.campusName = ''; + $scope.phones = [ { type: 'Home', number: '(972) 865-82861' }, { type: 'Cell', number: '(972) 5251-32309' }, ]; + + if($scope.user.isLecturer) { $scope.isStudent = false; console.log("Lecturer Mode!"); + // console.log($scope.campusName); } else { @@ -24,12 +35,20 @@ angular.module('SeHub') console.log("Student Mode!"); } + // apiService.getCourseByCampusName($scope.user.classes_id_list[0]).success(function(data) + // { + // console.log("Campus Name is ON! " + $scope.user.classes_id_list[0]) + // $scope.course = data; + // }).error(function() + // { + // console.log("Error on ===> getCourseByCampusName") + // }); + + $scope.addMessageClicked = function() { $scope.addMsg = true; // Reveal the "POST" Button } - - $scope.msg = {}; $scope.postMessageClicked = function() // Posting the message itself { if($scope.msg.msgToAdd != null) @@ -48,14 +67,11 @@ angular.module('SeHub') $scope.chooseCourseClicked = function() { console.log("choose course Clicked!!"); - - } $scope.chooseProjectClicked = function() { console.log("choose project Clicked!!"); - } diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index 6ce4d08..279fddd 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -26,7 +26,7 @@ angular.module('SeHub') if($scope.user.name === ";") { $scope.user.name = ""; - $scope.user.name = $scope.user.username + $scope.user.name = $scope.user.username; $scope.userHasNoName = true; } diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 276fa04..d6d1a03 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -1,3 +1,4 @@ + var DEBUG = true; var service = angular.module('seHub.services', []); @@ -42,6 +43,16 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, + getCourseByCampusName: function(token){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token; + req = { + method : "GET", + url : url, + data: token + + }; + return $http(req); + }, getAllCourses: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token; req = { diff --git a/templates/views/home.html b/templates/views/home.html index 8f8902f..980eaa6 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -88,8 +88,10 @@ -
- +
+
+ +
diff --git a/templates/views/index.html b/templates/views/index.html index 1deec32..f978bb1 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -115,6 +115,7 @@ + \ No newline at end of file From ff9ea861317fa712f8ff31284640557c15dab82a Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Tue, 23 Jun 2015 19:40:30 +0300 Subject: [PATCH 2/2] - Files Added: myClasses, newcourse, projects, tasks --- .../js/controllers/myClassesController.js | 60 ++++++ .../js/controllers/newCourseController.js | 10 + .../js/controllers/projectsController.js | 16 ++ templates/js/controllers/tasksController.js | 17 ++ templates/views/home.html | 18 +- templates/views/myClasses.html | 186 ++++++++++++++++++ templates/views/newCourse.html | 6 + templates/views/projects.html | 6 + templates/views/tasks.html | 6 + 9 files changed, 316 insertions(+), 9 deletions(-) create mode 100644 templates/js/controllers/myClassesController.js create mode 100644 templates/js/controllers/newCourseController.js create mode 100644 templates/js/controllers/projectsController.js create mode 100644 templates/js/controllers/tasksController.js create mode 100644 templates/views/myClasses.html create mode 100644 templates/views/newCourse.html create mode 100644 templates/views/projects.html create mode 100644 templates/views/tasks.html diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js new file mode 100644 index 0000000..8ca5128 --- /dev/null +++ b/templates/js/controllers/myClassesController.js @@ -0,0 +1,60 @@ +angular.module('SeHub') +.controller('myClassesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + $scope.isStudent = false; + $scope.isCourse = false; + $scope.isNewCourse = false; + $scope.newClassName = false; + $scope.user.createNewCourse = ''; + $scope.user.finalDate = ''; + $scope.showMyClass = false; + + if($scope.user.isLecturer) + { + $scope.isStudent = false; + console.log("Lecturer Mode!"); + } + else + { + $scope.isStudent = true; + console.log("Student Mode!"); + } + + + $scope.chooseCourseClicked = function() + { + $scope.isCourse = true; + console.log("choose course Clicked!!"); + } + + $scope.createCourseClicked = function() + { + $scope.isNewCourse = true; + console.log("create course Clicked!!"); + } + + $scope.showMyCourses = function() + { + $scope.showMyClass = true; + } + + $scope.submitNewClassClicked = function() + { + if($scope.user.createNewCourse != '' && $scope.user.finalDate != '') + { + console.log("finalDate " + $scope.user.finalDate); + console.log($scope.user.createNewCourse); + $mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.') + .ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent()); + // $window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO + } + else + { + $mdDialog.show($mdDialog.alert().title('Error - Creating Course').content('You have encountered and error in creating the course.') + .ariaLabel('Email verification alert dialog').ok('Try Again!').targetEvent()); + } + } + + + +}]); \ No newline at end of file diff --git a/templates/js/controllers/newCourseController.js b/templates/js/controllers/newCourseController.js new file mode 100644 index 0000000..f66f396 --- /dev/null +++ b/templates/js/controllers/newCourseController.js @@ -0,0 +1,10 @@ +angular.module('SeHub') +.controller('newCourseController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + + $scope.goBack = function() + { + $window.location.href = 'templates/views/myClasses.html'; + } + +}]); \ No newline at end of file diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js new file mode 100644 index 0000000..f074dc3 --- /dev/null +++ b/templates/js/controllers/projectsController.js @@ -0,0 +1,16 @@ +angular.module('SeHub') +.controller('projectsContoller', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + console.log("in projects controller"); + + $scope.createProjectClicked = function() + { + console.log("project created! not rly!! "); + // $window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page + + } + + + + +}]); \ No newline at end of file diff --git a/templates/js/controllers/tasksController.js b/templates/js/controllers/tasksController.js new file mode 100644 index 0000000..416dc63 --- /dev/null +++ b/templates/js/controllers/tasksController.js @@ -0,0 +1,17 @@ +angular.module('SeHub') +.controller('tasksController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + console.log("in controller"); + + $scope.createTaskClicked = function(name) + { + var taskName = name; + console.log("task created! " + taskName); + $window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page + + } + + + + +}]); \ No newline at end of file diff --git a/templates/views/home.html b/templates/views/home.html index 980eaa6..39db020 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -114,52 +114,52 @@
- + Press On Me - + Press On Me - + Press On Me diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html new file mode 100644 index 0000000..de8a765 --- /dev/null +++ b/templates/views/myClasses.html @@ -0,0 +1,186 @@ + \ No newline at end of file diff --git a/templates/views/newCourse.html b/templates/views/newCourse.html new file mode 100644 index 0000000..03b9c60 --- /dev/null +++ b/templates/views/newCourse.html @@ -0,0 +1,6 @@ +
+ +

My New Course

+ Go Back +
+
\ No newline at end of file diff --git a/templates/views/projects.html b/templates/views/projects.html new file mode 100644 index 0000000..0c03cde --- /dev/null +++ b/templates/views/projects.html @@ -0,0 +1,6 @@ +
+ +

Projects

+ Create Project +
+
\ No newline at end of file diff --git a/templates/views/tasks.html b/templates/views/tasks.html new file mode 100644 index 0000000..7a9c87e --- /dev/null +++ b/templates/views/tasks.html @@ -0,0 +1,6 @@ +
+ +

Tasks

+ Create Task +
+
\ No newline at end of file