- Main menu nav - Project reference fixed

This commit is contained in:
Matan Bar Yosef 2015-06-27 12:58:04 +03:00
parent c64b865f3d
commit b630f0d696
2 changed files with 29 additions and 34 deletions

View file

@ -31,7 +31,7 @@ angular.module('SeHub')
"title": "Projects", "title": "Projects",
"icon": "fa fa-cube", "icon": "fa fa-cube",
"style": "", "style": "",
"route": "/projects" "route": "/projects/" + $scope.user.id.toString()
}, { }, {
"title": "Tasks", "title": "Tasks",
"icon": "fa fa-clipboard", "icon": "fa fa-clipboard",

View file

@ -5,8 +5,6 @@ angular.module('SeHub')
var classId = $routeParams.id; var classId = $routeParams.id;
$scope.projectEmpty = false; $scope.projectEmpty = false;
$scope.displayProjects = function() $scope.displayProjects = function()
{ {
console.log("in displayProjecs!!! "); console.log("in displayProjecs!!! ");
@ -19,6 +17,10 @@ angular.module('SeHub')
{ {
console.log("Error: " + err); console.log("Error: " + err);
}); });
if($scope.projects = null)
{
$scope.projectEmpty = true;
}
} }
@ -43,42 +45,35 @@ angular.module('SeHub')
{ {
var i, j, counter = 0; var i, j, counter = 0;
var newLength = 0; var newLength = 0;
if($scope.projects != null) if(($scope.projects.length % 3) === 0)
{ {
if(($scope.projects.length % 3) === 0) newLength = ($scope.projects.length / 3);
{
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);
} }
else else
{ {
$scope.projectEmpty = true; 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);
} }