diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-08 18:48:55 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-08 18:48:55 +0300 |
commit | a20e2ace25c363658d59346358339011fe8ef934 (patch) | |
tree | 0783fc116b2fdcc6928eb82eea63b2073fef2651 /pkg/tpl | |
parent | e849e705c30cceec3cf7336a21bed96c8a911e90 (diff) |
Diffstat (limited to 'pkg/tpl')
-rw-r--r-- | pkg/tpl/layout.templ | 20 | ||||
-rw-r--r-- | pkg/tpl/layout_templ.go | 2 | ||||
-rw-r--r-- | pkg/tpl/list.templ | 6 | ||||
-rw-r--r-- | pkg/tpl/list_templ.go | 8 | ||||
-rw-r--r-- | pkg/tpl/random.templ | 3 | ||||
-rw-r--r-- | pkg/tpl/random_templ.go | 2 |
6 files changed, 19 insertions, 22 deletions
diff --git a/pkg/tpl/layout.templ b/pkg/tpl/layout.templ index d96aa50..40c1b04 100644 --- a/pkg/tpl/layout.templ +++ b/pkg/tpl/layout.templ @@ -21,18 +21,16 @@ templ Layout(params HeaderParams) { </head> <body> <main class="container"> - <nav> - <ul> - <li><a href="/"><strong>ШОргРу</strong></a></li> - </ul> - <ul hx-boost="true" hx-indicator=".loader"> + <div class="header"> + <a href="/"><strong>ШОргРу</strong></a> + <div class="top-menu" hx-boost="true" hx-indicator=".loader"> <span aria-busy="true" class="loader htmx-indicator">Загрузка...</span> - <li><a href="/">Главная</a></li> - <li><a href="/random">Случайные</a></li> - <li><a href="/top">Топ</a></li> - <li><a href="/add">Добавить цитату</a></li> - </ul> - </nav> + <a href="/">Главная</a> + <a href="/random">Рандом</a> + <a href="/top">Топ</a> + <a href="/add">Добавить</a> + </div> + </div> { children... } </main> </body> diff --git a/pkg/tpl/layout_templ.go b/pkg/tpl/layout_templ.go index 10b0bfc..b394b79 100644 --- a/pkg/tpl/layout_templ.go +++ b/pkg/tpl/layout_templ.go @@ -68,7 +68,7 @@ func Layout(params HeaderParams) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><meta name=\"yandex-verification\" content=\"ee0e23da00ce9fe4\"><title>ШОргРу</title></head><body><main class=\"container\"><nav><ul><li><a href=\"/\"><strong>ШОргРу</strong></a></li></ul><ul hx-boost=\"true\" hx-indicator=\".loader\"><span aria-busy=\"true\" class=\"loader htmx-indicator\">Загрузка...</span><li><a href=\"/\">Главная</a></li><li><a href=\"/random\">Случайные</a></li><li><a href=\"/top\">Топ</a></li><li><a href=\"/add\">Добавить цитату</a></li></ul></nav>") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><meta name=\"yandex-verification\" content=\"ee0e23da00ce9fe4\"><title>ШОргРу</title></head><body><main class=\"container\"><div class=\"header\"><a href=\"/\"><strong>ШОргРу</strong></a><div class=\"top-menu\" hx-boost=\"true\" hx-indicator=\".loader\"><span aria-busy=\"true\" class=\"loader htmx-indicator\">Загрузка...</span> <a href=\"/\">Главная</a> <a href=\"/random\">Рандом</a> <a href=\"/top\">Топ</a> <a href=\"/add\">Добавить</a></div></div>") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pkg/tpl/list.templ b/pkg/tpl/list.templ index 014a2db..daf7ad8 100644 --- a/pkg/tpl/list.templ +++ b/pkg/tpl/list.templ @@ -22,7 +22,7 @@ templ List(quotes []model.Quote, page, count int) { <nav> <ul hx-boost="true" hx-indicator=".loader"> if page > 0 { - <li><a href={ templ.URL(fmt.Sprintf("/?page=%d", page-1)) }>←</a></li> + <li><a href={ templ.URL(fmt.Sprintf("?page=%d", page-1)) }>←</a></li> } for _, p := range generatePagination(page, count/20) { if p == "..." { @@ -30,12 +30,12 @@ templ List(quotes []model.Quote, page, count int) { } else if p == strconv.Itoa(page) { <li>[{ p }]</li> } else { - <li><a href={ templ.URL(fmt.Sprintf("/?page=%s", p)) }>{ p }</a></li> + <li><a href={ templ.URL(fmt.Sprintf("?page=%s", p)) }>{ p }</a></li> } } if page < count/20 { - <li><a href={ templ.URL(fmt.Sprintf("/?page=%d", page+1)) }>→</a></li> + <li><a href={ templ.URL(fmt.Sprintf("?page=%d", page+1)) }>→</a></li> } </ul> </nav> diff --git a/pkg/tpl/list_templ.go b/pkg/tpl/list_templ.go index 2ed9497..7cb3705 100644 --- a/pkg/tpl/list_templ.go +++ b/pkg/tpl/list_templ.go @@ -65,7 +65,7 @@ func List(quotes []model.Quote, page, count int) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var3 templ.SafeURL = templ.URL(fmt.Sprintf("/?page=%d", page-1)) + var templ_7745c5c3_Var3 templ.SafeURL = templ.URL(fmt.Sprintf("?page=%d", page-1)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3))) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -104,7 +104,7 @@ func List(quotes []model.Quote, page, count int) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var5 templ.SafeURL = templ.URL(fmt.Sprintf("/?page=%s", p)) + var templ_7745c5c3_Var5 templ.SafeURL = templ.URL(fmt.Sprintf("?page=%s", p)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var5))) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -116,7 +116,7 @@ func List(quotes []model.Quote, page, count int) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(p) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/tpl/list.templ`, Line: 33, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/tpl/list.templ`, Line: 33, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -133,7 +133,7 @@ func List(quotes []model.Quote, page, count int) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var7 templ.SafeURL = templ.URL(fmt.Sprintf("/?page=%d", page+1)) + var templ_7745c5c3_Var7 templ.SafeURL = templ.URL(fmt.Sprintf("?page=%d", page+1)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7))) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err diff --git a/pkg/tpl/random.templ b/pkg/tpl/random.templ index 2d25a03..d0dd7a0 100644 --- a/pkg/tpl/random.templ +++ b/pkg/tpl/random.templ @@ -22,12 +22,11 @@ templ Random(quotes []model.Quote) { hx-get="/random" hx-swap="outerHTML" hx-select="#random" - hx-target="#random" hx-indicator="#loader" > Загрузить ещё... </a> - <span aria-busy="true" id="loader" class="htmx-indicator">Загрузка...</span> </div> + <span aria-busy="true" id="loader" class="htmx-indicator">Загрузка...</span> } } diff --git a/pkg/tpl/random_templ.go b/pkg/tpl/random_templ.go index 803bf22..2f4ccc8 100644 --- a/pkg/tpl/random_templ.go +++ b/pkg/tpl/random_templ.go @@ -58,7 +58,7 @@ func Random(quotes []model.Quote) templ.Component { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a role=\"button\" hx-get=\"/random\" hx-swap=\"outerHTML\" hx-select=\"#random\" hx-target=\"#random\" hx-indicator=\"#loader\">Загрузить ещё...</a> <span aria-busy=\"true\" id=\"loader\" class=\"htmx-indicator\">Загрузка...</span></div>") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a role=\"button\" hx-get=\"/random\" hx-swap=\"outerHTML\" hx-select=\"#random\" hx-indicator=\"#loader\">Загрузить ещё...</a></div><span aria-busy=\"true\" id=\"loader\" class=\"htmx-indicator\">Загрузка...</span>") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } |