- 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%;*/
}
/*.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
{
overflow: scroll;

View file

@ -3,17 +3,16 @@ angular.module('SeHub')
{
$scope.threeSizedArray =[];
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
// {
// console.log("INSIDE");
// $scope.campuses = data;
// }).error(function() {
// // TODO
// });
apiService.getCampusesByUser(token).success(function(data) // Get all the campuses
{
$scope.campuses = data;
console.log("INSIDE " + $scope.campuses);
init(); // Executing the function to initialize campuses display
}).error(function() {
// TODO
});
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')
.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.isCourse = false;
$scope.isNewCourse = false;
$scope.newClassName = false;
$scope.course = {};
// $scope.globalVar = '';
var token = $cookies['com.sehub.www'];
$scope.user.finalDate = '';
$scope.user.startDate = '';
$scope.showMyClass = false;
var campusId = $routeParams.campusId;
if($scope.user.isLecturer)
{
@ -23,58 +23,37 @@ angular.module('SeHub')
console.log("Student Mode!");
}
$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()
apiService.getCoursesByUser(token, campusId).success(function(data) // Get all the courses for display
{
var i, j, counter = 0;
var newLength = 0;
if(($scope.courses.length % 3) === 0)
{
newLength = ($scope.courses.length / 3);
}
else
{
newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up
}
$scope.courses = data;
console.log("success " + $scope.courses);
init(); // Executing the function to initialize course display
}).error(function(err)
{
console.log("error: " + err);
});
$scope.holdArrays.length = newLength;
for(j = 0; j < newLength; j++)
{
$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);
$scope.goToClass = function(classId)
{
console.log("Done! " + $scope.courses);
$location.path('/projects/' + classId.toString()); // Will display all the projects in this course
}
init(); // Executing the function to initialize course display
$scope.chooseCourseClicked = function()
{
$scope.isCourse = true;
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()

View file

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

View file

@ -1,15 +1,14 @@
<div class = "myCampuses">
<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-card class="cardAllCampuses">
<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 flex="32" layout-padding class = "campusCard">
{{campus}}
</md-card>
</a>
<md-button ng-click = "goToCampus(campus.id)" style="width:32%; height:32%;" flex="32" layout-padding class = "md-raised">
<!-- <img src="{{campus.avatar_url}}" style = "width:14%; height:auto;"> -->
{{campus.title}}
</md-button>
</div>
</div>
</md-card>

View file

@ -5,26 +5,15 @@
<md-card class="cardAllcourses">
<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>
<a href="http://localhost:8080/home#/projects" style="color:black; text-decoration:none;">
<md-card layout-padding class = "campusCard">
{{course}}
<!-- <a href="http://localhost:8080/home#/projects" style="color:black; text-decoration:none;"> -->
<md-card ng-click = "goToClass(course.id)" style="width:32%; height:32%;" layout-padding class = "campusCard">
{{course.id}}
</md-card>
</a>
<!-- </a> -->
</div>
</div>
</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 layout="row">
<div layout-margin layout-padding>
@ -40,6 +29,11 @@
<md-input-container flex = "50">
<label>Campus name</label>
<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>
</div>
<div layout layout-sm="column">

View file

@ -3,11 +3,11 @@
<md-card class="cardAllProjects">
<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>
<a href="http://localhost:8080/home#/thisProject" style="color:black; text-decoration:none;">
<md-card layout-padding flex class = "projectCard">
{{project}}
<!-- <a href="http://localhost:8080/home#/thisProject" style="color:black; text-decoration:none;"> -->
<md-card layout-padding ng-click = "goToProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
{{project.id}}
</md-card>
</a>
<!-- </a> -->
</div>
</div>
</md-card>