Skip to content

Patched a bug with WrittenContent popovers and added popovers to Art Forms#29

Open
uptudev wants to merge 3 commits intorobertjanetzko:masterfrom
uptudev:patch-popovers
Open

Patched a bug with WrittenContent popovers and added popovers to Art Forms#29
uptudev wants to merge 3 commits intorobertjanetzko:masterfrom
uptudev:patch-popovers

Conversation

@uptudev
Copy link
Copy Markdown
Contributor

@uptudev uptudev commented Jun 20, 2025

Noticed a bug with the popovers on Written Content, and went ahead and implemented popovers on Dance, Musical, and Poetic Forms while I was at it. Currently the Art Form popovers do not highlight the author civilization or historical figure, as I would likely need to do something way more intensive to retain that information; it isn't kept in the XML files, sadly. Currently it trims some words from the first sentence of the Art Form's description.

Bug Details (Fixed in PR)

When hovering over an object of the type WrittenContent, instead of the intended popover displaying, the server panics and logs a message to the console about popoverWrittencontent.html being missing; the correct file is popoverWrittenContent.html (with a capital 'C').

Changelog

Fixed WrittenContent popover bug

  • Modified: server/server.go - Fixed the typo which caused the above webserver panic.

Implemented popovers for Art Forms

  • Modified: model/model.go - Added method on art form structs to get the short description; simply calls ArtFormShortDesc() in util/util.go.
  • Modified: server/server.go - Added routing for new popover HTML.
  • Modified: templates/layout.html - Added popover script to objects of art form type.
  • Created: templates/popoverDanceForm.html - Added popover HTML for Dance Forms
  • Created: templates/popoverMusicalForm.html - Added popover HTML for Musical Forms
  • Created: templates/popoverPoeticForm.html - Added popover HTML for Poetic Forms
  • Modified: util/util.go - Added a function to get the short description for Art Forms from the XML description.

uptudev added 3 commits June 20, 2025 00:43
* `server/server.go` - Fixed a small typo which caused a panic upon
  hovering over a WrittenContent entity, which would attempt to load
  `templates/popoverWrittencontent.html` instead of `templates/popoverWrittenContent.html`.
* `model/model.go` - Added method on art form structs to get the short
  description; simply calls `ArtFormShortDesc()` in `util/util.go`.

* `server/server.go` - Added routing for new popover HTML.

* `templates/layout.html` - Added popover script to objects of art form
  type.

+ `templates/popoverDanceForm.html` - Added popover HTML for Dance Forms

+ `templates/popoverMusicalForm.html` - Added popover HTML for Musical Forms

+ `templates/popoverPoeticForm.html` - Added popover HTML for Poetic Forms

* `util/util.go` - Added a function to get the short description for Art
  Forms from the XML description.
* **Modified**: `util/util.go` - Accidentally left the index offset in
  from when the whole first sentence was returned during prototyping;
  fixed.
@uptudev
Copy link
Copy Markdown
Contributor Author

uptudev commented Jun 21, 2025

Here is an example of the error affecting the master branch regarding WrittenContent objects:

2025/06/21 14:31:18 http: panic serving 127.0.0.1:36074: template: pattern matches no files: `popoverWrittencontent.html`
goroutine 262 [running]:
net/http.(*conn).serve.func1()
	/usr/lib/go/src/net/http/server.go:1947 +0xbe
panic({0x9db620?, 0xc0029b2e90?})
	/usr/lib/go/src/runtime/panic.go:792 +0x132
html/template.Must(...)
	/usr/lib/go/src/html/template/template.go:368
github.com/robertjanetzko/LegendsBrowser2/backend/templates.(*Template).Render(0x11b6d80?, {0xd54680, 0xc00188a700}, {0xaa7ae2, 0x1a}, {0xa2cde0, 0xc0016a1780})
	/home/uptu/dev/LegendsBrowser2/backend/templates/templates.go:42 +0x18e
github.com/robertjanetzko/LegendsBrowser2/backend/server.(*DfServer).RegisterWorldPage.func1({0xd58f10, 0xc00188a700}, 0xc002774f00)
	/home/uptu/dev/LegendsBrowser2/backend/server/resource.go:32 +0x325
net/http.HandlerFunc.ServeHTTP(0xc002774dc0?, {0xd58f10?, 0xc00188a700?}, 0x7f37c04b86a0?)
	/usr/lib/go/src/net/http/server.go:2294 +0x29
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000de0c0, {0xd58f10, 0xc00188a700}, 0xc002952640)
	/home/uptu/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1e2
net/http.serverHandler.ServeHTTP({0xc002aa72f0?}, {0xd58f10?, 0xc00188a700?}, 0x6?)
	/usr/lib/go/src/net/http/server.go:3301 +0x8e
net/http.(*conn).serve(0xc0017fd200, {0xd5a3f8, 0xc0002f57d0})
	/usr/lib/go/src/net/http/server.go:2102 +0x625
created by net/http.(*Server).Serve in goroutine 1
	/usr/lib/go/src/net/http/server.go:3454 +0x485

@uptudev
Copy link
Copy Markdown
Contributor Author

uptudev commented Jun 21, 2025

Here's an example of one of the Art Form popovers:

Screenshot of Art Form popover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant