locations_templ.go 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. // Code generated by templ - DO NOT EDIT.
  2. // templ: version: v0.3.1020
  3. package views
  4. //lint:file-ignore SA4006 This context is only used if a nested component is present.
  5. import "github.com/a-h/templ"
  6. import templruntime "github.com/a-h/templ/runtime"
  7. import (
  8. "code.osinet.fr/fgm/jamtrack/internal/query"
  9. "fmt"
  10. "github.com/pocketbase/pocketbase/core"
  11. )
  12. // LocationList renders the locations management page with an inline add form.
  13. func LocationList(locations []*core.Record) templ.Component {
  14. return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
  15. templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
  16. if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
  17. return templ_7745c5c3_CtxErr
  18. }
  19. templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
  20. if !templ_7745c5c3_IsBuffer {
  21. defer func() {
  22. templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
  23. if templ_7745c5c3_Err == nil {
  24. templ_7745c5c3_Err = templ_7745c5c3_BufErr
  25. }
  26. }()
  27. }
  28. ctx = templ.InitializeContext(ctx)
  29. templ_7745c5c3_Var1 := templ.GetChildren(ctx)
  30. if templ_7745c5c3_Var1 == nil {
  31. templ_7745c5c3_Var1 = templ.NopComponent
  32. }
  33. ctx = templ.ClearChildren(ctx)
  34. templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
  35. templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
  36. templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
  37. if !templ_7745c5c3_IsBuffer {
  38. defer func() {
  39. templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
  40. if templ_7745c5c3_Err == nil {
  41. templ_7745c5c3_Err = templ_7745c5c3_BufErr
  42. }
  43. }()
  44. }
  45. ctx = templ.InitializeContext(ctx)
  46. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"level\"><div class=\"level-left\"><h1 class=\"title\">Locations</h1></div></div><div class=\"columns\"><div class=\"column is-half\">")
  47. if templ_7745c5c3_Err != nil {
  48. return templ_7745c5c3_Err
  49. }
  50. if len(locations) == 0 {
  51. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<p class=\"has-text-grey mb-4\">No locations yet.</p>")
  52. if templ_7745c5c3_Err != nil {
  53. return templ_7745c5c3_Err
  54. }
  55. } else {
  56. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<table class=\"table is-fullwidth is-striped mb-4\"><thead><tr><th>Name</th><th>Notes</th></tr></thead> <tbody>")
  57. if templ_7745c5c3_Err != nil {
  58. return templ_7745c5c3_Err
  59. }
  60. for _, loc := range locations {
  61. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<tr><td><a href=\"")
  62. if templ_7745c5c3_Err != nil {
  63. return templ_7745c5c3_Err
  64. }
  65. var templ_7745c5c3_Var3 templ.SafeURL
  66. templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL("/locations/" + loc.Id))
  67. if templ_7745c5c3_Err != nil {
  68. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 29, Col: 60}
  69. }
  70. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
  71. if templ_7745c5c3_Err != nil {
  72. return templ_7745c5c3_Err
  73. }
  74. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\">")
  75. if templ_7745c5c3_Err != nil {
  76. return templ_7745c5c3_Err
  77. }
  78. var templ_7745c5c3_Var4 string
  79. templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(loc.GetString("name"))
  80. if templ_7745c5c3_Err != nil {
  81. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 29, Col: 86}
  82. }
  83. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
  84. if templ_7745c5c3_Err != nil {
  85. return templ_7745c5c3_Err
  86. }
  87. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</a></td><td>")
  88. if templ_7745c5c3_Err != nil {
  89. return templ_7745c5c3_Err
  90. }
  91. var templ_7745c5c3_Var5 string
  92. templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(loc.GetString("notes"))
  93. if templ_7745c5c3_Err != nil {
  94. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 30, Col: 37}
  95. }
  96. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
  97. if templ_7745c5c3_Err != nil {
  98. return templ_7745c5c3_Err
  99. }
  100. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</td></tr>")
  101. if templ_7745c5c3_Err != nil {
  102. return templ_7745c5c3_Err
  103. }
  104. }
  105. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</tbody></table>")
  106. if templ_7745c5c3_Err != nil {
  107. return templ_7745c5c3_Err
  108. }
  109. }
  110. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<form method=\"POST\" action=\"/locations\"><div class=\"field has-addons\"><div class=\"control is-expanded\"><input class=\"input\" type=\"text\" name=\"name\" placeholder=\"Location name\" required></div><div class=\"control\"><button class=\"button is-primary\" type=\"submit\">Add</button></div></div><div class=\"field\"><div class=\"control\"><input class=\"input\" type=\"text\" name=\"notes\" placeholder=\"Notes (optional)\"></div></div></form></div></div>")
  111. if templ_7745c5c3_Err != nil {
  112. return templ_7745c5c3_Err
  113. }
  114. return nil
  115. })
  116. templ_7745c5c3_Err = Layout("Locations").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
  117. if templ_7745c5c3_Err != nil {
  118. return templ_7745c5c3_Err
  119. }
  120. return nil
  121. })
  122. }
  123. // LocationDetail renders a single location's jam history and per-location ranking.
  124. func LocationDetail(loc *core.Record, jams []*core.Record, ranks []query.SongRank) templ.Component {
  125. return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
  126. templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
  127. if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
  128. return templ_7745c5c3_CtxErr
  129. }
  130. templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
  131. if !templ_7745c5c3_IsBuffer {
  132. defer func() {
  133. templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
  134. if templ_7745c5c3_Err == nil {
  135. templ_7745c5c3_Err = templ_7745c5c3_BufErr
  136. }
  137. }()
  138. }
  139. ctx = templ.InitializeContext(ctx)
  140. templ_7745c5c3_Var6 := templ.GetChildren(ctx)
  141. if templ_7745c5c3_Var6 == nil {
  142. templ_7745c5c3_Var6 = templ.NopComponent
  143. }
  144. ctx = templ.ClearChildren(ctx)
  145. templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
  146. templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
  147. templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
  148. if !templ_7745c5c3_IsBuffer {
  149. defer func() {
  150. templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
  151. if templ_7745c5c3_Err == nil {
  152. templ_7745c5c3_Err = templ_7745c5c3_BufErr
  153. }
  154. }()
  155. }
  156. ctx = templ.InitializeContext(ctx)
  157. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "<h1 class=\"title\">")
  158. if templ_7745c5c3_Err != nil {
  159. return templ_7745c5c3_Err
  160. }
  161. var templ_7745c5c3_Var8 string
  162. templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(loc.GetString("name"))
  163. if templ_7745c5c3_Err != nil {
  164. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 59, Col: 43}
  165. }
  166. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
  167. if templ_7745c5c3_Err != nil {
  168. return templ_7745c5c3_Err
  169. }
  170. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</h1>")
  171. if templ_7745c5c3_Err != nil {
  172. return templ_7745c5c3_Err
  173. }
  174. if loc.GetString("notes") != "" {
  175. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<p class=\"subtitle is-6 has-text-grey\">")
  176. if templ_7745c5c3_Err != nil {
  177. return templ_7745c5c3_Err
  178. }
  179. var templ_7745c5c3_Var9 string
  180. templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(loc.GetString("notes"))
  181. if templ_7745c5c3_Err != nil {
  182. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 61, Col: 66}
  183. }
  184. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
  185. if templ_7745c5c3_Err != nil {
  186. return templ_7745c5c3_Err
  187. }
  188. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</p>")
  189. if templ_7745c5c3_Err != nil {
  190. return templ_7745c5c3_Err
  191. }
  192. }
  193. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " <div class=\"columns\"><div class=\"column\"><h2 class=\"subtitle\">Jams at this location</h2>")
  194. if templ_7745c5c3_Err != nil {
  195. return templ_7745c5c3_Err
  196. }
  197. if len(jams) == 0 {
  198. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<p class=\"has-text-grey\">No jams logged here yet.</p>")
  199. if templ_7745c5c3_Err != nil {
  200. return templ_7745c5c3_Err
  201. }
  202. } else {
  203. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<table class=\"table is-fullwidth is-striped\"><thead><tr><th>Date</th></tr></thead> <tbody>")
  204. if templ_7745c5c3_Err != nil {
  205. return templ_7745c5c3_Err
  206. }
  207. for _, j := range jams {
  208. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<tr><td><a href=\"")
  209. if templ_7745c5c3_Err != nil {
  210. return templ_7745c5c3_Err
  211. }
  212. var templ_7745c5c3_Var10 templ.SafeURL
  213. templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL("/jams/" + j.Id))
  214. if templ_7745c5c3_Err != nil {
  215. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 74, Col: 53}
  216. }
  217. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
  218. if templ_7745c5c3_Err != nil {
  219. return templ_7745c5c3_Err
  220. }
  221. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\">")
  222. if templ_7745c5c3_Err != nil {
  223. return templ_7745c5c3_Err
  224. }
  225. var templ_7745c5c3_Var11 string
  226. templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(dateOnly(j.GetString("date")))
  227. if templ_7745c5c3_Err != nil {
  228. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 74, Col: 87}
  229. }
  230. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
  231. if templ_7745c5c3_Err != nil {
  232. return templ_7745c5c3_Err
  233. }
  234. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "</a></td></tr>")
  235. if templ_7745c5c3_Err != nil {
  236. return templ_7745c5c3_Err
  237. }
  238. }
  239. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</tbody></table>")
  240. if templ_7745c5c3_Err != nil {
  241. return templ_7745c5c3_Err
  242. }
  243. }
  244. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</div><div class=\"column\"><h2 class=\"subtitle\">Practice ranking</h2>")
  245. if templ_7745c5c3_Err != nil {
  246. return templ_7745c5c3_Err
  247. }
  248. if len(ranks) == 0 {
  249. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<p class=\"has-text-grey\">No songs played here yet.</p>")
  250. if templ_7745c5c3_Err != nil {
  251. return templ_7745c5c3_Err
  252. }
  253. } else {
  254. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<table class=\"table is-fullwidth is-striped\"><thead><tr><th>Artist</th><th>Title</th><th class=\"has-text-right\">Played</th></tr></thead> <tbody>")
  255. if templ_7745c5c3_Err != nil {
  256. return templ_7745c5c3_Err
  257. }
  258. for _, r := range ranks {
  259. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<tr><td>")
  260. if templ_7745c5c3_Err != nil {
  261. return templ_7745c5c3_Err
  262. }
  263. var templ_7745c5c3_Var12 string
  264. templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(r.Artist)
  265. if templ_7745c5c3_Err != nil {
  266. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 93, Col: 23}
  267. }
  268. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
  269. if templ_7745c5c3_Err != nil {
  270. return templ_7745c5c3_Err
  271. }
  272. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</td><td>")
  273. if templ_7745c5c3_Err != nil {
  274. return templ_7745c5c3_Err
  275. }
  276. var templ_7745c5c3_Var13 string
  277. templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(r.Title)
  278. if templ_7745c5c3_Err != nil {
  279. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 94, Col: 22}
  280. }
  281. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
  282. if templ_7745c5c3_Err != nil {
  283. return templ_7745c5c3_Err
  284. }
  285. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</td><td class=\"has-text-right\">")
  286. if templ_7745c5c3_Err != nil {
  287. return templ_7745c5c3_Err
  288. }
  289. var templ_7745c5c3_Var14 string
  290. templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprint(r.PlayedCount))
  291. if templ_7745c5c3_Err != nil {
  292. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/locations.templ`, Line: 95, Col: 63}
  293. }
  294. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
  295. if templ_7745c5c3_Err != nil {
  296. return templ_7745c5c3_Err
  297. }
  298. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</td></tr>")
  299. if templ_7745c5c3_Err != nil {
  300. return templ_7745c5c3_Err
  301. }
  302. }
  303. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</tbody></table>")
  304. if templ_7745c5c3_Err != nil {
  305. return templ_7745c5c3_Err
  306. }
  307. }
  308. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</div></div>")
  309. if templ_7745c5c3_Err != nil {
  310. return templ_7745c5c3_Err
  311. }
  312. return nil
  313. })
  314. templ_7745c5c3_Err = Layout(loc.GetString("name")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer)
  315. if templ_7745c5c3_Err != nil {
  316. return templ_7745c5c3_Err
  317. }
  318. return nil
  319. })
  320. }
  321. var _ = templruntime.GeneratedTemplate
PANIC: session(release): write data/sessions/2/6/26706cf4f2eb5f08: no space left on device

PANIC

session(release): write data/sessions/2/6/26706cf4f2eb5f08: no space left on device
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/session@v1.0.3/session.go:204 (0xb13e07)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/context.go:80 (0x967b75)
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/inject@v0.0.0-20200308113650-138e5925c53b/inject.go:157 (0x9512ee)
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/inject@v0.0.0-20200308113650-138e5925c53b/inject.go:135 (0x951205)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/context.go:124 (0x967cc4)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/context.go:114 (0x967bf6)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/recovery.go:161 (0x15baec4)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/logger.go:40 (0x96b257)
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/inject@v0.0.0-20200308113650-138e5925c53b/inject.go:157 (0x9512ee)
/my/cache/.heroku/go/go-path/pkg/mod/github.com/go-macaron/inject@v0.0.0-20200308113650-138e5925c53b/inject.go:135 (0x951205)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/context.go:124 (0x967cc4)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/router.go:187 (0x972959)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/router.go:304 (0x973a01)
/my/cache/.heroku/go/go-path/pkg/mod/gopkg.in/macaron.v1@v1.5.1/macaron.go:218 (0x96c572)
/my/cache/.heroku/go/go1.26.3/go/src/net/http/server.go:3311 (0x85a5cd)
/my/cache/.heroku/go/go1.26.3/go/src/net/http/server.go:2073 (0x837f6f)
/my/cache/.heroku/go/go1.26.3/go/src/runtime/asm_amd64.s:1771 (0x493380)