aboutsummaryrefslogtreecommitdiff
path: root/example/example.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-12-21 20:46:08 +0700
committerShulhan <ms@kilabit.info>2021-12-21 20:46:08 +0700
commitbbaa1ddeca854814389944f9d57a95a331f7476f (patch)
tree8666a8e6f10e5c99479b87930ac0c5f032c3bcf6 /example/example.go
parentf5a9a7934f3624763fce2094d291fbb97b96ddd1 (diff)
downloadgorankusu-bbaa1ddeca854814389944f9d57a95a331f7476f.tar.xz
all: add option to open link inside an iframe
The NavLink struct now has field OpenInIFrame. If its true, the Href will be opened inside an iframe in the same window, otherwise it will opened in new tab.
Diffstat (limited to 'example/example.go')
-rw-r--r--example/example.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/example/example.go b/example/example.go
index d5754ac..3800bfc 100644
--- a/example/example.go
+++ b/example/example.go
@@ -336,7 +336,16 @@ func (ex *Example) registerNavLinks() (err error) {
logp := "registerNavLinks"
err = ex.trunks.RegisterNavLink(&trunks.NavLink{
- Text: "Trunks",
+ Text: "Link in IFrame",
+ Href: "https://git.sr.ht/~shulhan/trunks",
+ OpenInIFrame: true,
+ })
+ if err != nil {
+ return fmt.Errorf("%s: %w", logp, err)
+ }
+
+ err = ex.trunks.RegisterNavLink(&trunks.NavLink{
+ Text: "Link in new window",
Href: "https://git.sr.ht/~shulhan/trunks",
})
if err != nil {