go is compiling now
This commit is contained in:
parent
ad33524742
commit
2020e47053
3 changed files with 5 additions and 10 deletions
|
|
@ -5,8 +5,8 @@ go 1.23.0
|
||||||
require (
|
require (
|
||||||
github.com/gofiber/fiber/v2 v2.52.5
|
github.com/gofiber/fiber/v2 v2.52.5
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/maddalax/mhtml/framework v0.0.0-20240913172412-f46749837a6f
|
github.com/maddalax/mhtml/framework v0.0.0-20240913172653-23dd1db77843
|
||||||
github.com/maddalax/mhtml/framework-ui v0.0.0-20240913172653-23dd1db77843
|
github.com/maddalax/mhtml/framework-ui v0.0.0-20240913172832-ad335247426d
|
||||||
github.com/redis/go-redis/v9 v9.6.1
|
github.com/redis/go-redis/v9 v9.6.1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,13 @@ package partials
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/maddalax/mhtml/framework-ui/ui"
|
||||||
"github.com/maddalax/mhtml/framework/h"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
"github.com/maddalax/mhtml/starter-template/news"
|
"github.com/maddalax/mhtml/starter-template/news"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewsSheet(ctx *fiber.Ctx) *h.Partial {
|
func NewsSheet(ctx *fiber.Ctx) *h.Partial {
|
||||||
open := h.GetQueryParam(ctx, "open") == "true"
|
open := h.GetQueryParam(ctx, "open") == "true"
|
||||||
if open {
|
|
||||||
h.SessionIncr(ctx, "sheet-open-count")
|
|
||||||
}
|
|
||||||
return h.NewPartialWithHeaders(
|
return h.NewPartialWithHeaders(
|
||||||
&map[string]string{
|
&map[string]string{
|
||||||
"hx-trigger": "sheetOpened",
|
"hx-trigger": "sheetOpened",
|
||||||
|
|
@ -26,17 +24,13 @@ func NewsSheet(ctx *fiber.Ctx) *h.Partial {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewsSheetOpenCount(ctx *fiber.Ctx) *h.Partial {
|
func NewsSheetOpenCount(ctx *fiber.Ctx) *h.Partial {
|
||||||
rnd := h.SessionGet[int64](ctx, "sheet-open-count")
|
|
||||||
if rnd == nil {
|
|
||||||
rnd = new(int64)
|
|
||||||
}
|
|
||||||
|
|
||||||
open := h.GetQueryParam(ctx, "open") == "true"
|
open := h.GetQueryParam(ctx, "open") == "true"
|
||||||
|
|
||||||
return h.NewPartial(h.Div(
|
return h.NewPartial(h.Div(
|
||||||
h.Id("sheet-open-count"),
|
h.Id("sheet-open-count"),
|
||||||
h.IfElse(open,
|
h.IfElse(open,
|
||||||
h.Text(fmt.Sprintf("you opened sheet %d times", *rnd)),
|
h.Text(fmt.Sprintf("you opened sheet %d times", 1)),
|
||||||
h.Text("sheet is not open")),
|
h.Text("sheet is not open")),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package patient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/maddalax/mhtml/framework-ui/ui"
|
||||||
"github.com/maddalax/mhtml/framework/h"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
"github.com/maddalax/mhtml/starter-template/features/patient"
|
"github.com/maddalax/mhtml/starter-template/features/patient"
|
||||||
"github.com/maddalax/mhtml/starter-template/partials/sheet"
|
"github.com/maddalax/mhtml/starter-template/partials/sheet"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue