diff options
Diffstat (limited to 'client/src/app/shared/shared-main')
5 files changed, 41 insertions, 2 deletions
diff --git a/client/src/app/shared/shared-main/angular/index.ts b/client/src/app/shared/shared-main/angular/index.ts index 8ea47bb33..069b7f654 100644 --- a/client/src/app/shared/shared-main/angular/index.ts +++ b/client/src/app/shared/shared-main/angular/index.ts | |||
@@ -3,5 +3,6 @@ export * from './bytes.pipe' | |||
3 | export * from './duration-formatter.pipe' | 3 | export * from './duration-formatter.pipe' |
4 | export * from './from-now.pipe' | 4 | export * from './from-now.pipe' |
5 | export * from './infinite-scroller.directive' | 5 | export * from './infinite-scroller.directive' |
6 | export * from './link.component' | ||
6 | export * from './number-formatter.pipe' | 7 | export * from './number-formatter.pipe' |
7 | export * from './peertube-template.directive' | 8 | export * from './peertube-template.directive' |
diff --git a/client/src/app/shared/shared-main/angular/link.component.html b/client/src/app/shared/shared-main/angular/link.component.html new file mode 100644 index 000000000..e61a1e085 --- /dev/null +++ b/client/src/app/shared/shared-main/angular/link.component.html | |||
@@ -0,0 +1,11 @@ | |||
1 | <ng-template #content> | ||
2 | <ng-content></ng-content> | ||
3 | </ng-template> | ||
4 | |||
5 | <a *ngIf="!href" [routerLink]="internalLink" [attr.title]="title" [tabindex]="tabindex"> | ||
6 | <ng-template *ngTemplateOutlet="content"></ng-template> | ||
7 | </a> | ||
8 | |||
9 | <a *ngIf="href" [href]="href" [target]="target" [attr.title]="title" [tabindex]="tabindex"> | ||
10 | <ng-template *ngTemplateOutlet="content"></ng-template> | ||
11 | </a> | ||
diff --git a/client/src/app/shared/shared-main/angular/link.component.scss b/client/src/app/shared/shared-main/angular/link.component.scss new file mode 100644 index 000000000..bb86d5488 --- /dev/null +++ b/client/src/app/shared/shared-main/angular/link.component.scss | |||
@@ -0,0 +1,7 @@ | |||
1 | a { | ||
2 | color: inherit; | ||
3 | text-decoration: inherit; | ||
4 | position: inherit; | ||
5 | width: inherit; | ||
6 | height: inherit; | ||
7 | } | ||
diff --git a/client/src/app/shared/shared-main/angular/link.component.ts b/client/src/app/shared/shared-main/angular/link.component.ts new file mode 100644 index 000000000..76d1201b9 --- /dev/null +++ b/client/src/app/shared/shared-main/angular/link.component.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | import { Component, Input, ViewEncapsulation } from '@angular/core' | ||
2 | |||
3 | @Component({ | ||
4 | selector: 'my-link', | ||
5 | styleUrls: [ './link.component.scss' ], | ||
6 | templateUrl: './link.component.html' | ||
7 | }) | ||
8 | export class LinkComponent { | ||
9 | @Input() internalLink?: any[] | ||
10 | |||
11 | @Input() href?: string | ||
12 | @Input() target?: string | ||
13 | |||
14 | @Input() title?: string | ||
15 | |||
16 | @Input() tabindex: string | number | ||
17 | } | ||
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 c8dd01429..e5dfc59b2 100644 --- a/client/src/app/shared/shared-main/shared-main.module.ts +++ b/client/src/app/shared/shared-main/shared-main.module.ts | |||
@@ -4,7 +4,7 @@ import { CommonModule, DatePipe } from '@angular/common' | |||
4 | import { HttpClientModule } from '@angular/common/http' | 4 | import { HttpClientModule } from '@angular/common/http' |
5 | import { NgModule } from '@angular/core' | 5 | import { NgModule } from '@angular/core' |
6 | import { FormsModule, ReactiveFormsModule } from '@angular/forms' | 6 | import { FormsModule, ReactiveFormsModule } from '@angular/forms' |
7 | import { ActivatedRouteSnapshot, RouterModule } from '@angular/router' | 7 | import { RouterModule } from '@angular/router' |
8 | import { | 8 | import { |
9 | NgbButtonsModule, | 9 | NgbButtonsModule, |
10 | NgbCollapseModule, | 10 | NgbCollapseModule, |
@@ -24,6 +24,7 @@ import { | |||
24 | DurationFormatterPipe, | 24 | DurationFormatterPipe, |
25 | FromNowPipe, | 25 | FromNowPipe, |
26 | InfiniteScrollerDirective, | 26 | InfiniteScrollerDirective, |
27 | LinkComponent, | ||
27 | NumberFormatterPipe, | 28 | NumberFormatterPipe, |
28 | PeerTubeTemplateDirective | 29 | PeerTubeTemplateDirective |
29 | } from './angular' | 30 | } from './angular' |
@@ -35,11 +36,11 @@ import { FeedComponent } from './feeds' | |||
35 | import { LoaderComponent, SmallLoaderComponent } from './loaders' | 36 | import { LoaderComponent, SmallLoaderComponent } from './loaders' |
36 | import { HelpComponent, ListOverflowComponent, SimpleSearchInputComponent, TopMenuDropdownComponent } from './misc' | 37 | import { HelpComponent, ListOverflowComponent, SimpleSearchInputComponent, TopMenuDropdownComponent } from './misc' |
37 | import { PluginPlaceholderComponent } from './plugins' | 38 | import { PluginPlaceholderComponent } from './plugins' |
39 | import { ActorRedirectGuard } from './router' | ||
38 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' | 40 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' |
39 | import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' | 41 | import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' |
40 | import { VideoCaptionService } from './video-caption' | 42 | import { VideoCaptionService } from './video-caption' |
41 | import { VideoChannelService } from './video-channel' | 43 | import { VideoChannelService } from './video-channel' |
42 | import { ActorRedirectGuard } from './router' | ||
43 | 44 | ||
44 | @NgModule({ | 45 | @NgModule({ |
45 | imports: [ | 46 | imports: [ |
@@ -76,6 +77,7 @@ import { ActorRedirectGuard } from './router' | |||
76 | 77 | ||
77 | InfiniteScrollerDirective, | 78 | InfiniteScrollerDirective, |
78 | PeerTubeTemplateDirective, | 79 | PeerTubeTemplateDirective, |
80 | LinkComponent, | ||
79 | 81 | ||
80 | ActionDropdownComponent, | 82 | ActionDropdownComponent, |
81 | ButtonComponent, | 83 | ButtonComponent, |
@@ -130,6 +132,7 @@ import { ActorRedirectGuard } from './router' | |||
130 | 132 | ||
131 | InfiniteScrollerDirective, | 133 | InfiniteScrollerDirective, |
132 | PeerTubeTemplateDirective, | 134 | PeerTubeTemplateDirective, |
135 | LinkComponent, | ||
133 | 136 | ||
134 | ActionDropdownComponent, | 137 | ActionDropdownComponent, |
135 | ButtonComponent, | 138 | ButtonComponent, |