Skip to content

Commit

Permalink
Merge pull request #55 from cocoonprojects/user-deactivation
Browse files Browse the repository at this point in the history
User deactivation
  • Loading branch information
lorenzo-pomili authored Mar 20, 2018
2 parents 921cc78 + 5fa8d69 commit 4c29872
Show file tree
Hide file tree
Showing 21 changed files with 562 additions and 294 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.19.0",
"version": "0.20.0",
"private": true,
"name": "ora-angularjs",
"description": "Non-hierarchical clustering platform AngularJS front end",
Expand Down
75 changes: 75 additions & 0 deletions public/app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -1158,3 +1158,78 @@ button.md-button.md-raised.md-alert {
background: #FF5252;
color: white;
}

.more-btn {
margin-left: auto;
}

.switch-deactivation__btn {
margin: 0;
width: 100%;
}

.people-list--user-inactive .md-avatar {
opacity: 0.5;
border: 5px dashed black;
margin-left: -5px;
margin-right: 11px !important;
}
.people-list--user-inactive .people-list__text {
color: #888888;
/*opacity: 0.5;*/
}
.people-list--user-inactive .people-list__text__inactive {
color: #D64C3F;
font-size: 14px;
}

.people-list__remove-icon {
margin-right: 0 !important;
}
.people-list__remove-text {
color: rgba(0,0,0,0.87);
}

img.profile--user-inactive {
opacity: 0.5;
border: 5px dashed black;
}
.profile--user-inactive__text {
opacity: 0.5;
}
.profile__text__inactive {
color: #D64C3F;
font-size: 14px;
}

.kanban--user-inactive {
opacity: 0.5;
border: 5px dashed black;
margin-left: 5px !important;
margin-right: 5px !important;
}

.deactivated-landing {
padding: 108px 0 0 40px;
}

.deactivated-landing a {
color: rgb(0,131,143);
}

.item-list--user-inactive {
opacity: 0.5;
border: 5px dashed black;
}

.no-desk {
display: none;
}
@media screen and (max-width:500px) {
.deactivated-landing {
padding: 40px 20px 0 20px;
}
.no-desk {
display: block;
}
}
51 changes: 41 additions & 10 deletions public/app/collaboration/controllers/ItemDetailController.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module('app.collaboration')
'voteExtractor',
'kanbanizeService',
'lanesService',
'membersDataService',
'creditFormatterFilterFilter',
'getRemovedAfterCloseFromHistory',
function (
Expand All @@ -27,6 +28,7 @@ angular.module('app.collaboration')
voteExtractor,
kanbanizeService,
lanesService,
membersDataService,
creditFormatterFilterFilter,
getRemovedAfterCloseFromHistory) {

Expand Down Expand Up @@ -85,7 +87,7 @@ angular.module('app.collaboration')
};

var loadStream = function(cb) {
streamService.query($stateParams.orgId, function (data) {
streamService.query($stateParams.orgId, function (data) {
$scope.streams = data;
cb();
}, onHttpGenericError);
Expand All @@ -103,8 +105,18 @@ angular.module('app.collaboration')
itemService.get($stateParams.orgId, $stateParams.itemId, function (data) {
$scope.author = itemService.getAuthor(data);
$scope.owner = itemService.getOwner(data);
$scope.yourEstimation = itemService.yourEstimation(data);
$scope.item = data;

if($scope.item.status > $scope.ITEM_STATUS.OPEN && $scope.owner){
$scope.active = membersDataService.isActive($scope.owner.id);
}else if($scope.author){
$scope.active = membersDataService.isActive($scope.author.id);
}else{
$scope.active = false;
}

$scope.yourEstimation = itemService.yourEstimation(data);

$scope.attachments = data.attachments || [];
$scope.members = _.values(data.members);
var laneObj = lanesService.findLane($scope.item.lane, $scope.lanes);
Expand All @@ -118,7 +130,7 @@ angular.module('app.collaboration')
$scope.item.withoutLane = true;
}
cb();

}, this.onLoadingError);
};

Expand All @@ -145,7 +157,7 @@ angular.module('app.collaboration')
return "n/a";
}
};

this.iVoted = function (elm) {
var messageFromVoteExtractor = voteExtractor($scope.myId, elm);

Expand Down Expand Up @@ -224,8 +236,8 @@ angular.module('app.collaboration')

this.hasMore = function (item) {
return this.isAllowed('backToIdea', item) ||
this.isAllowed('deleteItem', item) ||
this.isAllowed('backToOpen', item) ||
this.isAllowed('deleteItem', item) ||
this.isAllowed('backToOpen', item) ||
this.isAllowed('backToOngoing', item) ||
this.isAllowed('backToCompleted', item) ||
this.isAllowed('backToAccepted', item);
Expand Down Expand Up @@ -295,7 +307,7 @@ angular.module('app.collaboration')

originatorEv = null;
};

this.backToOpen = function (ev, item) {
var that = this;
var confirm = $mdDialog.confirm()
Expand All @@ -316,7 +328,7 @@ angular.module('app.collaboration')

originatorEv = null;
};

this.backToOngoing = function (ev, item) {
var that = this;
var confirm = $mdDialog.confirm()
Expand Down Expand Up @@ -450,7 +462,7 @@ angular.module('app.collaboration')
}

};

this.completeItem = function (ev, item) {
var that = this;
var confirm = $mdDialog.confirm()
Expand Down Expand Up @@ -609,8 +621,27 @@ angular.module('app.collaboration')
});
};

$scope.partecipantIsActive = function(partecipant) {
return membersDataService.isActive(partecipant.id);
};

$scope.ownerAuthorAlt = function() {
if ($scope.active) {
return "";
} else {
return "currently inactive";
}
};

$scope.partecipantAlt = function(partecipant) {
if (membersDataService.isActive(partecipant.id)) {
return partecipant.firstname + " " + partecipant.lastname;
} else {
return "currently inactive";
}
};

load();


}]);
11 changes: 11 additions & 0 deletions public/app/collaboration/controllers/ItemListController.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module('app.collaboration')
'voteExtractor',
'selectedFilterService',
'lanesService',
'membersDataService',
'kanbanizeService',
'settingsService',
function (
Expand All @@ -27,6 +28,7 @@ angular.module('app.collaboration')
voteExtractor,
selectedFilterService,
lanesService,
membersDataService,
kanbanizeService,
settingsService) {

Expand Down Expand Up @@ -212,6 +214,15 @@ angular.module('app.collaboration')
}
};

$scope.itemIsActive = function(item){
var ownerAuthor = $scope.getOwnerAuthor(item);
if(ownerAuthor){
return membersDataService.isActive(ownerAuthor.id);
}else{
return false;
}
};

$scope.checkImIn = function(item){
return itemService.isIn(item,$scope.identity.getId());
};
Expand Down
9 changes: 8 additions & 1 deletion public/app/collaboration/directives/ItemKanbanCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

angular.module('app').directive('itemKanbanCard', [
'itemService',
function (itemService) {
'membersDataService',
function (itemService, membersDataService) {
return {
restrict: 'E',
scope: {
Expand All @@ -27,6 +28,7 @@
if($scope.item.author){
$scope.picture = $scope.item.author.picture || 'img/account.jpg';
$scope.ownerAuthorName = $scope.item.author.firstname + " " + $scope.item.author.lastname;
$scope.active = membersDataService.isActive($scope.item.author.id);
}
$scope.imInvolved = false;
} else if ($scope.item.status === itemService.ITEM_STATUS.OPEN) {
Expand All @@ -42,10 +44,15 @@
if(owner){
$scope.picture = owner.picture || 'img/account.jpg';
$scope.ownerAuthorName = owner.firstname + " " + owner.lastname;
$scope.active = membersDataService.isActive(owner.id);
}
$scope.imInvolved = itemService.isIn($scope.item, $scope.myId);
}

if ($scope.ownerAuthorName && !$scope.active) {
$scope.ownerAuthorName = $scope.ownerAuthorName + " (currently inactive)";
}

switch (true) {
case ($scope.imInvolved && $scope.isDecision):
$scope.tooltip = "It's a decision and I'm involved";
Expand Down
12 changes: 5 additions & 7 deletions public/app/collaboration/partials/item-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@
<p ng-if="item.withoutLane" style="text-transform: uppercase; font-size: 18px; background-color: rgb(255,82,82);color:#FFFFFF; padding:3px;">ITEM WITHOUT LANE</p>

<div layout="row" class="margin-bottom-20" ng-if="item.status <= ITEM_STATUS.OPEN">
<img ng-click="goToProfile(author.id)" class="margin-right-20" style="max-width: 60px; max-height: 60px; border-radius: 50%; cursor: pointer;"
<img alt="{{ownerAuthorAlt()}}" title="{{ownerAuthorAlt()}}" ng-click="goToProfile(author.id)" ng-class="{'item-list--user-inactive': !active}" class="margin-right-20" style="max-width: 60px; max-height: 60px; border-radius: 50%; cursor: pointer;"
ng-src="{{ author.picture || 'img/account.jpg' }}">
<div>
<p class="no-margin no-padding" style="font-size: 14px;">author:</p>
<p class="no-margin no-padding warn" data-ng-click="goToProfile(author.id)" style="font-size: 14px; cursor: pointer;">
{{ author.firstname }} {{ author.lastname }}
{{ author.firstname }} {{ author.lastname }}
</p>

</div>
Expand All @@ -86,7 +86,7 @@
<span class="item-detail__no_owner--text">Missing Owner</span>
<button href="#" ng-if="ctrl.isAllowed('changeOwner', item)" class="md-raised md-alert md-button ng-scope md-ink-ripple" ng-click="ctrl.changeOwner($event, item);">ASSIGN NEW OWNER</button>
</div>
<img data-ng-if="owner" class="margin-right-20" style="max-width: 60px; max-height: 60px; border-radius: 50%;" ng-src="{{ owner.picture || 'img/account.jpg' }}">
<img data-ng-if="owner" alt="{{ownerAuthorAlt()}}" title="{{ownerAuthorAlt()}}" ng-class="{'item-list--user-inactive': !active}" class="margin-right-20" style="max-width: 60px; max-height: 60px; border-radius: 50%;" ng-src="{{ owner.picture || 'img/account.jpg' }}">
<img data-ng-if="!owner && (item.status === ITEM_STATUS.CLOSED)" class="margin-right-20" style="max-width: 60px; max-height: 60px; border-radius: 50%;" ng-src="{{ 'img/account.jpg' }}">
<div>
<p data-ng-if="owner || (item.status === ITEM_STATUS.CLOSED)" class="no-margin no-padding" style="font-size: 14px;">owner:</p>
Expand Down Expand Up @@ -169,8 +169,7 @@
<md-list class="md-dense" ng-if="item.status != 50">
<md-list-item ng-repeat="member in members" ng-init="m = member" ng-click="goToProfile(member.id)" class="md-2-line md-no-proxy"
style="padding:0;">
<img alt="{{ member.firstname }} {{ member.lastname }}" ng-src="{{ member.picture || 'img/account.jpg' }}" class="md-avatar"
/>
<img alt="{{partecipantAlt(member)}}" title="{{partecipantAlt(member)}}" ng-src="{{ member.picture || 'img/account.jpg' }}" class="md-avatar" ng-class="{'item-list--user-inactive': !partecipantIsActive(member)}" />
<div class="md-list-item-text" layout="column">
<h3 class="warn partecipantsListText">{{ member.firstname }} {{ member.lastname }}</h3>
<p style="color:gray;">
Expand All @@ -196,8 +195,7 @@ <h3 class="warn partecipantsListText">{{ member.firstname }} {{ member.lastname
<md-list class="md-dense" ng-if="ctrl.isAllowed('showShares', item)">
<md-list-item ng-repeat="member in members" ng-init="m = member" ng-click="goToProfile(member.id)" class="md-2-line md-no-proxy"
style="padding:0;">
<img alt="{{ member.firstname }} {{ member.lastname }}" ng-src="{{ member.picture || 'img/account.jpg' }}" class="md-avatar"
/>
<img alt="{{partecipantAlt(member)}}" title="{{partecipantAlt(member)}}" ng-src="{{ member.picture || 'img/account.jpg' }}" class="md-avatar" ng-class="{'item-list--user-inactive': !partecipantIsActive(member)}" />
<div class="md-list-item-text" layout="column">
<h3 class="warn" style="line-height: 1.2em;">{{ member.firstname }} {{ member.lastname }}</h3>
<p style="line-height: 1.2em;"><strong>Credits: {{member.credits | creditFormatterFilter}}</strong><br /><i>(Share: {{member.share*100 | creditFormatterFilter}}% Gap: {{printGap(member.delta)}})</i></p>
Expand Down
2 changes: 1 addition & 1 deletion public/app/collaboration/partials/item-kanban-card.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="kanban__item" data-ng-class="[{no_owner: (!picture && !position) && (item.status !== ITEM_STATUS.CLOSED)}, myClass]">
<img ng-if="picture" class="kanban__item__owner" ng-src="{{picture}}" alt="{{ownerAuthorName}}" title="{{ownerAuthorName}}" style="max-width: 30px;">
<img ng-if="picture" class="kanban__item__owner" ng-src="{{picture}}" alt="{{ownerAuthorName}}" title="{{ownerAuthorName}}" style="max-width: 30px;" data-ng-class="{'kanban--user-inactive': !active}">
<div ng-if="position" class="kanban__item__position">{{position}}</div>
<div ng-if="(!picture && !position) && (item.status !== ITEM_STATUS.CLOSED)" class="kanban__item__position">?</div>
<img ng-if="(!picture && !position) && (item.status === ITEM_STATUS.CLOSED)" class="kanban__item__owner" style="max-width: 30px;" data-ng-src="img/account.jpg" />
Expand Down
2 changes: 1 addition & 1 deletion public/app/collaboration/partials/item-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h2 flex></h2>
<md-card-media class="mobile-item__media" layout="column" layout-align="start end">
<div ng-show="getOwnerAuthor(item) && item.status != ITEM_STATUS.OPEN">
<div>
<img class="mobile-item__media__image" ng-src="{{ getOwnerAuthor(item).picture || 'img/account.jpg' }}" alt="{{ getOwnerAuthor(item).firstname }} {{ getOwnerAuthor(item).lastname}}" title="{{ getOwnerAuthor(item).firstname }} {{ getOwnerAuthor(item).lastname}}">
<img ng-class="{'item-list--user-inactive': !itemIsActive(item)}" class="mobile-item__media__image" ng-src="{{ getOwnerAuthor(item).picture || 'img/account.jpg' }}" alt="{{ getOwnerAuthor(item).firstname }} {{ getOwnerAuthor(item).lastname}}" title="{{ getOwnerAuthor(item).firstname }} {{ getOwnerAuthor(item).lastname}}">
</div>
</div>
<div ng-show="getOwnerAuthor(item) && item.status == ITEM_STATUS.OPEN && showPriority(item)">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// DeactivatedUserLandingController.js
angular.module('app')
.controller('DeactivatedUserLandingController', ["$scope", "SelectedOrganizationId", "identity", "streamService", function($scope, SelectedOrganizationId, identity, streamService) {
$scope.organization = identity.getMembership(SelectedOrganizationId.get());
$scope.userDesc = identity.getFirstname()+" "+identity.getLastname();
streamService.query(SelectedOrganizationId.get(),function(data){
$scope.stream = _.values(data._embedded['ora:stream'])[0];
});

}]);
4 changes: 4 additions & 0 deletions public/app/identity/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ angular.module('app.identity', ['ui.router'])
url: '/sign-in',
templateUrl: 'app/identity/partials/sign-in.html',
controller: 'SignInController'
}).state('deactivated-user-landing', {
url: ':orgId/deactivated-user-landing',
templateUrl: 'app/identity/partials/deactivated-user-landing.html',
controller: 'DeactivatedUserLandingController as ctrl'
});
}
])
Expand Down
Loading

0 comments on commit 4c29872

Please sign in to comment.