fix cookie -- not working
This commit is contained in:
@@ -43,6 +43,27 @@ templ CategoryPage(data viewmodel.CategoryPageData, cssPath string, jsPath strin
|
||||
</article>
|
||||
}
|
||||
</section>
|
||||
|
||||
if data.Session != nil {
|
||||
<section class="rounded-[2rem] border border-white/10 bg-slate-950/70 p-8">
|
||||
<p class="text-xs uppercase tracking-[0.28em] text-emerald-300">Go Cookie Debug</p>
|
||||
<div class="mt-6 grid gap-6 lg:grid-cols-2">
|
||||
<div>
|
||||
<p class="text-sm font-semibold text-white">Raw Cookie</p>
|
||||
<pre class="mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-slate-300">{ data.Session.RawCookie }</pre>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm font-semibold text-white">Decoded Values</p>
|
||||
<pre class="mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-slate-300">
|
||||
for _, line := range sessionCookieLines(data.Session) {
|
||||
{ line }
|
||||
{"\n"}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
</main>
|
||||
}
|
||||
|
||||
@@ -181,7 +181,58 @@ func CategoryPage(data viewmodel.CategoryPageData, cssPath string, jsPath string
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</section></div></main>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</section>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if data.Session != nil {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<section class=\"rounded-[2rem] border border-white/10 bg-slate-950/70 p-8\"><p class=\"text-xs uppercase tracking-[0.28em] text-emerald-300\">Go Cookie Debug</p><div class=\"mt-6 grid gap-6 lg:grid-cols-2\"><div><p class=\"text-sm font-semibold text-white\">Raw Cookie</p><pre class=\"mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-slate-300\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(data.Session.RawCookie)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/category.templ`, Line: 53, Col: 127}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</pre></div><div><p class=\"text-sm font-semibold text-white\">Decoded Values</p><pre class=\"mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-slate-300\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, line := range sessionCookieLines(data.Session) {
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(line)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/category.templ`, Line: 59, Col: 16}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs("\n")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/category.templ`, Line: 60, Col: 15}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</pre></div></div></section>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</div></main>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ templ Layout(title string, cssPath string, jsPath string, menu []pscatalog.MenuI
|
||||
</div>
|
||||
if hasHeaderLocale(locale) {
|
||||
<div class="header-locale">
|
||||
@LocalePicker("Market", locale.CurrentCountry, locale.Countries, true)
|
||||
@LocalePicker("Language", locale.CurrentLanguage, locale.Languages, true)
|
||||
@LocalePicker("Market", locale.CurrentCountry, locale.Countries, true, false)
|
||||
@LocalePicker("Language", locale.CurrentLanguage, locale.Languages, true, true)
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -67,7 +67,7 @@ templ Layout(title string, cssPath string, jsPath string, menu []pscatalog.MenuI
|
||||
</html>
|
||||
}
|
||||
|
||||
templ LocalePicker(title string, current pscatalog.LocaleOption, options []pscatalog.LocaleOption, navigable bool) {
|
||||
templ LocalePicker(title string, current pscatalog.LocaleOption, options []pscatalog.LocaleOption, navigable bool, showMeta bool) {
|
||||
<details class="locale-picker">
|
||||
<summary class="locale-picker__summary">
|
||||
<span class="locale-picker__value">
|
||||
@@ -77,7 +77,7 @@ templ LocalePicker(title string, current pscatalog.LocaleOption, options []pscat
|
||||
{ title }
|
||||
}
|
||||
</span>
|
||||
if current.Code != "" {
|
||||
if showMeta && current.Code != "" {
|
||||
<span class="locale-picker__code">{ current.Code }</span>
|
||||
}
|
||||
<span class="locale-picker__chevron">⌄</span>
|
||||
@@ -91,16 +91,16 @@ templ LocalePicker(title string, current pscatalog.LocaleOption, options []pscat
|
||||
if navigable && option.URL != "" {
|
||||
<a class={ localeOptionClass(option, current) } href={ option.URL }>
|
||||
<span>{ option.Label }</span>
|
||||
if option.Meta != "" {
|
||||
if showMeta && option.Meta != "" {
|
||||
<span class="locale-picker__item-meta">{ option.Meta }</span>
|
||||
} else if option.Code != "" {
|
||||
} else if showMeta && option.Code != "" {
|
||||
<span class="locale-picker__item-meta">{ option.Code }</span>
|
||||
}
|
||||
</a>
|
||||
} else {
|
||||
<span class={ localeOptionClass(option, current) }>
|
||||
<span>{ option.Label }</span>
|
||||
if option.Meta != "" {
|
||||
if showMeta && option.Meta != "" {
|
||||
<span class="locale-picker__item-meta">{ option.Meta }</span>
|
||||
}
|
||||
</span>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package templates
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
pscatalog "git.ma-al.com/goc_marek/ps_shop/internal/prestashop/catalog"
|
||||
pscookie "git.ma-al.com/goc_marek/ps_shop/internal/prestashop/cookie"
|
||||
)
|
||||
|
||||
func menuListClass(depth int) string {
|
||||
@@ -76,3 +78,21 @@ func menuPanelID(id int64) string {
|
||||
}
|
||||
return "mega-menu-panel-" + strconv.FormatInt(id, 10)
|
||||
}
|
||||
|
||||
func sessionCookieLines(session *pscookie.SessionContext) []string {
|
||||
if session == nil || len(session.Values) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
keys := make([]string, 0, len(session.Values))
|
||||
for key := range session.Values {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
lines := make([]string, 0, len(keys))
|
||||
for _, key := range keys {
|
||||
lines = append(lines, key+"="+session.Values[key])
|
||||
}
|
||||
return lines
|
||||
}
|
||||
|
||||
@@ -92,11 +92,11 @@ func Layout(title string, cssPath string, jsPath string, menu []pscatalog.MenuIt
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = LocalePicker("Market", locale.CurrentCountry, locale.Countries, true).Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = LocalePicker("Market", locale.CurrentCountry, locale.Countries, true, false).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = LocalePicker("Language", locale.CurrentLanguage, locale.Languages, true).Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = LocalePicker("Language", locale.CurrentLanguage, locale.Languages, true, true).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -147,7 +147,7 @@ func Layout(title string, cssPath string, jsPath string, menu []pscatalog.MenuIt
|
||||
})
|
||||
}
|
||||
|
||||
func LocalePicker(title string, current pscatalog.LocaleOption, options []pscatalog.LocaleOption, navigable bool) templ.Component {
|
||||
func LocalePicker(title string, current pscatalog.LocaleOption, options []pscatalog.LocaleOption, navigable bool, showMeta bool) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||
@@ -197,7 +197,7 @@ func LocalePicker(title string, current pscatalog.LocaleOption, options []pscata
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if current.Code != "" {
|
||||
if showMeta && current.Code != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<span class=\"locale-picker__code\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
@@ -292,7 +292,7 @@ func LocalePicker(title string, current pscatalog.LocaleOption, options []pscata
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if option.Meta != "" {
|
||||
if showMeta && option.Meta != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<span class=\"locale-picker__item-meta\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
@@ -310,7 +310,7 @@ func LocalePicker(title string, current pscatalog.LocaleOption, options []pscata
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else if option.Code != "" {
|
||||
} else if showMeta && option.Code != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<span class=\"locale-picker__item-meta\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
@@ -369,7 +369,7 @@ func LocalePicker(title string, current pscatalog.LocaleOption, options []pscata
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if option.Meta != "" {
|
||||
if showMeta && option.Meta != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<span class=\"locale-picker__item-meta\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
|
||||
@@ -52,6 +52,27 @@ templ ProductPage(data viewmodel.ProductPageData, cssPath string, jsPath string)
|
||||
</form>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
if data.Session != nil {
|
||||
<section class="rounded-3xl border border-stone-800 bg-stone-950/80 p-8">
|
||||
<p class="text-xs uppercase tracking-[0.28em] text-stone-500">Go Cookie Debug</p>
|
||||
<div class="mt-6 grid gap-6 lg:grid-cols-2">
|
||||
<div>
|
||||
<p class="text-sm font-semibold text-stone-200">Raw Cookie</p>
|
||||
<pre class="mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-stone-300">{ data.Session.RawCookie }</pre>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm font-semibold text-stone-200">Decoded Values</p>
|
||||
<pre class="mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-stone-300">
|
||||
for _, line := range sessionCookieLines(data.Session) {
|
||||
{ line }
|
||||
{"\n"}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
</main>
|
||||
}
|
||||
|
||||
@@ -229,7 +229,58 @@ func ProductPage(data viewmodel.ProductPageData, cssPath string, jsPath string)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\">Account and login remain on PrestaShop</a></form></aside></section></div></main>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\">Account and login remain on PrestaShop</a></form></aside></section>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if data.Session != nil {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<section class=\"rounded-3xl border border-stone-800 bg-stone-950/80 p-8\"><p class=\"text-xs uppercase tracking-[0.28em] text-stone-500\">Go Cookie Debug</p><div class=\"mt-6 grid gap-6 lg:grid-cols-2\"><div><p class=\"text-sm font-semibold text-stone-200\">Raw Cookie</p><pre class=\"mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-stone-300\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(data.Session.RawCookie)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/product.templ`, Line: 62, Col: 127}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</pre></div><div><p class=\"text-sm font-semibold text-stone-200\">Decoded Values</p><pre class=\"mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-stone-300\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, line := range sessionCookieLines(data.Session) {
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(line)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/product.templ`, Line: 68, Col: 16}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, " ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs("\n")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/product.templ`, Line: 69, Col: 15}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</pre></div></div></section>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</div></main>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user