commit
6417e76761
2 changed files with 166 additions and 0 deletions
81
templates/js/controllers/myProjectsController.js
Normal file
81
templates/js/controllers/myProjectsController.js
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
angular.module('SeHub')
|
||||||
|
.controller('thisProjectController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
||||||
|
{
|
||||||
|
$scope.isEditPressed = false;
|
||||||
|
$scope.myProjectsEmpty = false;
|
||||||
|
var token = $cookies['com.sehub.www'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$scope.displayMyProjects = function()
|
||||||
|
{
|
||||||
|
apiService.getProjectsByUser(token).success(function(data)
|
||||||
|
{
|
||||||
|
console.log("Success " + data);
|
||||||
|
$scope.myProjects = data;
|
||||||
|
}).error(function(err)
|
||||||
|
{
|
||||||
|
console.log("Error: " + err);
|
||||||
|
});
|
||||||
|
if($scope.myProjects === null)
|
||||||
|
{
|
||||||
|
myProjectsEmpty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.goToMyProject = function()
|
||||||
|
{
|
||||||
|
console.log("projects only from classID: " + classId)
|
||||||
|
$location.path('/thisProject' + classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.editPressed = function()
|
||||||
|
{
|
||||||
|
$scope.isEditPressed = true;
|
||||||
|
console.log("EditPressed " + $scope.isEditPressed);
|
||||||
|
}
|
||||||
|
$scope.removeProject = function()
|
||||||
|
{
|
||||||
|
console.log("Project has been removed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$scope.displayMyProjects(); // Will display all my projects
|
||||||
|
|
||||||
|
}]);
|
85
templates/views/myProjects.html
Normal file
85
templates/views/myProjects.html
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
<div class = "myProjects">
|
||||||
|
<md-content layout-padding layout-margin>
|
||||||
|
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> {{user.name}}'s projects</h1>
|
||||||
|
<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>
|
||||||
|
<div ng-if = "!scope.myProjectsEmpty">
|
||||||
|
<md-card layout-padding ng-click = "goToMyProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
|
||||||
|
{{project.id}}
|
||||||
|
</md-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div ng-if = "scope.myProjectsEmpty">
|
||||||
|
You Do Not Have Any Project, You May Create One.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</md-card>
|
||||||
|
</md-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- div layout-padding layout-margin>
|
||||||
|
<div layout = "row" layout-padding layout-margin>
|
||||||
|
<div flex = "49">
|
||||||
|
Project Creator: {{user.name}} Should Be Project creator
|
||||||
|
</div>
|
||||||
|
<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">
|
||||||
|
<md-button ng-click="removeProject()" class="md-raised md-primary">Remove</md-button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div layout = "row" layout-padding layout-margin>
|
||||||
|
<div flex = "49">
|
||||||
|
<md-card>
|
||||||
|
Here Will Be Graph - Commits Over Period Of Time
|
||||||
|
</md-card>
|
||||||
|
</div>
|
||||||
|
<div flex = "49">
|
||||||
|
<md-card>
|
||||||
|
Here Will Be Graph (by columns) - Commits, Issues, Open Tasks
|
||||||
|
</md-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div flex>
|
||||||
|
<md-card>
|
||||||
|
<md-content class="md-padding">
|
||||||
|
<md-tabs md-dynamic-height md-border-bottom>
|
||||||
|
<md-tab label="Commits">
|
||||||
|
<md-content class="md-padding">
|
||||||
|
<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">Issues</h1>
|
||||||
|
<p>Issues...</p>
|
||||||
|
</md-content>
|
||||||
|
</md-tab>
|
||||||
|
<md-tab label="Bugs">
|
||||||
|
<md-content class="md-padding">
|
||||||
|
<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">WhatEver</h1>
|
||||||
|
<p>Bla Bla Bla..</p>
|
||||||
|
</md-content>
|
||||||
|
</md-tab>
|
||||||
|
</md-tabs>
|
||||||
|
</md-content>
|
||||||
|
</md-card>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
Loading…
Reference in a new issue