aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/menu
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-18 09:31:09 +0100
committerChocobozzz <me@florianbigard.com>2018-12-18 11:35:51 +0100
commit80bfd33c0bf910e2cfdd3270b14ba9eddd90e2e8 (patch)
tree80cd14e2f503db64ebec5fcfbb94ce5db25f46c9 /client/src/app/shared/menu
parent8b9a525a180cc9f3a98c334cc052dcfc8f36dcd4 (diff)
downloadPeerTube-80bfd33c0bf910e2cfdd3270b14ba9eddd90e2e8.tar.gz
PeerTube-80bfd33c0bf910e2cfdd3270b14ba9eddd90e2e8.tar.zst
PeerTube-80bfd33c0bf910e2cfdd3270b14ba9eddd90e2e8.zip
Add history page on client
Diffstat (limited to 'client/src/app/shared/menu')
-rw-r--r--client/src/app/shared/menu/top-menu-dropdown.component.html5
-rw-r--r--client/src/app/shared/menu/top-menu-dropdown.component.scss4
-rw-r--r--client/src/app/shared/menu/top-menu-dropdown.component.ts14
3 files changed, 19 insertions, 4 deletions
diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.html b/client/src/app/shared/menu/top-menu-dropdown.component.html
index 2d6d1c4bf..d3c896019 100644
--- a/client/src/app/shared/menu/top-menu-dropdown.component.html
+++ b/client/src/app/shared/menu/top-menu-dropdown.component.html
@@ -4,7 +4,10 @@
4 <a *ngIf="menuEntry.routerLink" [routerLink]="menuEntry.routerLink" routerLinkActive="active" class="title-page">{{ menuEntry.label }}</a> 4 <a *ngIf="menuEntry.routerLink" [routerLink]="menuEntry.routerLink" routerLinkActive="active" class="title-page">{{ menuEntry.label }}</a>
5 5
6 <div *ngIf="!menuEntry.routerLink" ngbDropdown class="parent-entry" #dropdown="ngbDropdown" (mouseleave)="closeDropdownIfHovered(dropdown)"> 6 <div *ngIf="!menuEntry.routerLink" ngbDropdown class="parent-entry" #dropdown="ngbDropdown" (mouseleave)="closeDropdownIfHovered(dropdown)">
7 <span (mouseenter)="openDropdownOnHover(dropdown)" role="button" class="title-page" [ngClass]="{ active: !!suffixLabels[menuEntry.label] }" ngbDropdownToggle> 7 <span
8 (mouseenter)="openDropdownOnHover(dropdown)" [ngClass]="{ active: !!suffixLabels[menuEntry.label] }" ngbDropdownAnchor
9 (click)="dropdownAnchorClicked(dropdown)" role="button" class="title-page"
10 >
8 <ng-container i18n>{{ menuEntry.label }}</ng-container> 11 <ng-container i18n>{{ menuEntry.label }}</ng-container>
9 <ng-container *ngIf="!!suffixLabels[menuEntry.label]"> - {{ suffixLabels[menuEntry.label] }}</ng-container> 12 <ng-container *ngIf="!!suffixLabels[menuEntry.label]"> - {{ suffixLabels[menuEntry.label] }}</ng-container>
10 </span> 13 </span>
diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.scss b/client/src/app/shared/menu/top-menu-dropdown.component.scss
index f3ef8f814..77159532f 100644
--- a/client/src/app/shared/menu/top-menu-dropdown.component.scss
+++ b/client/src/app/shared/menu/top-menu-dropdown.component.scss
@@ -12,3 +12,7 @@
12 position: relative; 12 position: relative;
13 top: 2px; 13 top: 2px;
14} 14}
15
16/deep/ .dropdown-menu {
17 margin-top: 0 !important;
18}
diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.ts b/client/src/app/shared/menu/top-menu-dropdown.component.ts
index 272b721b2..e859c30dd 100644
--- a/client/src/app/shared/menu/top-menu-dropdown.component.ts
+++ b/client/src/app/shared/menu/top-menu-dropdown.component.ts
@@ -1,9 +1,8 @@
1import { Component, Input, OnDestroy, OnInit } from '@angular/core' 1import { Component, Input, OnDestroy, OnInit } from '@angular/core'
2import { filter, take } from 'rxjs/operators' 2import { filter, take } from 'rxjs/operators'
3import { NavigationStart, Router } from '@angular/router' 3import { NavigationEnd, Router } from '@angular/router'
4import { Subscription } from 'rxjs' 4import { Subscription } from 'rxjs'
5import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 5import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
6import { drop } from 'lodash-es'
7 6
8export type TopMenuDropdownParam = { 7export type TopMenuDropdownParam = {
9 label: string 8 label: string
@@ -34,7 +33,7 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy {
34 this.updateChildLabels(window.location.pathname) 33 this.updateChildLabels(window.location.pathname)
35 34
36 this.routeSub = this.router.events 35 this.routeSub = this.router.events
37 .pipe(filter(event => event instanceof NavigationStart)) 36 .pipe(filter(event => event instanceof NavigationEnd))
38 .subscribe(() => this.updateChildLabels(window.location.pathname)) 37 .subscribe(() => this.updateChildLabels(window.location.pathname))
39 } 38 }
40 39
@@ -52,6 +51,15 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy {
52 .subscribe(e => this.openedOnHover = false) 51 .subscribe(e => this.openedOnHover = false)
53 } 52 }
54 53
54 dropdownAnchorClicked (dropdown: NgbDropdown) {
55 if (this.openedOnHover) {
56 this.openedOnHover = false
57 return
58 }
59
60 return dropdown.toggle()
61 }
62
55 closeDropdownIfHovered (dropdown: NgbDropdown) { 63 closeDropdownIfHovered (dropdown: NgbDropdown) {
56 if (this.openedOnHover === false) return 64 if (this.openedOnHover === false) return
57 65