Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: add plugin support for external links #6784

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions client/src/app/menu/menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,23 @@
<ul class="ul-unstyle">
<li *ngFor="let link of menuSection.links">
@if (link.isPrimaryButton === true) {
<my-button class="d-block menu-button" [ngClass]="link.ngClass" theme="primary" [icon]="link.icon" [title]="link.label" [ptRouterLink]="link.path" [ptQueryParams]="link.query">
<my-button class="d-block menu-button" [ngClass]="link.ngClass" theme="primary" [icon]="link.icon" [title]="link.label" [ptRouterLink]="link.path" [ptQueryParams]="link.query" [href]="link.url">
@if (!collapsed) {
{{ link.label }}
}
</my-button>
} @else {
<a class="menu-link ellipsis" [routerLink]="link.path" [queryParams]="link.query" routerLinkActive="active" [ngClass]="link.ngClass" [title]="link.label">
<ng-template #linkTemplate>
<my-global-icon *ngIf="link.icon" [iconName]="link.icon" [ngClass]="link.iconClass" aria-hidden="true"></my-global-icon>
<span [ngClass]="{ 'visually-hidden': collapsed }">{{ link.label }}</span>
</ng-template>

<a *ngIf="link.path" class="menu-link ellipsis" [routerLink]="link.path" [queryParams]="link.query" routerLinkActive="active" [ngClass]="link.ngClass" [title]="link.label">
<ng-container *ngTemplateOutlet="linkTemplate"></ng-container>
</a>

<a *ngIf="link.url" class="menu-link ellipsis" [href]="link.url" [ngClass]="link.ngClass" [title]="link.label" target="_blank">
<ng-container *ngTemplateOutlet="linkTemplate"></ng-container>
</a>
}
</li>
Expand Down
3 changes: 2 additions & 1 deletion client/src/app/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ type MenuLink = {

label: string

path: string
path?: string
url?: string
query?: Params

isPrimaryButton?: boolean // default false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
>
<ng-container *ngTemplateOutlet="content"></ng-container>
</a>
} @else if (href) {
<a
class="action-button"
[ngClass]="classes" [ngbTooltip]="tooltip" [attr.title]="title"
[href]="href" target="_blank"
>
<ng-container *ngTemplateOutlet="content"></ng-container>
</a>
} @else {
<button type="button" class="action-button" [ngClass]="classes" [disabled]="disabled" [ngbTooltip]="tooltip" [attr.title]="title">
<ng-container *ngTemplateOutlet="content"></ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class ButtonComponent implements OnChanges, AfterViewInit {
@Input() theme: 'primary' | 'secondary' | 'tertiary' = 'secondary'
@Input() icon: GlobalIconName

@Input() href: string
@Input() ptRouterLink: string[] | string
@Input() ptQueryParams: Params
@Input() ptQueryParamsHandling: QueryParamsHandling
Expand Down Expand Up @@ -73,7 +74,7 @@ export class ButtonComponent implements OnChanges, AfterViewInit {
}

private buildClasses () {
const isButtonLink = !!this.ptRouterLink
const isButtonLink = !!this.ptRouterLink || !!this.href

this.classes = {
'active': this.active,
Expand Down
Loading