File

src/app/shared/widgets/footer/footer.component.ts

Index

Properties

Properties

content
content: string
Type : string

Sets the message displayed in the pop-up opened when clicking the link. It could be set with a localization key (e.g. "infotext.help.message") to show a localized message

name
name: string
Type : string

Sets the link name (displayed in the footer) and the title of the pop-up opened when clicking the link. It could be set with a localization key (e.g. "infotext.help") to show a localized name / title

type
type: string
Type : string

Sets the type of the link target. Currently it supports the value 'popup' only

import { Component } from "@angular/core";
import { WidgetConfig } from "../widget.configuration";
import {
  WidgetComponent,
  WidgetId,
  WidgetConfiguration,
  WidgetConfigure,
} from "../widget.metadata";
import { MatDialog } from "@angular/material/dialog";
import { TranslateService } from "@ngx-translate/core";
import { TextDialogComponent } from "../../components/dialog/textDialog.component";

export interface FooterLink {
  /**
   * Sets the type of the link target.
   * Currently it supports the value 'popup' only
   */
  type: string;

  /**
   * Sets the link name (displayed in the footer) and the title of the pop-up opened when clicking the link.
   * It could be set with a localization key (e.g. "infotext.help") to show a localized name / title
   */
  name: string;

  /**
   * Sets the message displayed in the pop-up opened when clicking the link.
   * It could be set with a localization key (e.g. "infotext.help.message") to show a localized message
   */
  content: string;
}

export interface FooterWidgetConfiguration {
  /**
   * Sets the links to be displayed in the footer
   */
  links: FooterLink[];
}

@WidgetComponent("nm-footer")
@Component({
  selector: "nm-footer",
  templateUrl: "./footer.component.html",
  styleUrls: ["./footer.component.scss"],
})
export class FooterWidgetComponent {
  @WidgetId()
  public _id;

  @WidgetConfiguration()
  public configuration: WidgetConfig<FooterWidgetConfiguration>;

  public links: FooterLink[] = [];
  constructor(
    public translateService: TranslateService,
    public dialog: MatDialog
  ) {}
  @WidgetConfigure()
  protected configureWidget(
    configuration: WidgetConfig<FooterWidgetConfiguration>
  ) {
    this.links = configuration.configuration.links;
  }

  openTextPopup(currentLink) {
    if (currentLink.type === "popup") {
      let dialogRef = this.dialog.open(TextDialogComponent, {
        autoFocus: false,
      });
      dialogRef.componentInstance["title"] = this.translateService.instant(
        currentLink.name
      );
      dialogRef.componentInstance["message"] = this.translateService.instant(
        currentLink.content
      );
      dialogRef.componentInstance[
        "buttonCloseTitle"
      ] = this.translateService.instant("button.close");
    }
  }
}

results matching ""

    No results matching ""