playing with more components

This commit is contained in:
James Tombleson 2024-07-09 08:33:15 -07:00
parent d1f72aa0f1
commit b6a6bb0043
2 changed files with 20 additions and 6 deletions

View File

@ -1,10 +1,19 @@
package sources package sources
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" import (
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/models" "git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/bulma"
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/bulma/form"
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
)
templ Add(model models.AddSourcePayloadModel) { templ Add(model models.AddSourcePayloadModel) {
@layout.WithTemplate() { @layout.WithTemplate() {
<form hx-post="/sources/add"></form> <h2>New Source</h2>
<p>At this time only direct RSS links are allowed to be provided</p>
@form.New("/sources/add") {
@form.Input("", "url", "text")
@form.Submit("Submit", bulma.ColorPrimary)
}
} }
} }

View File

@ -1,12 +1,17 @@
package sources package sources
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" import (
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/models" "git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/bulma"
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
)
templ ListAll(model models.ListAllSourcesViewModel) { templ ListAll(model models.ListAllSourcesViewModel) {
@layout.WithTemplate() { @layout.WithTemplate() {
for _, item := range model.Items { for _, item := range model.Items {
<a href={ templ.SafeURL(item.Url) } target="_blank" rel="noopener noreferrer">{ item.DisplayName } - { item.Source } </a> @bulma.Button(bulma.ColorPrimary, false, false) {
@bulma.ANewTab(item.Url, item.DisplayName)
}
<br/> <br/>
} }
} }