diff options
Diffstat (limited to 'client/src/app/menu/menu.component.ts')
-rw-r--r-- | client/src/app/menu/menu.component.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 3de4a78af..22ddfad02 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts | |||
@@ -3,6 +3,7 @@ import { UserRight } from '../../../../shared/models/users/user-right.enum' | |||
3 | import { AuthService, AuthStatus, RedirectService, ServerService } from '../core' | 3 | import { AuthService, AuthStatus, RedirectService, ServerService } from '../core' |
4 | import { User } from '../shared/users/user.model' | 4 | import { User } from '../shared/users/user.model' |
5 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' | 5 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' |
6 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-menu', | 9 | selector: 'my-menu', |
@@ -15,6 +16,7 @@ export class MenuComponent implements OnInit { | |||
15 | user: User | 16 | user: User |
16 | isLoggedIn: boolean | 17 | isLoggedIn: boolean |
17 | userHasAdminAccess = false | 18 | userHasAdminAccess = false |
19 | hotkeys: Hotkey[] | ||
18 | 20 | ||
19 | private routesPerRight = { | 21 | private routesPerRight = { |
20 | [UserRight.MANAGE_USERS]: '/admin/users', | 22 | [UserRight.MANAGE_USERS]: '/admin/users', |
@@ -28,7 +30,8 @@ export class MenuComponent implements OnInit { | |||
28 | constructor ( | 30 | constructor ( |
29 | private authService: AuthService, | 31 | private authService: AuthService, |
30 | private serverService: ServerService, | 32 | private serverService: ServerService, |
31 | private redirectService: RedirectService | 33 | private redirectService: RedirectService, |
34 | private hotkeysService: HotkeysService | ||
32 | ) {} | 35 | ) {} |
33 | 36 | ||
34 | ngOnInit () { | 37 | ngOnInit () { |
@@ -60,6 +63,14 @@ export class MenuComponent implements OnInit { | |||
60 | this.previousTheme['submenuColor'] = 'rgb(32,32,32)' | 63 | this.previousTheme['submenuColor'] = 'rgb(32,32,32)' |
61 | this.previousTheme['inputColor'] = 'gray' | 64 | this.previousTheme['inputColor'] = 'gray' |
62 | this.previousTheme['inputPlaceholderColor'] = '#fff' | 65 | this.previousTheme['inputPlaceholderColor'] = '#fff' |
66 | |||
67 | this.hotkeys = [ | ||
68 | new Hotkey('T', (event: KeyboardEvent): boolean => { | ||
69 | this.toggleDarkTheme() | ||
70 | return false | ||
71 | }, undefined, 'Toggle Dark theme') | ||
72 | ] | ||
73 | this.hotkeysService.add(this.hotkeys) | ||
63 | } | 74 | } |
64 | 75 | ||
65 | isRegistrationAllowed () { | 76 | isRegistrationAllowed () { |