mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-12 04:23:14 +00:00
30 lines
1017 B
HTML
30 lines
1017 B
HTML
<!--
|
|
Copyright © 2024 The Hinode Team / Mark Dumay. All rights reserved.
|
|
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
|
|
Visit gethinode.com/license for more details.
|
|
-->
|
|
|
|
{{ $error := false }}
|
|
|
|
<!-- Validate arguments -->
|
|
{{ if partial "utilities/IsInvalidArgs.html" (dict "structure" "toast" "args" .Params "group" "shortcode") }}
|
|
{{ errorf "Invalid arguments: %s" .Position -}}
|
|
{{ $error = true }}
|
|
{{ end }}
|
|
|
|
<!-- Initialize arguments -->
|
|
{{- $id := .Get "id" | default (printf "toast-message-%d" .Ordinal) -}}
|
|
{{ $header := .Get "header" | default "" -}}
|
|
{{ $message := trim .Inner " \r\n" | .Page.RenderString -}}
|
|
{{- $class := .Get "class" | default "" -}}
|
|
|
|
{{ if not $message -}}
|
|
{{ errorf "Missing inner element text: %s" .Position -}}
|
|
{{ $error = true }}
|
|
{{ end }}
|
|
|
|
<!-- Main code -->
|
|
{{ if not $error -}}
|
|
{{ partial "assets/toast.html" (dict "id" $id "header" $header "message" $message "class" $class) }}
|
|
{{ end -}}
|