features/templ-components #3
@ -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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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/>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user