Compare commits
No commits in common. "5733d3af9f330d0613ab07caf1c12a1ca1e6f1c8" and "cd5ff71df4db487889955611e3e46474a665335d" have entirely different histories.
5733d3af9f
...
cd5ff71df4
@ -1,8 +0,0 @@
|
||||
package bulma
|
||||
|
||||
// Simple spacer that accepts children
|
||||
templ Block() {
|
||||
<div class="block">
|
||||
{ children... }
|
||||
</div>
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package example
|
||||
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/html"
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout"
|
||||
|
||||
templ example() {
|
||||
@html.Doctype()
|
||||
@html.New("en"){
|
||||
@html.NewHeader(){
|
||||
@bulma.UseBulmaCdn()
|
||||
}
|
||||
@html.NewBody() {
|
||||
@layout.Container(bulma.BreakpointDefault) {
|
||||
{ children... }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
package example
|
@ -1,10 +1,6 @@
|
||||
package form
|
||||
|
||||
templ TextInput(id, fieldType, placeholder string) {
|
||||
<input class={ "input" } name={ id } id={ id } type={ fieldType } placeholder={ placeholder }/>
|
||||
}
|
||||
|
||||
templ TextInputColor(color, id, fieldType, placeholder string) {
|
||||
templ TextInput(color, id, fieldType, placeholder string) {
|
||||
if color == "" {
|
||||
<input class={ "input" } name={ id } id={ id } type={ fieldType } placeholder={ placeholder }/>
|
||||
} else {
|
||||
|
10
components/bulma/hero.templ
Normal file
10
components/bulma/hero.templ
Normal file
@ -0,0 +1,10 @@
|
||||
package bulma
|
||||
|
||||
templ Hero(title, subtitle string) {
|
||||
<section class="hero">
|
||||
<div class="hero-body">
|
||||
<p class="title">{ title }</p>
|
||||
<p class="subtitle">{ subtitle }</p>
|
||||
</div>
|
||||
</section>
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package html
|
||||
|
||||
templ Doctype() {
|
||||
<!DOCTYPE html>
|
||||
}
|
||||
|
||||
// Creates <html> that accepts children
|
||||
templ New(lang string) {
|
||||
<html lang={ lang }>
|
||||
{ children... }
|
||||
</html>
|
||||
}
|
||||
|
||||
// Creates <head> that accepts children
|
||||
templ NewHeader() {
|
||||
<head>
|
||||
{ children... }
|
||||
</head>
|
||||
}
|
||||
|
||||
// Creates <body> that accepts children
|
||||
templ NewBody() {
|
||||
<body>
|
||||
{ children... }
|
||||
</body>
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package layout
|
||||
|
||||
templ Container(breakpoint string) {
|
||||
<div class={ "container", breakpoint }>
|
||||
{ children... }
|
||||
</div>
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package layout
|
||||
|
||||
templ Hero(title, subtitle string) {
|
||||
<section class="hero">
|
||||
<div class="hero-body">
|
||||
<p class="title">{ title }</p>
|
||||
<p class="subtitle">{ subtitle }</p>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
|
||||
templ HeroSize(title, subtitle, size string) {
|
||||
<section class={ "hero", size }>
|
||||
<div class="hero-body">
|
||||
<p class="title">{ title }</p>
|
||||
<p class="subtitle">{ subtitle }</p>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
|
||||
templ HeroColor(title, subtitle, color string) {
|
||||
<section class={ "hero", color }>
|
||||
<div class="hero-body">
|
||||
<p class="title">{ title }</p>
|
||||
<p class="subtitle">{ subtitle }</p>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
|
||||
templ HeroColorSize(title, subtitle, color, size string) {
|
||||
<section class={ "hero", color, size }>
|
||||
<div class="hero-body">
|
||||
<p class="title">{ title }</p>
|
||||
<p class="subtitle">{ subtitle }</p>
|
||||
</div>
|
||||
</section>
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package bulma
|
||||
|
||||
// Creates a <section> object thats good to break up a page of content.
|
||||
templ Section(title, subtitle string) {
|
||||
<section class="section">
|
||||
<h1 class="title">{ title }</h1>
|
||||
<h2 class="subtitle">{ subtitle }</h2>
|
||||
</section>
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package bulma
|
||||
|
||||
templ UseBulmaCdn() {
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.1/css/bulma.min.css"/>
|
||||
}
|
11
components/bulma/section.templ
Normal file
11
components/bulma/section.templ
Normal file
@ -0,0 +1,11 @@
|
||||
package bulma
|
||||
|
||||
templ Section(title, subtitle string) {
|
||||
<section class="section">
|
||||
<h1 class="title">Section</h1>
|
||||
<h2 class="subtitle">
|
||||
A simple container to divide your page into <strong>sections</strong>, like
|
||||
the one you're currently reading.
|
||||
</h2>
|
||||
</section>
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package bulma
|
||||
|
||||
// Creates a <table> that accepts children
|
||||
templ Table(){
|
||||
<table class="table">
|
||||
{ children... }
|
||||
</table>
|
||||
}
|
||||
|
||||
// Creates a <thead> that accepts children.
|
||||
templ TableHeader() {
|
||||
<thead>{ children... }</thead>
|
||||
}
|
||||
|
||||
// Creates a <tf> that accepts children.
|
||||
templ TableRow() {
|
||||
<tr>{ children... }</tr>
|
||||
}
|
||||
|
||||
// Creates a <th> and writes the given value
|
||||
templ TableHeaderData(value string) {
|
||||
<th>{ value }</th>
|
||||
}
|
||||
|
||||
// Creates a <th> that allows you to also add a tooltip value
|
||||
templ TableHeaderDataToolTip(value, tooltip string) {
|
||||
<th><abbr title={ tooltip }>{ value }</abbr></th>
|
||||
}
|
||||
|
||||
// Creates a <td> that accepts children.
|
||||
templ TableDataChildren() {
|
||||
<td>{ children... }</td>
|
||||
}
|
||||
|
||||
templ TableData(value string) {
|
||||
<td>{ value }</td>
|
||||
}
|
@ -11,10 +11,4 @@ const (
|
||||
SizeNormal = "is-normal"
|
||||
SizeMedium = "is-medium"
|
||||
SizeLarge = "is-large"
|
||||
|
||||
BreakpointDefault = ""
|
||||
BreakpointWidescreen = "is-widescreen"
|
||||
BreakpointFullHd = "is-fullhd"
|
||||
BreakpointMaxDesktop = "is-max-desktop"
|
||||
BreakpointMaxWidescreen = "is-max-widescreen"
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package html
|
||||
package templhtml
|
||||
|
||||
templ Br(){
|
||||
<br/>
|
@ -1,4 +1,4 @@
|
||||
package html
|
||||
package templhtml
|
||||
|
||||
templ ALink(url, title string) {
|
||||
<a href={ templ.SafeURL(url) }>{ title }</a>
|
@ -36,5 +36,5 @@ func (h *Handler) ArticlesList(c echo.Context) error {
|
||||
|
||||
}
|
||||
|
||||
return Render(c, http.StatusOK, articles.ListArticlesTable(vm))
|
||||
return Render(c, http.StatusOK, articles.List(vm))
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
package home
|
||||
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
|
||||
templ About() {
|
||||
@layout.WithTemplate(){
|
||||
@bulma.Title("About this project")
|
||||
@bulma.Block() {
|
||||
<h1 class="title"> About this project</h1>
|
||||
|
||||
<section class="section">
|
||||
Newsbot started a small project to send out notifications to discord servers.
|
||||
I wanted to be able to keep the small communitiy aware of new posts about a game we all played.
|
||||
That feature still exists because I think that keeping a communitiy aware and engaged is important and not everyone follows the same news.
|
||||
}
|
||||
</section>
|
||||
}
|
||||
}
|
@ -1,27 +1,32 @@
|
||||
package home
|
||||
|
||||
import (
|
||||
b "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout"
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
)
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
|
||||
templ Index() {
|
||||
@layout.WithTemplate() {
|
||||
@bl.Hero("Welcome to Newsbot!", "Your new home for your news.")
|
||||
@b.Block() {
|
||||
News bot is a self hostable solution to aggregating your news.
|
||||
You can run `Newsbot` as an API or interact with it with this site.
|
||||
}
|
||||
@b.H2("Why Newsbot", false)
|
||||
@b.Block() {
|
||||
I started to build this tool to help me avoid sitting on the big platform websites.
|
||||
I wanted a tool that would work for me, not them.
|
||||
This tool started as a notification system that would let me redirect RSS posts over to Discord servers.
|
||||
It still has those roots but now its starting to scale up to a full Aggregation platform.
|
||||
}
|
||||
@b.Block() {
|
||||
This project is a passion project of mine as I
|
||||
}
|
||||
@bulma.Hero("Welcome to Newsbot!", "Your new home for your news.")
|
||||
|
||||
<section class="section">
|
||||
<p>
|
||||
News bot is a self hostable solution to aggregating your news.
|
||||
You can run `Newsbot` as an API or interact with it with this site.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
|
||||
<div class="block">
|
||||
<h2 class="title">Why Newsbot</h2>
|
||||
I started to build this tool to help me avoid sitting on the big platform websites.
|
||||
I wanted a tool that would work for me, not them.
|
||||
|
||||
This tool started as a notification system that would let me redirect RSS posts over to Discord servers.
|
||||
It still has those roots but now its starting to scale up to a full Aggregation platform.
|
||||
|
||||
</div>
|
||||
<p>
|
||||
This project is a passion project of mine as I
|
||||
</p>
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package layout
|
||||
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
|
||||
templ header() {
|
||||
@bulma.UseBulmaCdn()
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css"/>
|
||||
<link rel="stylesheet" href="/css/main.css"/>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.11" integrity="sha384-0gxUXCCR8yv9FM2b+U3FDbsKthCI66oH5IA9fHppQq9DDMHuMauqq1ZHBpJxQ0J0" crossorigin="anonymous"></script>
|
||||
<meta charset="utf-8"/>
|
||||
|
@ -2,28 +2,25 @@ package sources
|
||||
|
||||
import (
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
bf "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/form"
|
||||
bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout"
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/form"
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
)
|
||||
|
||||
var (
|
||||
p = bf.NewParam{
|
||||
p = form.NewParam{
|
||||
HxPost: "/sources/add",
|
||||
}
|
||||
)
|
||||
|
||||
templ Add(model models.AddSourcePayloadModel) {
|
||||
@layout.WithTemplate() {
|
||||
@bl.Hero("New Source", "")
|
||||
@bulma.Block() {
|
||||
At this time only direct RSS links are allowed to be provided.
|
||||
}
|
||||
@bf.New(p) {
|
||||
@bf.TextInput("name", bf.InputTypeText, "Name of the site")
|
||||
@bf.TextInput("url", bf.InputTypeText, "RSS URL")
|
||||
@bf.Submit("Submit", bulma.ColorPrimary)
|
||||
@bulma.H2("New Source", false)
|
||||
<p>At this time only direct RSS links are allowed to be provided.</p>
|
||||
@form.New(p) {
|
||||
@form.TextInput("", "name", form.InputTypeText, "Name of the site")
|
||||
@form.TextInput("", "url", form.InputTypeText, "RSS URL")
|
||||
@form.Submit("Submit", bulma.ColorPrimary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package sources
|
||||
|
||||
import (
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
bh "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/html"
|
||||
templhtml "git.jamestombleson.com/jtom38/newsbot-portal/components/templ-html"
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
)
|
||||
@ -10,10 +10,10 @@ import (
|
||||
templ ListAll(model models.ListAllSourcesViewModel) {
|
||||
@layout.WithTemplate() {
|
||||
@bulma.Button() {
|
||||
@bh.ALink("/sources/add", "New Source")
|
||||
@templhtml.ALink("/sources/add", "New Source")
|
||||
}
|
||||
@bh.Br()
|
||||
@bh.Br()
|
||||
@templhtml.Br()
|
||||
@templhtml.Br()
|
||||
for _, item := range model.Items {
|
||||
@bulma.ButtonColor(bulma.ColorPrimary) {
|
||||
@bulma.ANewTab(item.Url, item.DisplayName)
|
||||
|
@ -17,13 +17,13 @@ templ LoginNew() {
|
||||
@form.Field() {
|
||||
@form.Label("Username")
|
||||
@form.Control() {
|
||||
@form.TextInput("username", "text", "email address")
|
||||
@form.TextInput("", "username", "text", "email address")
|
||||
}
|
||||
}
|
||||
@form.Field() {
|
||||
@form.Label("Password")
|
||||
@form.Control() {
|
||||
@form.TextInput("password", form.InputTypePassword, "")
|
||||
@form.TextInput("", "password", form.InputTypePassword, "")
|
||||
}
|
||||
}
|
||||
@form.Submit("Submit", "is-primary")
|
||||
|
@ -1,10 +1,10 @@
|
||||
package users
|
||||
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
import bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout"
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
|
||||
templ Logout() {
|
||||
@layout.WithTemplate(){
|
||||
@bl.Hero("You are out of here!", "Please login again when you are ready.")
|
||||
@bulma.Hero("You are out of here!", "Please login again when you are ready.")
|
||||
}
|
||||
}
|
@ -2,18 +2,17 @@ package users
|
||||
|
||||
import (
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
||||
bh "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/html"
|
||||
bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout"
|
||||
templhtml "git.jamestombleson.com/jtom38/newsbot-portal/components/templ-html"
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
)
|
||||
|
||||
templ Profile() {
|
||||
@layout.WithTemplate() {
|
||||
@bl.Hero("Profile", "Here you can update your profile 😀")
|
||||
@bulma.Hero("Profile", "Here you can update your profile 😀")
|
||||
|
||||
@bulma.H2("Sessions", false)
|
||||
@bulma.Button() {
|
||||
@bh.ALink("/users/forcelogout", "Terminate all active sessions")
|
||||
@templhtml.ALink("/users/forcelogout", "Terminate all active sessions")
|
||||
}
|
||||
@bulma.Subitle("This will force you to login again as the application will give you a new session value.")
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ templ SignUp() {
|
||||
@form.Field(){
|
||||
@form.Label("Username")
|
||||
@form.Control() {
|
||||
@form.TextInput("username", form.InputTypeText, "username or email address")
|
||||
@form.TextInput("", "username", form.InputTypeText, "username or email address")
|
||||
}
|
||||
}
|
||||
@form.Field() {
|
||||
@form.Label("Password")
|
||||
@form.Control() {
|
||||
@form.TextInput("password", form.InputTypePassword, "Nice strong password, like Ox!")
|
||||
@form.TextInput("", "password", form.InputTypePassword, "Nice strong password, like Ox!")
|
||||
}
|
||||
}
|
||||
@form.Submit("Submit", "")
|
||||
|
Loading…
Reference in New Issue
Block a user