added config options for website targets
This commit is contained in:
parent
e5c7dc6f44
commit
fbbd78ce72
@ -43,7 +43,6 @@ air dev
|
||||
|
||||
## TODO
|
||||
|
||||
- configure target of website cards
|
||||
- implementing proper command line args
|
||||
- clear cache
|
||||
- implement fetching in intervals
|
||||
|
@ -18,8 +18,9 @@
|
||||
|
||||
{{ if eq .ActiveCard "stores" }}
|
||||
<div class="cards" id="stores">
|
||||
{{ $T := .DiyHrtTarget }}
|
||||
{{range $Store := .Stores }}
|
||||
<a target="_blank" href="{{ $Store.Url }}" class="card">
|
||||
<a target="{{ $T }}" href="{{ $Store.Url }}" class="card">
|
||||
<h3>{{ $Store.Name }}</h3>
|
||||
</a>
|
||||
{{- end }}
|
||||
@ -28,8 +29,9 @@
|
||||
|
||||
{{ if eq .ActiveCard "listings" }}
|
||||
<div class="cards" id="listings">
|
||||
{{ $T := .DiyHrtTarget }}
|
||||
{{range $Listing := .Listings }}
|
||||
<a target="_blank" href="{{ $Listing.Url }}" class="card {{ if $Listing.InStock }}in-stock{{ end }}">
|
||||
<a target="{{ $T }}" href="{{ $Listing.Url }}" class="card {{ if $Listing.InStock }}in-stock{{ end }}">
|
||||
<h3>{{ $Listing.ProductName }}</h3>
|
||||
<p>{{ $Listing.StoreName }} - {{ $Listing.Price }} {{ $Listing.PriceCurrency }}</p>
|
||||
</a>
|
||||
@ -39,8 +41,9 @@
|
||||
|
||||
{{ if eq .ActiveCard "websites" }}
|
||||
<div class="cards" id="websites">
|
||||
{{ $T := .WebsiteTarget }}
|
||||
{{range $Website := .Websites }}
|
||||
<a href="{{ $Website.Url }}" class="card">
|
||||
<a href="{{ $Website.Url }}" class="card" target="{{ $T }}">
|
||||
<h3>{{ $Website.Name }}</h3>
|
||||
<img class="card-image" src="{{ $Website.ImageUrl }}" alt="{{ $Website.Name }} picture">
|
||||
</a>
|
||||
|
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user