Skip to content

Commit

Permalink
feat: use tooltip for showing title if relative module was imported (#30
Browse files Browse the repository at this point in the history
)
  • Loading branch information
razonyang committed Feb 3, 2024
1 parent 07d88f6 commit 5c8e000
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module github.com/hbstack/revision

go 1.19

require (
github.com/hbstack/hb v0.11.0 // indirect
github.com/hugomods/icons/vendors/bootstrap v0.5.3 // indirect
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github.com/hbstack/hb v0.11.0 h1:5rPtnOMUaKxd4tT4hm08kDqit7EMNcPkX3PdPEX11z4=
github.com/hbstack/hb v0.11.0/go.mod h1:6T8TytCOb1C0EIRVcjzwuhI/G/H0ytTOaJbT1xwiDuY=
github.com/hugomods/icons v0.6.0 h1:G6RU93okhPPRDh/jqcew9gwkcYpSpg0rCBv4S6yUAFw=
github.com/hugomods/icons v0.6.0/go.mod h1:cIkSvK6W0q6N4U6n9KGz+QfRWQXAW0INd+1P31gPNGg=
github.com/hugomods/icons/vendors/bootstrap v0.5.3 h1:3twbdiKpeCudV0UFNBZqUgBLIjG5qcv4lvvlALgR5ro=
github.com/hugomods/icons/vendors/bootstrap v0.5.3/go.mod h1:SuPcqO3u8gN4epmf+2L1G8pg6X3nXj2D6FYRWd+OIrw=
3 changes: 3 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[[module.imports]]
path = "github.com/hbstack/hb"

[[module.imports]]
path = "github.com/hugomods/icons/vendors/bootstrap"

Expand Down
11 changes: 9 additions & 2 deletions layouts/partials/hb/modules/revision/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{{- $createdAt := default true site.Params.hb.revision.created_at }}
{{- if or $createdAt (ne .Lastmod .Date) }}
<div class="hb-module hb-revision text-body-secondary d-flex flex-wrap">
{{- $tooltip := partial "hb/functions/module-exists" "github.com/hbstack/bs-tooltip" }}
{{- $params := site.Params.hb.revision }}
{{- $icons := default true $params.icons }}
{{- $format := default ":date_full" $params.date_format }}
{{- if ne .Lastmod .Date }}
{{- $lastmod := .Lastmod | time.Format $format }}
{{- $lastmodFull := printf "%s %s" (.Lastmod | time.Format ":date_full") (.Lastmod | time.Format ":time_full") }}
<span class="hb-revision-lastmod me-2" title="{{ i18n `revised_at` (dict `Date` $lastmodFull) }}">
<span
class="hb-revision-lastmod me-2"
{{ if $tooltip }}data-bs-toggle="tooltip"{{ end }}
title="{{ i18n `revised_at` (dict `Date` $lastmodFull) }}">
{{- if $icons }}
{{ partial "icons/icon" (dict "vendor" "bs" "name" "pencil-square") }}
<span>{{ $lastmod }}</span>
Expand All @@ -19,7 +23,10 @@
{{- if $createdAt }}
{{- $date := .Date | time.Format $format }}
{{- $dateFull := printf "%s %s" (.Date | time.Format ":date_full") (.Date | time.Format ":time_full") }}
<span class="hb-revision-date" title="{{ i18n `created_at` (dict `Date` $dateFull) }}">
<span
class="hb-revision-date"
{{ if $tooltip }}data-bs-toggle="tooltip"{{ end }}
title="{{ i18n `created_at` (dict `Date` $dateFull) }}">
{{- if $icons }}
{{ partial "icons/icon" (dict "vendor" "bs" "name" "calendar-plus") }}
<span>{{ $date }}</span>
Expand Down

0 comments on commit 5c8e000

Please sign in to comment.