diff --git a/rest/index.php b/rest/index.php index 707ea8d28dbc02adf5aad94037d0b64876830d63..81b5f39915cfbe18514684b3f14200980c8f59fb 100755 --- a/rest/index.php +++ b/rest/index.php @@ -363,6 +363,7 @@ $app->delete('/resources/unfollow', \Resource\controllers\UserFollowedResourceCo $app->get('/followedResources', \Resource\controllers\UserFollowedResourceController::class . ':getFollowedResources'); $app->get('/followedResources/{resId}/baskets', \Resource\controllers\UserFollowedResourceController::class . ':getBasketsFromFolder'); $app->get('/followedResources/filters', \Resource\controllers\UserFollowedResourceController::class . ':getFilters'); +$app->get('/followedResources/count', \Resource\controllers\UserFollowedResourceController::class . ':getNumberOfFollowedResources'); //ResourcesList $app->get('/resourcesList/users/{userId}/groups/{groupId}/baskets/{basketId}', \Resource\controllers\ResourceListController::class . ':get'); diff --git a/src/app/resource/controllers/UserFollowedResourceController.php b/src/app/resource/controllers/UserFollowedResourceController.php index 08fa70606dcff83df31a3c34156e6c107e0554ac..8bd1b454bdf33ea7d7ba80c64e11e61e85874d75 100644 --- a/src/app/resource/controllers/UserFollowedResourceController.php +++ b/src/app/resource/controllers/UserFollowedResourceController.php @@ -218,4 +218,11 @@ class UserFollowedResourceController return $response->withJson($filters); } + + public static function getNumberOfFollowedResources(Request $request, Response $response) + { + $followedResources = UserFollowedResourceModel::get(['select' => ['res_id'], 'where' => ['user_id = ?'], 'data' => [$GLOBALS['id']]]); + + return $response->withJson(['nbResourcesFollowed' => count($followedResources)]); + } } diff --git a/src/frontend/app/header/header-panel.component.html b/src/frontend/app/header/header-panel.component.html index 073106ce27e323e27199de59fb5cd2272c635c2c..30598b019d8161b0f541ceacc2f7983b7e76c468 100644 --- a/src/frontend/app/header/header-panel.component.html +++ b/src/frontend/app/header/header-panel.component.html @@ -16,4 +16,4 @@ </button> </div> </div> -<mat-divider></mat-divider> \ No newline at end of file +<mat-divider></mat-divider> diff --git a/src/frontend/app/header/header-panel.component.ts b/src/frontend/app/header/header-panel.component.ts index 6b9658d6a55e5717cd1de0fd3dafe40f77a7aa95..992b5e4966ea52a35dd27df338563363730d2ac1 100644 --- a/src/frontend/app/header/header-panel.component.ts +++ b/src/frontend/app/header/header-panel.component.ts @@ -19,7 +19,7 @@ export class HeaderPanelComponent implements OnInit { config : any = {}; - @Input('navButton') navButton: any = null; + @Input('navButton') navButton: any = {icon: 'fa fa-home', route : '/home'}; @Input('snavLeft') snavLeft: MatSidenav; constructor( @@ -33,4 +33,4 @@ export class HeaderPanelComponent implements OnInit { gotTo() { this.router.navigate([this.navButton.route]); } -} \ No newline at end of file +} diff --git a/src/frontend/app/home/followed-list/followed-document-list.component.ts b/src/frontend/app/home/followed-list/followed-document-list.component.ts index 3d9cc1ce5e04235d5223d90fca3a8445400671e1..519c3103ffaba7decc838ef98c423b4e73430ab8 100644 --- a/src/frontend/app/home/followed-list/followed-document-list.component.ts +++ b/src/frontend/app/home/followed-list/followed-document-list.component.ts @@ -131,15 +131,11 @@ export class FollowedDocumentListComponent implements OnInit { this.http.get('../../rest/followedResources') .subscribe((data: any) => { this.headerService.setHeader(this.lang.followedMail, '', 'fas fa-star'); - setTimeout(() => { - this.basketHome.togglePanel(false); - }, 200); - }); this.basketUrl = '../../rest/followedResources'; this.filtersListService.filterMode = false; this.selectedRes = []; - this.sidenavRight.close(); + window['MainHeaderComponent'].setSnav(this.sidenavLeft); window['MainHeaderComponent'].setSnavRight(null); diff --git a/src/frontend/app/home/home.component.html b/src/frontend/app/home/home.component.html index bab1fdcf826a1579c599636d9fd2224fc0484ba5..3f8c1e2893f710edbf1e79d50fa3fda6d5c99e85 100644 --- a/src/frontend/app/home/home.component.html +++ b/src/frontend/app/home/home.component.html @@ -133,4 +133,4 @@ </pdf-viewer> <!-- <div *ngIf="innerHtml" [innerHTML]="innerHtml" style="height: 100%;overflow: hidden;"></div> --> </mat-sidenav> -</mat-sidenav-container> \ No newline at end of file +</mat-sidenav-container> diff --git a/src/frontend/app/menu/menu-shortcut.component.html b/src/frontend/app/menu/menu-shortcut.component.html index cd28add801474c19c673c399d8d889f1fb55817b..fbea56d2b817db4868da25da726920a5f7ff4214 100755 --- a/src/frontend/app/menu/menu-shortcut.component.html +++ b/src/frontend/app/menu/menu-shortcut.component.html @@ -1,13 +1,14 @@ <mat-nav-list style="position:relative;"> </mat-nav-list> <mat-nav-list> - <h3 mat-subheader>{{lang.shortcut}}</h3> <div class="button-row" style="padding-left: 10px;padding-right: 10px;display: flex;width: 300px;margin-top: -10px;margin-bottom: 10px;"> <ng-container *ngFor="let shortcut of shortcuts"> <span style="flex:1;text-align: left;padding: 5px;" *ngIf="(shortcut.id == 'indexing' && shortcut.groups.length<=1) || (shortcut.id != 'indexing')"> <button style="z-index: 9999;" color="default" mat-fab (click)="gotToMenu(shortcut);" matTooltip="{{shortcut.label}}" matTooltipPosition="above"> - <mat-icon class="fa {{shortcut.style}}" style="height:auto;font-size:22px;"></mat-icon> + <mat-icon class="fa {{shortcut.style}}" style="height:auto;font-size:22px;" + matBadge="{{this.nbResourcesFollowed}}" matBadgeHidden="{{shortcut.id != 'followed'}}" + ></mat-icon> </button> </span> <span style="flex:1;text-align: left;padding: 5px;position: relative;" *ngIf="shortcut.id=='indexing' && shortcut.groups.length>1"> @@ -30,4 +31,4 @@ </ng-container> </div> </mat-nav-list> -<mat-divider></mat-divider> \ No newline at end of file +<mat-divider></mat-divider> diff --git a/src/frontend/app/menu/menu-shortcut.component.ts b/src/frontend/app/menu/menu-shortcut.component.ts index 17ed0d6a4c004e986a14772ea68a838d6f2bb342..36c5a301f455935b504ee35446ae24deb0e262a9 100755 --- a/src/frontend/app/menu/menu-shortcut.component.ts +++ b/src/frontend/app/menu/menu-shortcut.component.ts @@ -22,7 +22,7 @@ export class MenuShortcutComponent implements OnInit { speedDialFabButtons: any = []; speedDialFabColumnDirection = 'column'; shortcuts: any; - + nbResourcesFollowed: any; constructor( public http: HttpClient, @@ -41,6 +41,11 @@ export class MenuShortcutComponent implements OnInit { loadShortcuts() { this.shortcuts = this.privilegeService.getCurrentUserShortcuts(); + + this.http.get("../../rest/followedResources/count") + .subscribe((data: any) => { + this.nbResourcesFollowed = data.nbResourcesFollowed; + }); } onSpeedDialFabClicked(group: any, shortcut: any) { @@ -76,4 +81,4 @@ export class IndexingGroupModalComponent { this.router.navigate(['/indexing/' + group.id]); this.dialogRef.close(); } -} \ No newline at end of file +} diff --git a/src/frontend/service/privileges.service.ts b/src/frontend/service/privileges.service.ts index 941a177b3cd2d4163a83f90a6019e9657196840f..68b7ca039f59da2f6337fa36c3de2155dd5af3ae 100644 --- a/src/frontend/service/privileges.service.ts +++ b/src/frontend/service/privileges.service.ts @@ -588,11 +588,11 @@ export class PrivilegeService { getCurrentUserShortcuts(): Array<menu> { let shortcuts: any[] = [ { - "id": "home", - "label": this.lang.home, - "comment": this.lang.home, - "route": "/home", - "style": "fa fa-home", + "id": "followed", + "label": this.lang.followedMail, + "comment": this.lang.followedMail, + "route": "/followed", + "style": "fas fa-star", "unit": "application", "angular": true, "shortcut" : true