diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-03 13:13:46 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-03 14:55:47 +0100 |
commit | 19b7ebfaa822b12f6da25ad2ba10398b3ef25ec6 (patch) | |
tree | ab602e242c52e0936eb8f958acfc343bd14f540e /client/src/app/core/routing/menu-guard.service.ts | |
parent | 5bfc33b6f1caa50c607bd7334b4a72003c2bd1a6 (diff) | |
download | PeerTube-19b7ebfaa822b12f6da25ad2ba10398b3ef25ec6.tar.gz PeerTube-19b7ebfaa822b12f6da25ad2ba10398b3ef25ec6.tar.zst PeerTube-19b7ebfaa822b12f6da25ad2ba10398b3ef25ec6.zip |
refactor 404 page
Diffstat (limited to 'client/src/app/core/routing/menu-guard.service.ts')
-rw-r--r-- | client/src/app/core/routing/menu-guard.service.ts | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/client/src/app/core/routing/menu-guard.service.ts b/client/src/app/core/routing/menu-guard.service.ts index 501e009c0..c4e64d434 100644 --- a/client/src/app/core/routing/menu-guard.service.ts +++ b/client/src/app/core/routing/menu-guard.service.ts | |||
@@ -27,22 +27,48 @@ export class OpenMenuGuard extends MenuGuard { | |||
27 | } | 27 | } |
28 | 28 | ||
29 | @Injectable() | 29 | @Injectable() |
30 | export class OpenMenuAlwaysGuard extends MenuGuard { | ||
31 | constructor (menu: MenuService, screen: ScreenService) { super(menu, screen, true) } | ||
32 | |||
33 | canActivate (): boolean { | ||
34 | this.menu.setMenuDisplay(this.display) | ||
35 | return true | ||
36 | } | ||
37 | } | ||
38 | |||
39 | @Injectable() | ||
30 | export class CloseMenuGuard extends MenuGuard { | 40 | export class CloseMenuGuard extends MenuGuard { |
31 | constructor (menu: MenuService, screen: ScreenService) { super(menu, screen, false) } | 41 | constructor (menu: MenuService, screen: ScreenService) { super(menu, screen, false) } |
32 | } | 42 | } |
33 | 43 | ||
34 | @Injectable() | 44 | @Injectable() |
45 | export class CloseMenuAlwaysGuard extends MenuGuard { | ||
46 | constructor (menu: MenuService, screen: ScreenService) { super(menu, screen, false) } | ||
47 | |||
48 | canActivate (): boolean { | ||
49 | this.menu.setMenuDisplay(this.display) | ||
50 | return true | ||
51 | } | ||
52 | } | ||
53 | |||
54 | @Injectable() | ||
35 | export class MenuGuards { | 55 | export class MenuGuards { |
36 | public static guards = [ | 56 | public static guards = [ |
37 | OpenMenuGuard, | 57 | OpenMenuGuard, |
38 | CloseMenuGuard | 58 | OpenMenuAlwaysGuard, |
59 | CloseMenuGuard, | ||
60 | CloseMenuAlwaysGuard | ||
39 | ] | 61 | ] |
40 | 62 | ||
41 | static open () { | 63 | static open (always?: boolean) { |
42 | return OpenMenuGuard | 64 | return always |
65 | ? OpenMenuAlwaysGuard | ||
66 | : OpenMenuGuard | ||
43 | } | 67 | } |
44 | 68 | ||
45 | static close () { | 69 | static close (always?: boolean) { |
46 | return CloseMenuGuard | 70 | return always |
71 | ? CloseMenuAlwaysGuard | ||
72 | : CloseMenuGuard | ||
47 | } | 73 | } |
48 | } | 74 | } |