-
Login
-
Login
+
diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss
index cd57e134e..9d5ad57c2 100644
--- a/client/src/app/menu/menu.component.scss
+++ b/client/src/app/menu/menu.component.scss
@@ -251,7 +251,8 @@ my-actor-avatar {
.login-buttons-block {
margin: 30px 25px 35px;
- > a {
+ > a,
+ > my-login-link {
display: block;
width: 100%;
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index fc6d74cff..21354e52d 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -1,7 +1,6 @@
import { HotkeysService } from 'angular2-hotkeys'
import * as debug from 'debug'
import { switchMap } from 'rxjs/operators'
-import { environment } from 'src/environments/environment'
import { ViewportScroller } from '@angular/common'
import { Component, OnInit, ViewChild } from '@angular/core'
import { Router } from '@angular/router'
@@ -22,7 +21,6 @@ import { LanguageChooserComponent } from '@app/menu/language-chooser.component'
import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
-import { PluginsManager } from '@root-helpers/plugins-manager'
import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'
const debugLogger = debug('peertube:menu:MenuComponent')
@@ -135,10 +133,6 @@ export class MenuComponent implements OnInit {
.subscribe(() => this.openQuickSettings())
}
- getExternalLoginHref () {
- return PluginsManager.getDefaultLoginHref(environment.apiUrl, this.serverConfig)
- }
-
isRegistrationAllowed () {
if (!this.serverConfig) return false
diff --git a/client/src/app/shared/shared-main/angular/index.ts b/client/src/app/shared/shared-main/angular/index.ts
index 4b87c2952..f72d60313 100644
--- a/client/src/app/shared/shared-main/angular/index.ts
+++ b/client/src/app/shared/shared-main/angular/index.ts
@@ -5,5 +5,6 @@ export * from './duration-formatter.pipe'
export * from './from-now.pipe'
export * from './infinite-scroller.directive'
export * from './link.component'
+export * from './login-link.component'
export * from './number-formatter.pipe'
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
index e61a1e085..2ea2df2b5 100644
--- a/client/src/app/shared/shared-main/angular/link.component.html
+++ b/client/src/app/shared/shared-main/angular/link.component.html
@@ -2,10 +2,10 @@
-
+
-
+
diff --git a/client/src/app/shared/shared-main/angular/link.component.scss b/client/src/app/shared/shared-main/angular/link.component.scss
index bb86d5488..f54240d31 100644
--- a/client/src/app/shared/shared-main/angular/link.component.scss
+++ b/client/src/app/shared/shared-main/angular/link.component.scss
@@ -1,4 +1,4 @@
-a {
+.no-class {
color: inherit;
text-decoration: inherit;
position: inherit;
diff --git a/client/src/app/shared/shared-main/angular/link.component.ts b/client/src/app/shared/shared-main/angular/link.component.ts
index ecbd9151c..1f5975589 100644
--- a/client/src/app/shared/shared-main/angular/link.component.ts
+++ b/client/src/app/shared/shared-main/angular/link.component.ts
@@ -1,17 +1,27 @@
-import { Component, Input } from '@angular/core'
+import { Component, Input, OnInit } from '@angular/core'
@Component({
selector: 'my-link',
styleUrls: [ './link.component.scss' ],
templateUrl: './link.component.html'
})
-export class LinkComponent {
+export class LinkComponent implements OnInit {
@Input() internalLink?: string | any[]
@Input() href?: string
- @Input() target?: string
+ @Input() target = '_self'
@Input() title?: string
+ @Input() className?: string
+
@Input() tabindex: string | number
+
+ builtClasses: string
+
+ ngOnInit () {
+ this.builtClasses = this.className
+ ? this.className
+ : 'no-class'
+ }
}
diff --git a/client/src/app/shared/shared-main/angular/login-link.component.html b/client/src/app/shared/shared-main/angular/login-link.component.html
new file mode 100644
index 000000000..f90ffba68
--- /dev/null
+++ b/client/src/app/shared/shared-main/angular/login-link.component.html
@@ -0,0 +1 @@
+
{{ label }}
diff --git a/client/src/app/shared/shared-main/angular/login-link.component.ts b/client/src/app/shared/shared-main/angular/login-link.component.ts
new file mode 100644
index 000000000..7e3a773c2
--- /dev/null
+++ b/client/src/app/shared/shared-main/angular/login-link.component.ts
@@ -0,0 +1,22 @@
+import { environment } from 'src/environments/environment'
+import { Component, Input } from '@angular/core'
+import { ServerService } from '@app/core'
+import { PluginsManager } from '@root-helpers/plugins-manager'
+
+@Component({
+ selector: 'my-login-link',
+ templateUrl: './login-link.component.html'
+})
+export class LoginLinkComponent {
+ @Input() label = $localize`Login`
+
+ @Input() className?: string
+
+ constructor (private server: ServerService) {
+
+ }
+
+ getExternalLoginHref () {
+ return PluginsManager.getDefaultLoginHref(environment.apiUrl, this.server.getHTMLConfig())
+ }
+}
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 eb1642d97..0bdf27263 100644
--- a/client/src/app/shared/shared-main/shared-main.module.ts
+++ b/client/src/app/shared/shared-main/shared-main.module.ts
@@ -25,6 +25,7 @@ import {
FromNowPipe,
InfiniteScrollerDirective,
LinkComponent,
+ LoginLinkComponent,
NumberFormatterPipe,
PeerTubeTemplateDirective
} from './angular'
@@ -92,6 +93,7 @@ import { VideoChannelService } from './video-channel'
InfiniteScrollerDirective,
PeerTubeTemplateDirective,
LinkComponent,
+ LoginLinkComponent,
ActionDropdownComponent,
ButtonComponent,
@@ -152,6 +154,7 @@ import { VideoChannelService } from './video-channel'
InfiniteScrollerDirective,
PeerTubeTemplateDirective,
LinkComponent,
+ LoginLinkComponent,
ActionDropdownComponent,
ButtonComponent,
diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
index 7a55a6ffb..a002bf4e7 100644
--- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
+++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
@@ -1,7 +1,6 @@
import { concat, forkJoin, merge } from 'rxjs'
import { Component, Input, OnChanges, OnInit } from '@angular/core'
-import { Router } from '@angular/router'
-import { AuthService, Notifier } from '@app/core'
+import { AuthService, Notifier, RedirectService } from '@app/core'
import { Account, VideoChannel, VideoService } from '@app/shared/shared-main'
import { FeedFormat } from '@shared/models'
import { UserSubscriptionService } from './user-subscription.service'
@@ -27,7 +26,7 @@ export class SubscribeButtonComponent implements OnInit, OnChanges {
constructor (
private authService: AuthService,
- private router: Router,
+ private redirectService: RedirectService,
private notifier: Notifier,
private userSubscriptionService: UserSubscriptionService,
private videoService: VideoService
@@ -152,7 +151,7 @@ export class SubscribeButtonComponent implements OnInit, OnChanges {
}
gotoLogin () {
- this.router.navigate([ '/login' ])
+ this.redirectService.redirectToLogin()
}
subscribeStatus (subscribed: boolean) {