- work in progress

This commit is contained in:
Matan Bar Yosef 2015-06-26 16:49:46 +03:00
parent 2f870ba050
commit f3226e0896
10 changed files with 199 additions and 52 deletions

View file

@ -1,17 +1,59 @@
angular.module('SeHub')
.controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) {
.controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope)
{
$scope.threeSizedArray =[];
var token = $cookies['com.sehub.www'];
$scope.campuses = ['Bezalel', 'Ben Gurion', 'Sami Shamoon', 'Afeka', 'Ivrit', 'Kaka', 'Opium']; // TODO REMOVE
$scope.campuses = ['Bezalel', 'Ben Gurion', 'Sami Shamoon', 'Afeka', 'Ivrit', 'Kaka', 'Opium'];
console.log($scope.campuses);
// apiService.getCampusesByUser(token).success(function(data) // Get all the campuses
// apiService.getCampusesByUser().success(function(data) // Get all the campuses
// {
// console.log("INSIDE");
// $scope.campuses = data;
// }).error(function() {
// // TODO
// });
console.log($scope.campuses);
}]);
var init = function()
{
var i, j, counter = 0;
var newLength = 0;
if(($scope.campuses.length % 3) === 0)
{
newLength = ($scope.campuses.length / 3);
}
else
{
newLength = (Math.ceil($scope.campuses.length / 3)); // Rounds number up
}
console.log("length: " + newLength);
$scope.threeSizedArray.length = newLength;
for(j = 0; j < newLength; j++)
{
$scope.threeSizedArray[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.campuses[(3*i) + j] != null)
{
$scope.threeSizedArray[i][j] = $scope.campuses[(3*i) + j];
}
}
}
console.log($scope.threeSizedArray);
}
init(); // Executing the function to initialize campuses show
}]);

View file

@ -6,6 +6,7 @@ angular.module('SeHub')
$scope.isNewCourse = false;
$scope.newClassName = false;
$scope.course = {};
// $scope.globalVar = '';
var token = $cookies['com.sehub.www'];
$scope.user.finalDate = '';
$scope.user.startDate = '';
@ -24,15 +25,51 @@ angular.module('SeHub')
$scope.courses = ['SE', 'PC', 'Math', 'Calculus', 'Ivrit', 'English', 'Drugs'];
console.log($scope.courses);
// apiService.getClassesByUser(token).success(function(data) // Get all the campuses
// apiService.getClassesByUser().success(function(data) // Get all the courses
// {
// $scope.courses = data;
// }).error(function() {
// // TODO
// });
var init = function()
{
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.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);
}
init(); // Executing the function to initialize course display
$scope.chooseCourseClicked = function()
{
@ -65,6 +102,8 @@ angular.module('SeHub')
}
};
// $scope.globalVar = jsonNewCourse;
console.log("Json here:");
console.log(jsonNewCourse);
@ -89,6 +128,41 @@ angular.module('SeHub')
}
}
var init = function()
{
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
}
console.log("length: " + newLength);
$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);
}
}]);

View file

@ -19,5 +19,42 @@ angular.module('SeHub')
// // TODO
// });
var init = function()
{
var i, j, counter = 0;
var newLength = 0;
if(($scope.projects.length % 3) === 0)
{
newLength = ($scope.projects.length / 3);
}
else
{
newLength = (Math.ceil($scope.projects.length / 3)); // Rounds number up
}
console.log("length: " + newLength);
$scope.arrayHolder.length = newLength;
for(j = 0; j < newLength; j++)
{
$scope.arrayHolder[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.projects[(3*i) + j] != null)
{
$scope.arrayHolder[i][j] = $scope.projects[(3*i) + j];
}
}
}
console.log($scope.arrayHolder);
}
init(); // Executing the function to initialize projects display
}]);

View file

@ -90,7 +90,7 @@ angular.module('SeHub')
};
$scope.createCampus = function(ev) {
$scope.createCampusClicked = true;
$scope.createCampusClicked = !$scope.createCampusClicked;
if (!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing)
{

View file

@ -44,29 +44,18 @@ 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;
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseByCampusName/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
getAllCourses: function(token){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
getAllMessages: function(token){
getAllMessages: function(){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAllMessages/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
@ -76,7 +65,6 @@ service.factory('apiService', ['$http', function($http) {
method : "POST",
url : url,
data: payLoad
};
return $http(req);
},
@ -85,7 +73,6 @@ service.factory('apiService', ['$http', function($http) {
req = {
method : "GET",
url : url
};
return $http(req);
},
@ -95,25 +82,22 @@ service.factory('apiService', ['$http', function($http) {
method : "POST",
url : url,
data: payLoad
};
return $http(req);
},
getCampusesByUser: function(){
getCampusesByUser: function(token){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCampusesByUser/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
getClassesByCourse: function(){ // Need to add camusName (ngRoute) ~ sagi //TODO
getClassesByUser: function(){ // Need to add campusName (ngRoute) ~ sagi //TODO
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/ClassesByCourse/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
@ -122,7 +106,6 @@ service.factory('apiService', ['$http', function($http) {
req = {
method : "GET",
url : url
};
return $http(req);
}

View file

@ -3,10 +3,10 @@
<h1 layout-margin style="margin-left:15px"><i class="fa fa-university"></i> My Campuses</h1>
</md-content>
<md-card class="cardAllCampuses">
<div class = "allCampusesShow" layout = "column">
<div layout = "row" ng-repeat = "campus in campuses" value = "{{campus}}" 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}}">
<a href="http://localhost:8080/home#/myClasses" style="color:black; text-decoration:none;">
<md-card layout-padding class = "campusCard">
<md-card flex="32" layout-padding class = "campusCard">
{{campus}}
</md-card>
</a>

View file

@ -2,11 +2,11 @@
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> My Classes</h1>
</md-content>
<md-card flex = "99" class="cardAllcourses">
<div flex class = "allcoursesShow" ><!-- layout = "column"> -->
<div flex layout = "row" ng-repeat = "course in courses" value = "{{course}}" layout-padding>
<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 flex class = "campusCard">
<md-card layout-padding class = "campusCard">
{{course}}
</md-card>
</a>
@ -14,6 +14,17 @@
</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>

View file

@ -1,8 +1,8 @@
<div class = "projects">
<h1 style="margin-left:15px"><i class="fa fa-cube"></i> Projects</h1>
<md-card flex = "99" class="cardAllProjects">
<div flex class = "allProjectsShow" layout = "column">
<div flex layout = "row" ng-repeat = "project in projects" value = "{{project}}" layout-padding>
<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}}

View file

@ -11,25 +11,25 @@
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Commits">
<md-content class="md-padding">
<h1 class="md-display-2">Tab One</h1>
<h1 class="md-display-2">Commits</h1>
<p>Commits...</p>
</md-content>
</md-tab>
<md-tab label="Issues">
<md-content class="md-padding">
<h1 class="md-display-2">Tab Two</h1>
<h1 class="md-display-2">Issues</h1>
<p>Issues...</p>
</md-content>
</md-tab>
<md-tab label="Bugs">
<md-content class="md-padding">
<h1 class="md-display-2">Tab Three</h1>
<h1 class="md-display-2">Bugs</h1>
<p> Bugs Bugs Bugs..</p>
</md-content>
</md-tab>
<md-tab label="WhatEver">
<md-content class="md-padding">
<h1 class="md-display-2">Tab Two</h1>
<h1 class="md-display-2">WhatEver</h1>
<p>Bla Bla Bla..</p>
</md-content>
</md-tab>

View file

@ -3,16 +3,16 @@
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> {{user.name}}'s project</h1>
<div layout-padding layout-margin>
<div layout = "row" layout-padding layout-margin>
<div flex = "45">
<div flex = "49">
Project Creator: {{user.name}} <!-- Should Be Project creator -->
</div>
<div flex = "45" >
<div flex = "49" >
<div ng-if="user.isLecturer">
<div layout = "row" layout-padding>
<div>
<md-button ng-click="editPressed()" class="md-raised md-primary">Edit</md-button>
</div>
<div ng-if="isEditPressed" style="size:inherit;">
<div ng-if="isEditPressed">
<md-button ng-click="removeProject()" class="md-raised md-primary"><i class = "fa fa-trash-o"></i></md-button>
</div>
</div>
@ -20,12 +20,12 @@
</div>
</div>
<div layout = "row" layout-padding layout-margin>
<div flex = "45">
<div flex = "49">
<md-card>
Here Will Be Graph - Commits Over Period Of Time
</md-card>
</div>
<div flex = "45">
<div flex = "49">
<md-card>
Here Will Be Graph (by columns) - Commits, Issues, Open Tasks
</md-card>