features/templ-components #3

Merged
jtom38 merged 17 commits from features/templ-components into main 2024-07-13 10:40:28 -07:00
2 changed files with 20 additions and 6 deletions
Showing only changes of commit b6a6bb0043 - Show all commits

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/>
} }
} }