commit
9fec73008c
4 changed files with 49 additions and 36 deletions
|
@ -29,7 +29,6 @@ angular.module('SeHub')
|
|||
{
|
||||
console.log("Error: " + err);
|
||||
});
|
||||
|
||||
}
|
||||
$scope.joinCourse = function()
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
$scope.isEditPressed = false;
|
||||
$scope.loadingDate = true;
|
||||
$scope.loadingData = true;
|
||||
$scope.myProjectsEmpty = true;
|
||||
$scope.user = $scope.$parent.user;
|
||||
var token = $cookies['com.sehub.www'];
|
||||
|
@ -12,12 +12,15 @@ angular.module('SeHub')
|
|||
{
|
||||
apiService.getProjectsByUser(token).success(function(data)
|
||||
{
|
||||
$scope.loadingDate = false;
|
||||
$scope.loadingData = false;
|
||||
$scope.myProjects = data;
|
||||
if($scope.myProjects != null && $scope.myProjects.length > 0)
|
||||
{
|
||||
$scope.myProjectsEmpty = false;
|
||||
}
|
||||
init(); // Executing the function to initialize my projects display
|
||||
console.log(data);
|
||||
console.log("Success");
|
||||
}).error(function(err)
|
||||
{
|
||||
console.log("Error: " + err.message);
|
||||
|
@ -42,16 +45,16 @@ angular.module('SeHub')
|
|||
$scope.arrayHolder = [];
|
||||
var tempArr = [];
|
||||
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){
|
||||
tempArr.push($scope.projects[i]);
|
||||
tempArr.push($scope.myProjects[i]);
|
||||
}else{
|
||||
if(i !== 0){
|
||||
$scope.arrayHolder.push(tempArr);
|
||||
tempArr = [];
|
||||
tempArr.push($scope.projects[i]);
|
||||
tempArr.push($scope.myProjects[i]);
|
||||
}else{
|
||||
tempArr.push($scope.projects[i]);
|
||||
tempArr.push($scope.myProjects[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,12 +10,23 @@
|
|||
<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>
|
||||
<md-card layout-padding ng-click = "goToProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
|
||||
<div ng-if="t.length != 1">
|
||||
<md-button ng-click = "goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
|
||||
{{project.projectName}}
|
||||
<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 layout-align="center center" style=" width:70%;">
|
||||
<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>
|
||||
</md-card>
|
||||
</div>
|
||||
|
|
|
@ -6,16 +6,18 @@
|
|||
<div ng-if = "myProjectsEmpty && !loadingData" layout-padding layout-margin>
|
||||
You Are Not Related To Any Project.
|
||||
</div>
|
||||
<div ng-if="!myProjects">
|
||||
<div ng-if="!myProjectsEmpty">
|
||||
<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 ng-if = "!scope.myProjectsEmpty">
|
||||
<div ng-if="t.length != 1">
|
||||
<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-content>
|
||||
<h2 class="md-title">{{project.id}}</h2>
|
||||
<h2 class="md-title">{{project.projectName}}</h2>
|
||||
<div layout-align="center center" style=" width:70%;">
|
||||
<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-content>
|
||||
</md-card>
|
||||
</md-button>
|
||||
|
@ -24,16 +26,14 @@
|
|||
<md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised">
|
||||
<md-card style="width:97%;height:97%">
|
||||
<md-card-content>
|
||||
<h2 class="md-title">{{project.id}}</h2>
|
||||
<h2 class="md-title">{{project.projectName}}</h2>
|
||||
<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-content>
|
||||
</md-card>
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<div ng-if = "scope.myProjectsEmpty">
|
||||
You Do Not Have Any Project, You May Create One.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</md-card>
|
||||
|
|
Loading…
Reference in a new issue