diff --git a/README.md b/README.md index 9addffc..8b267a9 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,6 @@ air dev ## TODO -- configure target of website cards - implementing proper command line args - clear cache - implement fetching in intervals diff --git a/frontend/index.html b/frontend/index.html index 8192de6..2cdabe5 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -18,8 +18,9 @@ {{ if eq .ActiveCard "stores" }}
+ {{ $T := .DiyHrtTarget }} {{range $Store := .Stores }} - +

{{ $Store.Name }}

{{- end }} @@ -28,8 +29,9 @@ {{ if eq .ActiveCard "listings" }}
+ {{ $T := .DiyHrtTarget }} {{range $Listing := .Listings }} - +

{{ $Listing.ProductName }}

{{ $Listing.StoreName }} - {{ $Listing.Price }} {{ $Listing.PriceCurrency }}

@@ -39,8 +41,9 @@ {{ if eq .ActiveCard "websites" }}
+ {{ $T := .WebsiteTarget }} {{range $Website := .Websites }} - +

{{ $Website.Name }}

{{ $Website.Name }} picture
diff --git a/internal/rendering/config.go b/internal/rendering/config.go index ce5237f..ec56829 100644 --- a/internal/rendering/config.go +++ b/internal/rendering/config.go @@ -20,6 +20,15 @@ const ( Websites ActiveCard = "websites" ) +type AnchorTarget string + +const ( + OpenInNewTab AnchorTarget = "_blank" + OpenInCurrentTab AnchorTarget = "_self" + OpenInParent AnchorTarget = "_parent" + OpenInTopWindow AnchorTarget = "_top" +) + type ServerConfig struct { Port int } @@ -33,12 +42,14 @@ type TemplateConfig struct { SearchFormAction string SearchInputName string - Listings []diyhrt.Listing - Stores []diyhrt.Store + Listings []diyhrt.Listing + Stores []diyhrt.Store + DiyHrtTarget AnchorTarget ActiveCard ActiveCard - Websites []Website + Websites []Website + WebsiteTarget AnchorTarget } type Config struct { @@ -81,9 +92,12 @@ func NewConfig() Config { ActiveCard: DiyHrtListings, + DiyHrtTarget: OpenInCurrentTab, + Websites: []Website{ {Url: "https://gitea.elara.ws/Hazel/transfem-startpage", Name: "Transfem Startpage", ImageUrl: "https://gitea.elara.ws/assets/img/logo.svg"}, }, + WebsiteTarget: OpenInCurrentTab, }, } }