From b630f0d69648233ad18d9bc9d96cf2fece1a3684 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sat, 27 Jun 2015 12:58:04 +0300 Subject: [PATCH] - Main menu nav - Project reference fixed --- templates/js/controllers/mainController.js | 2 +- .../js/controllers/projectsController.js | 61 +++++++++---------- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/templates/js/controllers/mainController.js b/templates/js/controllers/mainController.js index 964b4ec..135b39c 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -31,7 +31,7 @@ angular.module('SeHub') "title": "Projects", "icon": "fa fa-cube", "style": "", - "route": "/projects" + "route": "/projects/" + $scope.user.id.toString() }, { "title": "Tasks", "icon": "fa fa-clipboard", diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js index a83fd6b..a2c835f 100644 --- a/templates/js/controllers/projectsController.js +++ b/templates/js/controllers/projectsController.js @@ -5,8 +5,6 @@ angular.module('SeHub') var classId = $routeParams.id; $scope.projectEmpty = false; - - $scope.displayProjects = function() { console.log("in displayProjecs!!! "); @@ -19,6 +17,10 @@ angular.module('SeHub') { console.log("Error: " + err); }); + if($scope.projects = null) + { + $scope.projectEmpty = true; + } } @@ -43,42 +45,35 @@ angular.module('SeHub') { var i, j, counter = 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); - } - 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); + newLength = ($scope.projects.length / 3); } 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); }