Merge Edge with sort and resize #2

Merged
alfred merged 64 commits from edge into master 2022-07-28 01:51:14 +01:00
3 changed files with 26 additions and 6 deletions
Showing only changes of commit eecf2e9a70 - Show all commits

View File

@ -15,7 +15,17 @@
</head> </head>
<body> <body>
<header class="header"> <header class="header">
{{ if .Light }}
<a href="?light" class="home-button no-dec"><b>&#8962;</b></a>
<a href="?{{ .Parameters }}" class="home-button no-dec"><b>&#9790;</b></a>
{{ else }}
<a href="?" class="home-button no-dec"><b>&#8962;</b></a> <a href="?" class="home-button no-dec"><b>&#8962;</b></a>
{{ if eq .Parameters "" }}
<a href="?light" class="home-button no-dec"><b>&#9737;</b></a>
{{ else }}
<a href="?light&{{ .Parameters }}" class="home-button no-dec"><b>&#9737;</b></a>
{{ end }}
{{ end }}
<input class="nav-menu" type="checkbox" id="nav-menu"/> <input class="nav-menu" type="checkbox" id="nav-menu"/>
<label class="hmb" for="nav-menu"><span class="hmb-line"></span></label> <label class="hmb" for="nav-menu"><span class="hmb-line"></span></label>
<nav class="nav"> <nav class="nav">

View File

@ -53,6 +53,17 @@ func (p *Page) GetLastModified() time.Time {
} }
func (p *Page) GetCacheIDExtension(urlParameters url.Values) string { func (p *Page) GetCacheIDExtension(urlParameters url.Values) string {
toReturn := p.getNonThemedCleanQuery(urlParameters)
if toReturn != "" {
toReturn += "&"
}
if urlParameters.Has("light") {
toReturn += "light"
}
return strings.TrimRight(toReturn, "&")
}
func (p *Page) getNonThemedCleanQuery(urlParameters url.Values) string {
toReturn := "" toReturn := ""
if urlParameters.Has("order") { if urlParameters.Has("order") {
if theParameter := strings.ToLower(urlParameters.Get("order")); theParameter == "start" || theParameter == "end" || theParameter == "name" || theParameter == "duration" { if theParameter := strings.ToLower(urlParameters.Get("order")); theParameter == "start" || theParameter == "end" || theParameter == "name" || theParameter == "duration" {
@ -61,12 +72,9 @@ func (p *Page) GetCacheIDExtension(urlParameters url.Values) string {
} }
if urlParameters.Has("sort") { if urlParameters.Has("sort") {
if theParameter := strings.ToLower(urlParameters.Get("sort")); theParameter == "asc" || theParameter == "ascending" || theParameter == "desc" || theParameter == "descending" { if theParameter := strings.ToLower(urlParameters.Get("sort")); theParameter == "asc" || theParameter == "ascending" || theParameter == "desc" || theParameter == "descending" {
toReturn += "sort=" + theParameter + "&" toReturn += "sort=" + theParameter
} }
} }
if urlParameters.Has("light") {
toReturn += "light"
}
return strings.TrimRight(toReturn, "&") return strings.TrimRight(toReturn, "&")
} }
@ -82,6 +90,7 @@ func (p *Page) GetContents(urlParameters url.Values) (contentType string, conten
theMarshal := &Marshal{ theMarshal := &Marshal{
Data: *theData, Data: *theData,
Light: urlParameters.Has("light"), Light: urlParameters.Has("light"),
Parameters: p.getNonThemedCleanQuery(urlParameters),
} }
switch strings.ToLower(urlParameters.Get("order")) { switch strings.ToLower(urlParameters.Get("order")) {
case "end": case "end":

View File

@ -4,6 +4,7 @@ import "sort"
type Marshal struct { type Marshal struct {
Data DataYaml Data DataYaml
Parameters string
OrderStartDate int8 OrderStartDate int8
OrderEndDate int8 OrderEndDate int8
OrderName int8 OrderName int8