diff options
Diffstat (limited to 'client')
4 files changed, 28 insertions, 4 deletions
diff --git a/client/src/app/+login/login.component.html b/client/src/app/+login/login.component.html index 0be67368e..90eea1505 100644 --- a/client/src/app/+login/login.component.html +++ b/client/src/app/+login/login.component.html | |||
@@ -15,7 +15,7 @@ | |||
15 | <div class="wrapper"> | 15 | <div class="wrapper"> |
16 | <div class="login-form-and-externals"> | 16 | <div class="login-form-and-externals"> |
17 | 17 | ||
18 | <form role="form" (ngSubmit)="login()" [formGroup]="form"> | 18 | <form myPluginSelector pluginSelectorId="login-form" role="form" (ngSubmit)="login()" [formGroup]="form"> |
19 | <div class="form-group"> | 19 | <div class="form-group"> |
20 | <div> | 20 | <div> |
21 | <label i18n for="username">User</label> | 21 | <label i18n for="username">User</label> |
diff --git a/client/src/app/shared/shared-main/plugins/index.ts b/client/src/app/shared/shared-main/plugins/index.ts index f36dab624..f45ed9b73 100644 --- a/client/src/app/shared/shared-main/plugins/index.ts +++ b/client/src/app/shared/shared-main/plugins/index.ts | |||
@@ -1 +1,2 @@ | |||
1 | export * from './plugin-placeholder.component' | 1 | export * from './plugin-placeholder.component' |
2 | export * from './plugin-selector.directive' | ||
diff --git a/client/src/app/shared/shared-main/plugins/plugin-selector.directive.ts b/client/src/app/shared/shared-main/plugins/plugin-selector.directive.ts new file mode 100644 index 000000000..576569f19 --- /dev/null +++ b/client/src/app/shared/shared-main/plugins/plugin-selector.directive.ts | |||
@@ -0,0 +1,21 @@ | |||
1 | import { Directive, ElementRef, Input, OnInit, Renderer2 } from '@angular/core' | ||
2 | import { PluginSelectorId } from '@shared/models' | ||
3 | |||
4 | @Directive({ selector: '[myPluginSelector]' }) | ||
5 | export class PluginSelectorDirective implements OnInit { | ||
6 | @Input() pluginSelectorId: PluginSelectorId | ||
7 | |||
8 | constructor ( | ||
9 | private renderer: Renderer2, | ||
10 | private hostElement: ElementRef<HTMLElement> | ||
11 | ) { | ||
12 | |||
13 | } | ||
14 | |||
15 | ngOnInit () { | ||
16 | const id = this.hostElement.nativeElement.getAttribute('id') | ||
17 | if (id) throw new Error('Cannot set id on element that already has an id') | ||
18 | |||
19 | this.renderer.setAttribute(this.hostElement.nativeElement, 'id', `plugin-selector-${this.pluginSelectorId}`) | ||
20 | } | ||
21 | } | ||
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts index a90b59e41..10fc364b3 100644 --- a/client/src/app/shared/shared-main/shared-main.module.ts +++ b/client/src/app/shared/shared-main/shared-main.module.ts | |||
@@ -41,7 +41,7 @@ import { | |||
41 | SimpleSearchInputComponent, | 41 | SimpleSearchInputComponent, |
42 | TopMenuDropdownComponent | 42 | TopMenuDropdownComponent |
43 | } from './misc' | 43 | } from './misc' |
44 | import { PluginPlaceholderComponent } from './plugins' | 44 | import { PluginPlaceholderComponent, PluginSelectorDirective } from './plugins' |
45 | import { ActorRedirectGuard } from './router' | 45 | import { ActorRedirectGuard } from './router' |
46 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' | 46 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' |
47 | import { EmbedComponent, RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' | 47 | import { EmbedComponent, RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' |
@@ -108,7 +108,8 @@ import { VideoChannelService } from './video-channel' | |||
108 | 108 | ||
109 | EmbedComponent, | 109 | EmbedComponent, |
110 | 110 | ||
111 | PluginPlaceholderComponent | 111 | PluginPlaceholderComponent, |
112 | PluginSelectorDirective | ||
112 | ], | 113 | ], |
113 | 114 | ||
114 | exports: [ | 115 | exports: [ |
@@ -166,7 +167,8 @@ import { VideoChannelService } from './video-channel' | |||
166 | 167 | ||
167 | EmbedComponent, | 168 | EmbedComponent, |
168 | 169 | ||
169 | PluginPlaceholderComponent | 170 | PluginPlaceholderComponent, |
171 | PluginSelectorDirective | ||
170 | ], | 172 | ], |
171 | 173 | ||
172 | providers: [ | 174 | providers: [ |