Adding a table view for articles
This commit is contained in:
parent
9eb97d892f
commit
175a42f58c
32
internal/views/articles/table.templ
Normal file
32
internal/views/articles/table.templ
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package articles
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||||
|
"git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||||
|
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||||
|
)
|
||||||
|
|
||||||
|
templ ListArticlesTable(model models.ListArticlesViewModel) {
|
||||||
|
@layout.WithTemplate() {
|
||||||
|
@bulma.Table() {
|
||||||
|
@bulma.TableHeader() {
|
||||||
|
@bulma.TableRow() {
|
||||||
|
@bulma.TableHeaderData("Title")
|
||||||
|
@bulma.TableHeaderData("Source")
|
||||||
|
@bulma.TableHeaderData("View")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, item := range model.Items {
|
||||||
|
@bulma.TableRow() {
|
||||||
|
@bulma.TableData(item.Article.Title)
|
||||||
|
@bulma.TableData(item.Source.DisplayName)
|
||||||
|
@bulma.TableDataChildren() {
|
||||||
|
@bulma.Button() {
|
||||||
|
@bulma.ANewTab(item.Article.Url, "View")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user