Commit 8008c8ba authored by Anthony Geourjon's avatar Anthony Geourjon

Merge branch '57-masquage-projets-portefeuilles-dans-le-dashboard' into 'master'

Resolve "Masquage projets/portefeuilles dans le dashboard"

Closes #57

See merge request !81
parents 74d8b953 aaaf7c1a
Pipeline #39958 passed with stage
in 51 seconds
......@@ -2659,6 +2659,10 @@ li.list-projects a {
}
/** dashboard CSS **/
.myProjectsHeader {
display: flex;
}
.project-item {
min-height: 48px;
padding: 10px;
......@@ -2672,6 +2676,10 @@ li.list-projects a {
border: 1px solid transparent;
}
.noProjectsMsg {
margin: 30px;
}
.discussion-item:hover {
color: #f28131;
}
......@@ -2698,6 +2706,12 @@ li.list-projects a {
background: white;
}
.smallIconProjectItem {
position: absolute;
top: 5px;
font-size: 12px;
}
.discussion-item {
cursor: pointer;
}
......@@ -2849,12 +2863,14 @@ span[data-cal-date] {
.left-column .group-overview {
margin-right: 10px;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
scrollbar-color: black white;
scrollbar-width: thin;
}
.search-bar-project {
margin: auto 5px auto 0;
width: 100%;
}
......
......@@ -2,31 +2,21 @@
root.controller("DashboardCtrl", [
"$scope",
"$http",
"$stateParams",
"$location",
"$rightFactory",
"$languageFactory",
"$skillsFactory",
"$eventsFactory",
"$navigationFactory",
"$activitiesFactory",
"$state",
"$projectFactory",
"$userFactory",
"$tasksFactory",
function(
$scope,
$http,
$stateParams,
$location,
$rightFactory,
$languageFactory,
$skillsFactory,
$eventsFactory,
$navigationFactory,
$activitiesFactory,
$state,
$projectFactory,
$userFactory,
$tasksFactory
......@@ -43,8 +33,10 @@ root.controller("DashboardCtrl", [
$scope.searchInput = { searchActivity: "" };
var lang = "";
$scope.prices = [];
$scope.showHiddenProjects = true;
var session = $scope._getSession();
if ($stateParams.action == "switchManager") {
if (session.group == "20") $scope._setSessionGroup("10");
if (session.group == "21") $scope._setSessionGroup("11");
......@@ -55,7 +47,6 @@ root.controller("DashboardCtrl", [
if ($stateParams.action == "switchAdmin") {
if (session.group == "10") $scope._setSessionGroup("20");
if (session.group == "11") $scope._setSessionGroup("21");
if (session.group == "10" || session.group == "11")
document.location.reload();
$scope.hideContent = true;
......@@ -103,7 +94,6 @@ root.controller("DashboardCtrl", [
if (data.status == "success") {
$scope.myTasks = data.details;
}
$scope.loadingTasks = false;
});
};
......@@ -141,10 +131,7 @@ root.controller("DashboardCtrl", [
if (index > -1) {
array.dates[index].events.push(item);
} else {
array.dates.push({
date: plainDate,
events: []
});
array.dates.push({ date: plainDate, events: [] });
var index = $scope._arrayObjectIndexOf(
array.dates,
plainDate,
......@@ -157,7 +144,6 @@ root.controller("DashboardCtrl", [
$scope.myFormattedEvents = array;
console.log($scope.myFormattedEvents);
}
$scope.loadingEvents = false;
});
};
......@@ -175,6 +161,7 @@ root.controller("DashboardCtrl", [
$scope.loadingActivities = true;
$scope.activities = false;
var session = $scope._getSession();
if (!begin) begin = 0;
if (!count) count = 5;
......@@ -197,6 +184,52 @@ root.controller("DashboardCtrl", [
);
};
$scope.getListProjects = function() {
$scope.showHiddenProjects = !$scope.showHiddenProjects;
$scope.membershipList = [];
$scope.listShowProjects = [];
if (!$scope._listProjects) {
// If the list variable is not ready, we try again after 0.5s
setTimeout(() => {
$scope.showHiddenProjects = !$scope.showHiddenProjects;
this.getListProjects();
}, 500);
} else {
if ($scope.showHiddenProjects) {
$scope.listShowProjects = $scope._listProjects;
} else {
$scope.listShowProjects = $scope._listProjects.filter(
project => project.membership == 1
);
}
$scope.listShowProjects.forEach(project => {
$scope.membershipList[project.id] = project.membership == 1;
});
}
};
$scope.putMembership = function(projectId) {
$projectFactory.putMembership(projectId, function(data) {
if (data.status == "success") {
$scope._listProjects = $scope._listProjects.map(project => {
if (project.id == projectId) {
project.membership == 1
? (project.membership = 2)
: (project.membership = 1);
}
return project;
});
if (!$scope.showHiddenProjects)
$scope.listShowProjects = $scope._listProjects.filter(
project => project.membership == 1
);
$scope.membershipList[projectId] = !$scope.membershipList[projectId];
}
});
};
$scope.searchActivities = function() {
$scope.loadingActivities = true;
$scope.activities = [];
......@@ -223,7 +256,6 @@ root.controller("DashboardCtrl", [
function(data) {
if (data.status == "success") {
events = data.details;
//_alertObject($scope._listProjects)
var indexId = $scope._arrayObjectIndexOf(
$scope._listProjects,
projectId,
......@@ -238,11 +270,9 @@ root.controller("DashboardCtrl", [
case "deliverables":
$scope._listProjects[indexId].deliverables = true;
break;
case "assess":
$scope._listProjects[indexId].assessments = true;
break;
case "skills":
$scope._listProjects[indexId].skills = true;
break;
......@@ -359,11 +389,9 @@ root.controller("DashboardCtrl", [
case "files":
icon = "fa fa-folder";
break;
case "deliverables":
icon = "fa fa-folder";
break;
case "assess":
icon = "fa fa-line-chart";
break;
......
......@@ -2,6 +2,7 @@
<div class="middle-column">
<div class="clearfix group-overview" style="height: 100%;">
<div class="col-md-8" style="min-height: 80vh; padding-left:0">
<div style="margin-top:40px; margin-bottom: 10px" class="todo-activity box-generic">
<div class="timeline-top-info">
......@@ -9,19 +10,19 @@
</div>
<div class="info inlineChildren row" style="text-align:center; margin:auto;">
<div class="pointerOn col-md-4" style="margin:10px 0;" ui-sref="project.add">
<div class=" pointerOn col-md-4" style="margin:10px 0;" ui-sref="project.add">
<span class="fa fa-3x fa-cube" style="width: auto;"></span>
<span class="fa fa-2x fa-plus" style="width: auto;"></span>
<p style="margin-top:10px;">{{::_labels.addProject}}</p>
</div>
<div class="pointerOn col-md-4" style="margin:10px 0;" ui-sref="portfolio">
<div class=" pointerOn col-md-4" style="margin:10px 0;" ui-sref="portfolio">
<span class="fa fa-3x fa-cubes" style="width: auto;"></span>
<span class="fa fa-2x fa-plus" style="width: auto;"></span>
<p style="margin-top:10px;">{{::_labels.addPortfolio}}</p>
</div>
<div class=" pointerOn col-md-4" style="margin:10px 0;" ui-sref="users({userId:'me'})">
<div class="pointerOn col-md-4" style="margin:10px 0;" ui-sref="users({userId:'me'})">
<span class="fa fa-3x fa-user" style="width: auto;"></span>
<p style="margin-top:10px;">{{::_labels.profile}}</p>
</div>
......@@ -31,7 +32,6 @@
</div>
<div class="separator"></div>
<div id="dashboardCalendar">
<div ng-include src=" 'components/dashboard/calendar.html'"></div>
</div>
......
<div class="clearfix group-overview">
<div class="clearfix group-overview" ng-init="getListProjects();">
<div class="fixed-title">
<h4 style="text-align:center">
<h4>
<i style="cursor: default" class="fa fa-cube active"></i>
<span ng-if="_userGroups[_getFullGroup()]=='STUDENT'">{{::_labels.myprojects}}</span>
<span ng-if="_userGroups[_getFullGroup()]!='STUDENT'">{{::_labels.myProjectPortfolio}}</span>
</h4>
<div class="sepator"></div>
<input class="search-bar-project" type="text" ng-model="searchText" placeholder="Rechercher un projet" />
<div class="myProjectsHeader">
<input class="search-bar-project" type="text" ng-model="searchText" placeholder="Rechercher un projet" />
<button ng-if="!showHiddenProjects" class="small" style="width: 30%; height: auto;" ng-click="getListProjects()">
{{::_labels.seeProjects}}
</button>
<button ng-if="showHiddenProjects" class="small" style="width: 30%; height: auto;" ng-click="getListProjects()">
{{::_labels.seeActProjects}}
</button>
</div>
</div>
<div id="projects-wrapper" ng-if="_listProjects">
<div class="project-item col-md-12" ng-repeat="project in (_listProjects) | filter:searchText | orderBy:'label'"
<div id="projects-wrapper" ng-if="listShowProjects">
<div class="project-item col-md-12" ng-repeat="project in (listShowProjects) | filter:searchText | orderBy:'label'"
ng-init="loadNotifExists(project.id);">
<div class="project-item-header">
<div class="smallIconProjectItem custom-tooltip smalltooltip" style="left:10px;color:#666;">
<i ng-class="{'fa fa-star':membershipList[project.id]}"
ng-click="putMembership(project.id); $event.stopPropagation();"></i>
<i ng-class="{'fa fa-star-o':!membershipList[project.id]}"
ng-click="putMembership(project.id); $event.stopPropagation();"></i>
<span ng-if="!membershipList[project.id]" class="tooltiptext"
style="line-height:12px;width:50px;margin-left:-25px;">
{{::_labels.showproject}}
</span>
<span ng-if="membershipList[project.id]" class="tooltiptext"
style="line-height:12px;width:50px;margin-left:-25px;">
{{::_labels.hideproject}}
</span>
</div>
<label
style="max-width: 90%;padding:5px;margin: auto; display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap ;font-size: 12px;">
<span ui-sref="project.overview({projectName:project.label})" class="pointerOn">{{::project.fullName}}</span>
</label>
<div ng-if="::project.fullChildren.length" style="position:absolute;top:5px;right:10px;font-size: 12px;"
class="pull-right" ng-click="project.showChildren = !project.showChildren">
<div ng-if="::project.fullChildren.length" style="right:10px;" class="pull-right smallIconProjectItem"
ng-click="project.showChildren = !project.showChildren">
<i class="fa fa-caret-down" aria-hidden="true"></i>
</div>
......@@ -61,7 +86,7 @@
</div>
<div class="project-icon-section col-md-2 col-xs-3 pointerOn">
<div class="project-icon custom-tooltip smalltooltip event-calendar">
<div class="project-icon custom-tooltip smalltooltip event-calendar">
<span class="activity-notification-menu" ng-if="::project.events"></span>
<span ui-sref="project.events({projectName:project.label})" class="fa fa-calendar"></span>
<span class="tooltiptext" style="line-height:12px;">{{::_labels.events}}</span>
......@@ -71,4 +96,7 @@
</div>
</div>
</div>
<div class="noProjectsMsg" ng-if="listShowProjects.length==0 && !showHiddenProjects">
{{::_labels.noProjectsMsg}} <strong>{{::_labels.seeProjects}}</strong>
</div>
</div>
......@@ -68,7 +68,6 @@ function $projectFactory($rootScope, $serverFactory) {
if (data.status == "success") {
projectMembers[projectId] = data.details;
broadcastMembers(projectId);
//return projectMembers;
}
});
return req;
......@@ -496,6 +495,14 @@ function $projectFactory($rootScope, $serverFactory) {
);
};
returns.putMembership = function(projectId, params) {
return $serverFactory.runCommand(
"put_membership",
{ projectId: projectId },
params
);
};
/**
* [getProjects description]
* @param {[boolean]} includeParents [true: includes portfolio parents in results]
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment