- campuses fixed

- Work in progress (classes, projects)
This commit is contained in:
Matan Bar Yosef 2015-06-26 21:56:41 +03:00
parent 91ac400452
commit 18ca8df227
7 changed files with 93 additions and 87 deletions

View file

@ -151,6 +151,38 @@ body.noscroll
/*width: 100%;*/ /*width: 100%;*/
} }
/*.hvr-curl-top-left {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
position: relative;
}*/
/* Grow Rotate */
/*.campusCard {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: transform;
transition-property: transform;
}*/
.campusCard:hover, .campusCard:focus, .campusCard:active {
-webkit-transform: rotate(4deg);
transform: rotate(4deg);
}
/*.feedMessages /*.feedMessages
{ {
overflow: scroll; overflow: scroll;

View file

@ -3,17 +3,16 @@ angular.module('SeHub')
{ {
$scope.threeSizedArray =[]; $scope.threeSizedArray =[];
var token = $cookies['com.sehub.www']; var token = $cookies['com.sehub.www'];
$scope.campuses = ['Bezalel', 'Ben Gurion', 'Sami Shamoon', 'Afeka', 'Ivrit', 'Kaka', 'Opium']; // TODO REMOVE
// apiService.getCampusesByUser().success(function(data) // Get all the campuses apiService.getCampusesByUser(token).success(function(data) // Get all the campuses
// { {
// console.log("INSIDE"); $scope.campuses = data;
// $scope.campuses = data; console.log("INSIDE " + $scope.campuses);
// }).error(function() { init(); // Executing the function to initialize campuses display
// // TODO
// }); }).error(function() {
// TODO
});
console.log($scope.campuses); console.log($scope.campuses);
@ -49,10 +48,13 @@ angular.module('SeHub')
} }
} }
} }
console.log($scope.threeSizedArray); console.log($scope.threeSizedArray); // TODO REMOVE
} }
init(); // Executing the function to initialize campuses show $scope.goToCampus = function(campusId) // Will pass you to courses by specific campus
{
$location.path('/myClasses/' + campusId.toString());
}

View file

@ -1,16 +1,16 @@
angular.module('SeHub') angular.module('SeHub')
.controller('myClassesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) .controller('myClassesController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{ {
$scope.isStudent = false; $scope.isStudent = false;
$scope.isCourse = false; $scope.isCourse = false;
$scope.isNewCourse = false; $scope.isNewCourse = false;
$scope.newClassName = false; $scope.newClassName = false;
$scope.course = {}; $scope.course = {};
// $scope.globalVar = '';
var token = $cookies['com.sehub.www']; var token = $cookies['com.sehub.www'];
$scope.user.finalDate = ''; $scope.user.finalDate = '';
$scope.user.startDate = ''; $scope.user.startDate = '';
$scope.showMyClass = false; $scope.showMyClass = false;
var campusId = $routeParams.campusId;
if($scope.user.isLecturer) if($scope.user.isLecturer)
{ {
@ -23,58 +23,37 @@ angular.module('SeHub')
console.log("Student Mode!"); console.log("Student Mode!");
} }
apiService.getCoursesByUser(token, campusId).success(function(data) // Get all the courses for display
$scope.courses = ['SE', 'PC', 'Math', 'Calculus', 'Ivrit', 'English', 'Drugs'];
console.log($scope.courses);
// apiService.getClassesByUser().success(function(data) // Get all the courses
// {
// $scope.courses = data;
// }).error(function() {
// // TODO
// });
var init = function()
{ {
var i, j, counter = 0; $scope.courses = data;
var newLength = 0; console.log("success " + $scope.courses);
init(); // Executing the function to initialize course display
if(($scope.courses.length % 3) === 0) }).error(function(err)
{ {
newLength = ($scope.courses.length / 3); console.log("error: " + err);
} });
else
{
newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up
}
$scope.holdArrays.length = newLength; $scope.goToClass = function(classId)
{
for(j = 0; j < newLength; j++) console.log("Done! " + $scope.courses);
{ $location.path('/projects/' + classId.toString()); // Will display all the projects in this course
$scope.holdArrays[j] = [3]; // Creating array in size of 3 in each array cell
}
for(i = 0; i < newLength; i++)
{
for(j = 0; j < newLength; j++)
{
if($scope.courses[(3*i) + j] != null)
{
$scope.holdArrays[i][j] = $scope.courses[(3*i) + j];
}
}
}
console.log($scope.holdArrays);
} }
init(); // Executing the function to initialize course display
$scope.chooseCourseClicked = function() $scope.chooseCourseClicked = function()
{ {
$scope.isCourse = true; $scope.isCourse = true;
console.log("choose course Clicked!!"); console.log("choose course Clicked!!");
apiService.getAllCampuses(token).success(function(data)
{
$scope.campuses = data;
console.log("Campuses: " + $scope.campuses.toString());
}).error(function(err)
{
console.log("Error: " + err);
});
} }
$scope.createCourseClicked = function() $scope.createCourseClicked = function()

View file

@ -108,8 +108,8 @@ service.factory('apiService', ['$http', function($http) {
}; };
return $http(req); return $http(req);
}, },
getClassesByUser: function(){ // Need to add campusName (ngRoute) ~ sagi //TODO getCoursesByUser: function(token, campusId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/ClassesByCourse/" + token; var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + campusId;
req = { req = {
method : "GET", method : "GET",
url : url url : url
@ -117,8 +117,8 @@ service.factory('apiService', ['$http', function($http) {
}; };
return $http(req); return $http(req);
}, },
getProjectsByCourse: function(){ // Need to add courseID (ngRoute) ~ sagi //TODO getProjectsByCourse: function(token, classId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token; var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token + "/" + classId;
req = { req = {
method : "GET", method : "GET",
url : url url : url

View file

@ -1,15 +1,14 @@
<div class = "myCampuses"> <div class = "myCampuses">
<md-content layout-padding layout-margin> <md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-university"></i> My Campuses</h1> <h1 layout-margin style="margin-left:15px"><i class="fa fa-university"></i> Pick A Campus</h1>
</md-content> </md-content>
<md-card class="cardAllCampuses"> <md-card class="cardAllCampuses">
<div class = "allCampusesShow" flex = "99" layout = "row" ng-repeat = "t in threeSizedArray" value = "{{t}}" layout-padding> <div class = "allCampusesShow" flex = "99" layout = "row" ng-repeat = "t in threeSizedArray" value = "{{t}}" layout-padding>
<div flex = "32" layout = "column" ng-repeat = "campus in t" value = "{{campus}}"> <div flex = "32" layout = "column" ng-repeat = "campus in t" value = "{{campus}}">
<a href="http://localhost:8080/home#/myClasses" style="color:black; text-decoration:none;"> <md-button ng-click = "goToCampus(campus.id)" style="width:32%; height:32%;" flex="32" layout-padding class = "md-raised">
<md-card flex="32" layout-padding class = "campusCard"> <!-- <img src="{{campus.avatar_url}}" style = "width:14%; height:auto;"> -->
{{campus}} {{campus.title}}
</md-card> </md-button>
</a>
</div> </div>
</div> </div>
</md-card> </md-card>

View file

@ -5,26 +5,15 @@
<md-card class="cardAllcourses"> <md-card class="cardAllcourses">
<div flex = "99" class = "allcoursesShow" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}"> <div flex = "99" class = "allcoursesShow" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}">
<div flex ="32" layout = "column" ng-repeat = "course in t" value = "{{course}}" layout-padding> <div flex ="32" layout = "column" ng-repeat = "course in t" value = "{{course}}" layout-padding>
<a href="http://localhost:8080/home#/projects" style="color:black; text-decoration:none;"> <!-- <a href="http://localhost:8080/home#/projects" style="color:black; text-decoration:none;"> -->
<md-card layout-padding class = "campusCard"> <md-card ng-click = "goToClass(course.id)" style="width:32%; height:32%;" layout-padding class = "campusCard">
{{course}} {{course.id}}
</md-card> </md-card>
</a> <!-- </a> -->
</div> </div>
</div> </div>
</md-card> </md-card>
<!-- <div class = "allCampusesShow" flex = "99" layout = "row" ng-repeat = "t in threeSizedArray" value = "{{t}}" layout-padding>
<div flex = "32" layout = "column" ng-repeat = "campus in t" value = "{{campus}}">
<a href="http://localhost:8080/home#/myClasses" style="color:black; text-decoration:none;">
<md-card layout-padding class = "campusCard">
{{campus}}
</md-card>
</a>
</div>
</div> -->
<div ng-if="user.isLecturer"> <!-- Lecturer Mode --> <div ng-if="user.isLecturer"> <!-- Lecturer Mode -->
<div layout="row"> <div layout="row">
<div layout-margin layout-padding> <div layout-margin layout-padding>
@ -40,6 +29,11 @@
<md-input-container flex = "50"> <md-input-container flex = "50">
<label>Campus name</label> <label>Campus name</label>
<input ng-model="course.campusName" required> <input ng-model="course.campusName" required>
<!-- <md-select placeholder="Pick your Class" ng-model="chosenCampus" style="z-index: 400" ng-change="chooseCourseClicked()"> -->
<!-- <md-option ng-switch="user.isLecturer" ng-repeat="c in campuses" value="{{c.title}}"> -->
<!-- {{c.title}} -->
<!-- </md-option> -->
<!-- </md-select> -->
</md-input-container> </md-input-container>
</div> </div>
<div layout layout-sm="column"> <div layout layout-sm="column">

View file

@ -3,11 +3,11 @@
<md-card class="cardAllProjects"> <md-card class="cardAllProjects">
<div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}"> <div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}">
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding> <div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding>
<a href="http://localhost:8080/home#/thisProject" style="color:black; text-decoration:none;"> <!-- <a href="http://localhost:8080/home#/thisProject" style="color:black; text-decoration:none;"> -->
<md-card layout-padding flex class = "projectCard"> <md-card layout-padding ng-click = "goToProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
{{project}} {{project.id}}
</md-card> </md-card>
</a> <!-- </a> -->
</div> </div>
</div> </div>
</md-card> </md-card>