-Graphs - fixed

This commit is contained in:
Matan Bar Yosef 2015-06-29 20:04:33 +03:00
parent 7065a645ce
commit e19f4fd03a
4 changed files with 49 additions and 36 deletions

View file

@ -29,7 +29,6 @@ angular.module('SeHub')
{ {
console.log("Error: " + err); console.log("Error: " + err);
}); });
} }
$scope.joinCourse = function() $scope.joinCourse = function()
{ {

View file

@ -2,7 +2,7 @@ angular.module('SeHub')
.controller('myProjectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) .controller('myProjectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{ {
$scope.isEditPressed = false; $scope.isEditPressed = false;
$scope.loadingDate = true; $scope.loadingData = true;
$scope.myProjectsEmpty = true; $scope.myProjectsEmpty = true;
$scope.user = $scope.$parent.user; $scope.user = $scope.$parent.user;
var token = $cookies['com.sehub.www']; var token = $cookies['com.sehub.www'];
@ -12,12 +12,15 @@ angular.module('SeHub')
{ {
apiService.getProjectsByUser(token).success(function(data) apiService.getProjectsByUser(token).success(function(data)
{ {
$scope.loadingDate = false; $scope.loadingData = false;
$scope.myProjects = data; $scope.myProjects = data;
if($scope.myProjects != null && $scope.myProjects.length > 0) if($scope.myProjects != null && $scope.myProjects.length > 0)
{ {
$scope.myProjectsEmpty = false; $scope.myProjectsEmpty = false;
} }
init(); // Executing the function to initialize my projects display
console.log(data);
console.log("Success");
}).error(function(err) }).error(function(err)
{ {
console.log("Error: " + err.message); console.log("Error: " + err.message);
@ -42,16 +45,16 @@ angular.module('SeHub')
$scope.arrayHolder = []; $scope.arrayHolder = [];
var tempArr = []; var tempArr = [];
var sizeOfSmallArrays = 3; var sizeOfSmallArrays = 3;
for (var i = 0 ; i < $scope.projects.length ; i++) { for (var i = 0 ; i < $scope.myProjects.length ; i++) {
if(i % sizeOfSmallArrays !== 0){ if(i % sizeOfSmallArrays !== 0){
tempArr.push($scope.projects[i]); tempArr.push($scope.myProjects[i]);
}else{ }else{
if(i !== 0){ if(i !== 0){
$scope.arrayHolder.push(tempArr); $scope.arrayHolder.push(tempArr);
tempArr = []; tempArr = [];
tempArr.push($scope.projects[i]); tempArr.push($scope.myProjects[i]);
}else{ }else{
tempArr.push($scope.projects[i]); tempArr.push($scope.myProjects[i]);
} }
} }
}; };

View file

@ -10,11 +10,22 @@
<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>
<md-card layout-padding ng-click = "goToProject(project.id)" style="width:32%; height:32%;" class = "projectCard"> <div ng-if="t.length != 1">
{{project.projectName}} <md-button ng-click = "goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data" {{project.projectName}}
labels="project.info.stats.macro.labels"></canvas> <div layout-align="center center" style=" width:70%;">
</md-card> <canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data" labels="project.info.stats.macro.labels"></canvas>
</div>
</md-card>
</div>
<div ng-if="t.length == 1">
<md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised">
{{project.projectName}}
<!-- <div style="height:100%; width:32%;"> -->
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data" labels="project.info.stats.macro.labels"></canvas>
<!-- </div> -->
</md-card>
</div>
</div> </div>
</div> </div>
</md-card> </md-card>

View file

@ -6,34 +6,34 @@
<div ng-if = "myProjectsEmpty && !loadingData" layout-padding layout-margin> <div ng-if = "myProjectsEmpty && !loadingData" layout-padding layout-margin>
You Are Not Related To Any Project. You Are Not Related To Any Project.
</div> </div>
<div ng-if="!myProjects"> <div ng-if="!myProjectsEmpty">
<md-card class="cardAllProjects"> <md-card class="cardAllProjects">
<div flex = "99" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}" layout-padding> <div flex = "99" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}" layout-padding>
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" > <div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" >
<div ng-if = "!scope.myProjectsEmpty"> <div ng-if="t.length != 1">
<div ng-if="t.length != 1"> <md-button ng-click="goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
<md-button ng-click="goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised"> <md-card style="width:97%;height:97%">
<md-card style="width:97%;height:97%"> <md-card-content>
<md-card-content> <h2 class="md-title">{{project.projectName}}</h2>
<h2 class="md-title">{{project.id}}</h2> <div layout-align="center center" style=" width:70%;">
</md-card-content> <canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data" labels="project.info.stats.macro.labels"></canvas>
</md-card> </div>
</md-button> </md-card-content>
</div> </md-card>
<div ng-if="t.length == 1"> </md-button>
<md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised"> </div>
<md-card style="width:97%;height:97%"> <div ng-if="t.length == 1">
<md-card-content> <md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised">
<h2 class="md-title">{{project.id}}</h2> <md-card style="width:97%;height:97%">
</md-card-content> <md-card-content>
</md-card> <h2 class="md-title">{{project.projectName}}</h2>
</md-button> <canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data"
</div> labels="project.info.stats.macro.labels"></canvas>
</md-card-content>
</md-card>
</md-button>
</div> </div>
<div class="spacer"></div> <div class="spacer"></div>
<div ng-if = "scope.myProjectsEmpty">
You Do Not Have Any Project, You May Create One.
</div>
</div> </div>
</div> </div>
</md-card> </md-card>