Compare commits
No commits in common. "209a28501cf1112255575e741808b4a00d1a0fe9" and "6cc21192b122c3b15968a22ad753483cdf03000e" have entirely different histories.
209a28501c
...
6cc21192b1
@ -16,7 +16,6 @@ const (
|
|||||||
type Sources interface {
|
type Sources interface {
|
||||||
ListAll(jwt string, page int) (domain.SourcesResponse, error)
|
ListAll(jwt string, page int) (domain.SourcesResponse, error)
|
||||||
GetById(jwt string, id int64) (domain.SourcesResponse, error)
|
GetById(jwt string, id int64) (domain.SourcesResponse, error)
|
||||||
NewRss(jwt, name, url, sourceType string) (domain.SourcesResponse, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type sourceClient struct {
|
type sourceClient struct {
|
||||||
@ -54,7 +53,7 @@ func (c sourceClient) ListAll(jwt string, page int) (domain.SourcesResponse, err
|
|||||||
return bind, err
|
return bind, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if (resp.StatusCode != 200) {
|
||||||
return bind, errors.New(bind.Message)
|
return bind, errors.New(bind.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,33 +69,9 @@ func (c sourceClient) GetById(jwt string, id int64) (domain.SourcesResponse, err
|
|||||||
return bind, err
|
return bind, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if statusCode != 200 {
|
if (statusCode != 200) {
|
||||||
return bind, errors.New(bind.Message)
|
return bind, errors.New(bind.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bind, nil
|
return bind, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c sourceClient) NewRss(jwt, name, url, sourceType string) (domain.SourcesResponse, error) {
|
|
||||||
param := domain.NewSourceParamRequest{
|
|
||||||
Name: name,
|
|
||||||
Url: url,
|
|
||||||
Tags: "",
|
|
||||||
}
|
|
||||||
bind := domain.SourcesResponse{}
|
|
||||||
var endpoint string
|
|
||||||
if sourceType == domain.SourceCollectorRss {
|
|
||||||
endpoint = fmt.Sprintf("%s/%s/new/rss", c.serverAddress, SourcesBaseRoute)
|
|
||||||
}
|
|
||||||
|
|
||||||
statusCode, err := PostBodyUrlAuthorized(c.client, endpoint, jwt, param, &bind)
|
|
||||||
if err != nil {
|
|
||||||
return bind, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if statusCode != 200 {
|
|
||||||
return bind, errors.New("got the wrong status code back from the API")
|
|
||||||
}
|
|
||||||
|
|
||||||
return bind, nil
|
|
||||||
}
|
|
||||||
|
@ -58,35 +58,6 @@ func PostUrlAuthorized(client http.Client, endpoint, jwtToken string, t any) err
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func PostBodyUrlAuthorized(client http.Client, endpoint, jwtToken string, body any, t any) (int, error) {
|
|
||||||
jsonBody, err := json.Marshal(body)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
req, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewBuffer(jsonBody))
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
req.Header.Add(HeaderAuthorization, fmt.Sprintf("%s %s", "Bearer", jwtToken))
|
|
||||||
req.Header.Add(HeaderContentType, ApplicationJson)
|
|
||||||
|
|
||||||
//response, err := http.Post(endpoint, ApplicationJson, bytes.NewBuffer(jsonBody))
|
|
||||||
response, err := client.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
return response.StatusCode, err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer response.Body.Close()
|
|
||||||
decoder := json.NewDecoder(response.Body)
|
|
||||||
err = decoder.Decode(&t)
|
|
||||||
if err != nil {
|
|
||||||
return response.StatusCode, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return response.StatusCode, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func PostBodyUrl(client http.Client, endpoint string, body any, t any) error {
|
func PostBodyUrl(client http.Client, endpoint string, body any, t any) error {
|
||||||
jsonBody, err := json.Marshal(body)
|
jsonBody, err := json.Marshal(body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -108,22 +79,6 @@ func PostBodyUrl(client http.Client, endpoint string, body any, t any) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func PostQuery(client http.Client, endpoint string, t any) (int, error) {
|
|
||||||
response, err := http.Post(endpoint, ApplicationJson, nil)
|
|
||||||
if err != nil {
|
|
||||||
return response.StatusCode, err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer response.Body.Close()
|
|
||||||
decoder := json.NewDecoder(response.Body)
|
|
||||||
err = decoder.Decode(&t)
|
|
||||||
if err != nil {
|
|
||||||
return response.StatusCode, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return response.StatusCode, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Get(client http.Client, endpoint, jwt string, t any) (int, error) {
|
func Get(client http.Client, endpoint, jwt string, t any) (int, error) {
|
||||||
req, err := http.NewRequest(http.MethodGet, endpoint, nil)
|
req, err := http.NewRequest(http.MethodGet, endpoint, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
package bulma
|
|
||||||
|
|
||||||
// Simple spacer that accepts children
|
|
||||||
templ Block() {
|
|
||||||
<div class="block">
|
|
||||||
{ children... }
|
|
||||||
</div>
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package bulma
|
|
||||||
|
|
||||||
// This creates a button that accepts children under it.
|
|
||||||
templ Button() {
|
|
||||||
<button type="button" class={ "button" }>
|
|
||||||
{ children... }
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used to create a button and lets you define the color.
|
|
||||||
// Accepts children.
|
|
||||||
templ ButtonColor(color string) {
|
|
||||||
<button type="button" class={ "button", color }>
|
|
||||||
{ children... }
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ ButtonNewTab(url, text string) {
|
|
||||||
<button type="button" class="button">
|
|
||||||
<a href={ templ.SafeURL(url) } target="_blank" rel="noopener noreferrer">{ text }</a>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ ALink(url, title string) {
|
|
||||||
<a href={ templ.SafeURL(url) }>{ title }</a>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ ANewTab(url, text string) {
|
|
||||||
<a href={ templ.SafeURL(url) } target="_blank" rel="noopener noreferrer">{ text }</a>
|
|
||||||
}
|
|
@ -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,8 +0,0 @@
|
|||||||
package form
|
|
||||||
|
|
||||||
// Div container to add a input field to.
|
|
||||||
templ Control() {
|
|
||||||
<div class="control">
|
|
||||||
{ children... }
|
|
||||||
</div>
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package form
|
|
||||||
|
|
||||||
// This creates a field that you can add a Label, Control or Input object.
|
|
||||||
templ Field() {
|
|
||||||
<div class="field">
|
|
||||||
{ children... }
|
|
||||||
</div>
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
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) {
|
|
||||||
if color == "" {
|
|
||||||
<input class={ "input" } name={ id } id={ id } type={ fieldType } placeholder={ placeholder }/>
|
|
||||||
} else {
|
|
||||||
<input class={ "input", color } name={ id } id={ id } type={ fieldType } placeholder={ placeholder }/>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
templ Checkbox(text, id string) {
|
|
||||||
<label class="checkbox">
|
|
||||||
<input type="checkbox" id={ id }/> { text }
|
|
||||||
</label>
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
package form
|
|
||||||
|
|
||||||
// This will create a small bit of text to add context to the form.
|
|
||||||
templ Label(text string) {
|
|
||||||
<label class="label">{ text }</label>
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package form
|
|
||||||
|
|
||||||
type NewParam struct {
|
|
||||||
HxPost string
|
|
||||||
}
|
|
||||||
|
|
||||||
templ New(param NewParam) {
|
|
||||||
if param.HxPost != "" {
|
|
||||||
<form hx-post={ param.HxPost }>
|
|
||||||
{ children... }
|
|
||||||
</form>
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package form
|
|
||||||
|
|
||||||
templ SelectOne(color string, isRound bool) {
|
|
||||||
if isRound {
|
|
||||||
<div class="select is-round">
|
|
||||||
<select>
|
|
||||||
{ children... }
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
} else {
|
|
||||||
<div class="select">
|
|
||||||
<select>
|
|
||||||
{ children... }
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
templ SelectOneItem(name string) {
|
|
||||||
<option>{ name }</option>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ SelectMany(howManySelectable int, color string, isRound bool) {
|
|
||||||
<div class="select is-multiple">
|
|
||||||
<select multiple size="{ howManySelectable }">
|
|
||||||
{ children... }
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ SelectManyItem(name string) {
|
|
||||||
<option value={ name }>{ name }</option>
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package form
|
|
||||||
|
|
||||||
templ Submit(text, color string) {
|
|
||||||
<button type="submit" class={ "button", color }>{ text }</button>
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package form
|
|
||||||
|
|
||||||
templ TextArea(id, placeholder, color string) {
|
|
||||||
<textarea class={ "textarea", color } id={ id } placeholder={ placeholder }/>
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package form
|
|
||||||
|
|
||||||
const (
|
|
||||||
InputTypeText = "text"
|
|
||||||
InputTypePassword = "password"
|
|
||||||
InputTypeEmail = "email"
|
|
||||||
InputTypePhoneNumber = "tel"
|
|
||||||
)
|
|
@ -1,5 +0,0 @@
|
|||||||
package html
|
|
||||||
|
|
||||||
templ Br(){
|
|
||||||
<br/>
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package html
|
|
||||||
|
|
||||||
templ ALink(url, title string) {
|
|
||||||
<a href={ templ.SafeURL(url) }>{ title }</a>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ ANewTab(url, text string) {
|
|
||||||
<a href={ templ.SafeURL(url) } target="_blank" rel="noopener noreferrer">{ text }</a>
|
|
||||||
}
|
|
@ -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,7 +0,0 @@
|
|||||||
package bulma
|
|
||||||
|
|
||||||
templ Notification(message, color string) {
|
|
||||||
<div class={ "notification", color }>
|
|
||||||
{ message }
|
|
||||||
</div>
|
|
||||||
}
|
|
@ -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"/>
|
|
||||||
}
|
|
@ -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>
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package bulma
|
|
||||||
|
|
||||||
templ Tag(message string) {
|
|
||||||
<span class={ "tag" }>{ message }</span>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ TagColor(message, color string) {
|
|
||||||
<span class={ "tag", color }>{ message }</span>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ TagColorSize(message, color, size string) {
|
|
||||||
<span class={ "tag", color, size }>{ message }</span>
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package bulma
|
|
||||||
|
|
||||||
templ Title(message string) {
|
|
||||||
<h1 class="title">{ message }</h1>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ Subitle(message string) {
|
|
||||||
<h2 class="subtitle">{ message }</h2>
|
|
||||||
}
|
|
||||||
|
|
||||||
templ H1(message string, isSubtitle bool) {
|
|
||||||
if isSubtitle {
|
|
||||||
<h1 class="subtitle is-1">{ message }</h1>
|
|
||||||
} else {
|
|
||||||
<h1 class="title is-1">{ message }</h1>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
templ H2(message string, isSubtitle bool) {
|
|
||||||
if isSubtitle {
|
|
||||||
<h2 class="subtitle is-2">{ message }</h2>
|
|
||||||
} else {
|
|
||||||
<h2 class="title is-2">{ message }</h2>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
templ H3(message string, isSubtitle bool) {
|
|
||||||
if isSubtitle {
|
|
||||||
<h3 class="subtitle is-3">{ message }</h3>
|
|
||||||
} else {
|
|
||||||
<h3 class="title is-3">{ message }</h3>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
templ H4(message string, isSubtitle bool) {
|
|
||||||
if isSubtitle {
|
|
||||||
<h4 class="subtitle is-4">{ message }</h4>
|
|
||||||
} else {
|
|
||||||
<h4 class="title is-4">{ message }</h4>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
templ H5(message string, isSubtitle bool) {
|
|
||||||
if isSubtitle {
|
|
||||||
<h5 class="subtitle is-5">{ message }</h5>
|
|
||||||
} else {
|
|
||||||
<h5 class="title is-5">{ message }</h5>
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package bulma
|
|
||||||
|
|
||||||
const (
|
|
||||||
ColorPrimary = "is-primary"
|
|
||||||
ColorInfo = "is-info"
|
|
||||||
ColorLink = "is-link"
|
|
||||||
ColorWarning = "is-warning"
|
|
||||||
ColorSuccess = "is-success"
|
|
||||||
ColorError = "is-error"
|
|
||||||
|
|
||||||
SizeNormal = "is-normal"
|
|
||||||
SizeMedium = "is-medium"
|
|
||||||
SizeLarge = "is-large"
|
|
||||||
|
|
||||||
BreakpointDefault = ""
|
|
||||||
BreakpointWidescreen = "is-widescreen"
|
|
||||||
BreakpointFullHd = "is-fullhd"
|
|
||||||
BreakpointMaxDesktop = "is-max-desktop"
|
|
||||||
BreakpointMaxWidescreen = "is-max-widescreen"
|
|
||||||
)
|
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module git.jamestombleson.com/jtom38/newsbot-portal
|
|||||||
go 1.22.1
|
go 1.22.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.jamestombleson.com/jtom38/newsbot-api v0.0.0-20240710142335-56199a795a2b // indirect
|
git.jamestombleson.com/jtom38/newsbot-api v0.0.0-20240603002809-9237369e5a76
|
||||||
github.com/a-h/templ v0.2.747
|
github.com/a-h/templ v0.2.747
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
|
2
go.sum
2
go.sum
@ -1,7 +1,5 @@
|
|||||||
git.jamestombleson.com/jtom38/newsbot-api v0.0.0-20240603002809-9237369e5a76 h1:B9t5fcfVerMjqnXXPUmYwdmUk76EoEL8x9IRehqg2c4=
|
git.jamestombleson.com/jtom38/newsbot-api v0.0.0-20240603002809-9237369e5a76 h1:B9t5fcfVerMjqnXXPUmYwdmUk76EoEL8x9IRehqg2c4=
|
||||||
git.jamestombleson.com/jtom38/newsbot-api v0.0.0-20240603002809-9237369e5a76/go.mod h1:A3UdJyQ/IEy3utEwJiC4nbi0ohfgrUNRLTei2iZhLLA=
|
git.jamestombleson.com/jtom38/newsbot-api v0.0.0-20240603002809-9237369e5a76/go.mod h1:A3UdJyQ/IEy3utEwJiC4nbi0ohfgrUNRLTei2iZhLLA=
|
||||||
git.jamestombleson.com/jtom38/newsbot-api v0.0.0-20240710142335-56199a795a2b h1:XAXD6OSFDzrJ2O1+wma/vnYfLJdcQZRD6NFjfjxjKv4=
|
|
||||||
git.jamestombleson.com/jtom38/newsbot-api v0.0.0-20240710142335-56199a795a2b/go.mod h1:A3UdJyQ/IEy3utEwJiC4nbi0ohfgrUNRLTei2iZhLLA=
|
|
||||||
github.com/a-h/templ v0.2.747 h1:D0dQ2lxC3W7Dxl6fxQ/1zZHBQslSkTSvl5FxP/CfdKg=
|
github.com/a-h/templ v0.2.747 h1:D0dQ2lxC3W7Dxl6fxQ/1zZHBQslSkTSvl5FxP/CfdKg=
|
||||||
github.com/a-h/templ v0.2.747/go.mod h1:69ObQIbrcuwPCU32ohNaWce3Cb7qM5GMiqN1K+2yop4=
|
github.com/a-h/templ v0.2.747/go.mod h1:69ObQIbrcuwPCU32ohNaWce3Cb7qM5GMiqN1K+2yop4=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
@ -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))
|
||||||
}
|
}
|
||||||
|
@ -65,15 +65,14 @@ func NewServer(ctx context.Context, configs config.Configs, apiClient apiclient.
|
|||||||
//sources.Use(ValidateJwtMiddleware(configs.JwtSecret))
|
//sources.Use(ValidateJwtMiddleware(configs.JwtSecret))
|
||||||
sources.GET("", s.ListAllSources)
|
sources.GET("", s.ListAllSources)
|
||||||
sources.GET("/add", s.AddSource)
|
sources.GET("/add", s.AddSource)
|
||||||
sources.POST("/add", s.AddSourceAfter)
|
|
||||||
|
|
||||||
users := router.Group("/users")
|
users := router.Group("/users")
|
||||||
users.GET("/login", s.UserLogin)
|
users.GET("/login", s.UserLogin)
|
||||||
users.POST("/login", s.UserAfterLogin)
|
users.POST("/login", s.UserAfterLogin)
|
||||||
users.GET("/signup", s.UserSignUp)
|
users.GET("/signup", s.UserSignUp)
|
||||||
users.POST("/signup", s.UserAfterSignUp)
|
users.POST("/signup", s.UserAfterSignUp)
|
||||||
users.GET("/logout", s.UsersLogout)
|
|
||||||
users.Use(ValidateJwtMiddleware(configs.JwtSecret))
|
users.Use(ValidateJwtMiddleware(configs.JwtSecret))
|
||||||
|
users.GET("/logout", s.UsersLogout)
|
||||||
users.GET("/profile", s.UserProfile)
|
users.GET("/profile", s.UserProfile)
|
||||||
|
|
||||||
s.Router = router
|
s.Router = router
|
||||||
|
@ -36,13 +36,3 @@ func (h *Handler) AddSource(c echo.Context) error {
|
|||||||
|
|
||||||
return Render(c, http.StatusOK, sources.Add(models.AddSourcePayloadModel{}))
|
return Render(c, http.StatusOK, sources.Add(models.AddSourcePayloadModel{}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) AddSourceAfter(c echo.Context) error {
|
|
||||||
name := c.FormValue("name")
|
|
||||||
url := c.FormValue("url")
|
|
||||||
resp, err := h.api.Sources.NewRss(GetJwtToken(c), name, url, "rss")
|
|
||||||
if err != nil {
|
|
||||||
return Render(c, http.StatusOK, sources.AddAfter(err.Error(), true))
|
|
||||||
}
|
|
||||||
return Render(c, http.StatusOK, sources.AddAfter(resp.Message, false))
|
|
||||||
}
|
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) UserLogin(c echo.Context) error {
|
func (h *Handler) UserLogin(c echo.Context) error {
|
||||||
return Render(c, http.StatusOK, users.LoginNew())
|
return Render(c, http.StatusOK, users.Login())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) UserAfterLogin(c echo.Context) error {
|
func (h *Handler) UserAfterLogin(c echo.Context) error {
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
package articles
|
package articles
|
||||||
|
|
||||||
import (
|
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"
|
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||||
|
"git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||||
|
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/bulma"
|
||||||
)
|
)
|
||||||
|
|
||||||
templ List(model models.ListArticlesViewModel) {
|
templ List(model models.ListArticlesViewModel) {
|
||||||
@layout.WithTemplate() {
|
@layout.WithTemplate() {
|
||||||
@filterBar()
|
@filterBar()
|
||||||
for _, item := range model.Items {
|
for _, item := range model.Items {
|
||||||
@bulma.ArticleCardWithThumbnail(item.Article.Title, item.Article.Thumbnail, item.Article.Url, item.Article.PubDate.String(), item.Source.DisplayName)
|
@bulma.ArticleCardWithThumbnail(item.Article.Title, item.Article.Thumbnail, item.Article.Url, item.Article.PubDate.String(), item.Source.DisplayName )
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
10
internal/views/bulma/hero.templ
Normal file
10
internal/views/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>
|
||||||
|
}
|
11
internal/views/bulma/section.templ
Normal file
11
internal/views/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,15 +1,15 @@
|
|||||||
package home
|
package home
|
||||||
|
|
||||||
import "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 About() {
|
templ About() {
|
||||||
@layout.WithTemplate(){
|
@layout.WithTemplate(){
|
||||||
@bulma.Title("About this project")
|
<h1 class="title"> About this project</h1>
|
||||||
@bulma.Block() {
|
|
||||||
|
<section class="section">
|
||||||
Newsbot started a small project to send out notifications to discord servers.
|
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.
|
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.
|
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
|
package home
|
||||||
|
|
||||||
import (
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||||
b "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/bulma"
|
||||||
bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout"
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
|
||||||
)
|
|
||||||
|
|
||||||
templ Index() {
|
templ Index() {
|
||||||
@layout.WithTemplate() {
|
@layout.WithTemplate() {
|
||||||
@bl.Hero("Welcome to Newsbot!", "Your new home for your news.")
|
@bulma.Hero("Welcome to Newsbot!", "Your new home for your news.")
|
||||||
@b.Block() {
|
|
||||||
|
<section class="section">
|
||||||
|
<p>
|
||||||
News bot is a self hostable solution to aggregating your news.
|
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.
|
You can run `Newsbot` as an API or interact with it with this site.
|
||||||
}
|
</p>
|
||||||
@b.H2("Why Newsbot", false)
|
</section>
|
||||||
@b.Block() {
|
|
||||||
|
|
||||||
|
<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 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.
|
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.
|
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.
|
It still has those roots but now its starting to scale up to a full Aggregation platform.
|
||||||
}
|
|
||||||
@b.Block() {
|
</div>
|
||||||
|
<p>
|
||||||
This project is a passion project of mine as I
|
This project is a passion project of mine as I
|
||||||
}
|
</p>
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package layout
|
package layout
|
||||||
|
|
||||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
|
||||||
|
|
||||||
templ header() {
|
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"/>
|
<link rel="stylesheet" href="/css/main.css"/>
|
||||||
<script src="https://unpkg.com/htmx.org@1.9.11" integrity="sha384-0gxUXCCR8yv9FM2b+U3FDbsKthCI66oH5IA9fHppQq9DDMHuMauqq1ZHBpJxQ0J0" crossorigin="anonymous"></script>
|
<script src="https://unpkg.com/htmx.org@1.9.11" integrity="sha384-0gxUXCCR8yv9FM2b+U3FDbsKthCI66oH5IA9fHppQq9DDMHuMauqq1ZHBpJxQ0J0" crossorigin="anonymous"></script>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
|
@ -1,29 +1,10 @@
|
|||||||
package sources
|
package sources
|
||||||
|
|
||||||
import (
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||||
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/internal/models"
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
p = bf.NewParam{
|
|
||||||
HxPost: "/sources/add",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
templ Add(model models.AddSourcePayloadModel) {
|
templ Add(model models.AddSourcePayloadModel) {
|
||||||
@layout.WithTemplate() {
|
@layout.WithTemplate() {
|
||||||
@bl.Hero("New Source", "")
|
<form hx-post="/sources/add"></form>
|
||||||
@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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
package sources
|
|
||||||
|
|
||||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
|
||||||
|
|
||||||
templ AddAfter(message string, isError bool) {
|
|
||||||
if isError {
|
|
||||||
@bulma.Notification(message, bulma.ColorError)
|
|
||||||
} else {
|
|
||||||
@bulma.Notification("The requested source was added to the server", bulma.ColorSuccess)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +1,12 @@
|
|||||||
package sources
|
package sources
|
||||||
|
|
||||||
import (
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||||
bh "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/html"
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
|
||||||
)
|
|
||||||
|
|
||||||
templ ListAll(model models.ListAllSourcesViewModel) {
|
templ ListAll(model models.ListAllSourcesViewModel) {
|
||||||
@layout.WithTemplate() {
|
@layout.WithTemplate() {
|
||||||
@bulma.Button() {
|
|
||||||
@bh.ALink("/sources/add", "New Source")
|
|
||||||
}
|
|
||||||
@bh.Br()
|
|
||||||
@bh.Br()
|
|
||||||
for _, item := range model.Items {
|
for _, item := range model.Items {
|
||||||
@bulma.ButtonColor(bulma.ColorPrimary) {
|
<a href={ templ.SafeURL(item.Url) } target="_blank" rel="noopener noreferrer">{ item.DisplayName } - { item.Source } </a>
|
||||||
@bulma.ANewTab(item.Url, item.DisplayName)
|
|
||||||
}
|
|
||||||
<br/>
|
<br/>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
package users
|
package users
|
||||||
|
|
||||||
import (
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This is returned after the user logs into the application.
|
// This is returned after the user logs into the application.
|
||||||
// It just returns a partial view because it will overlap with the existing template.
|
// It just returns a partial view because it will overlap with the existing template.
|
||||||
templ AfterLogin(vm models.AfterLoginViewModel) {
|
templ AfterLogin(vm models.AfterLoginViewModel) {
|
||||||
if vm.Success {
|
if vm.Success {
|
||||||
@bulma.Notification(vm.Message, bulma.ColorSuccess)
|
<div class="notification is-success">
|
||||||
|
{ vm.Message }
|
||||||
|
</div>
|
||||||
} else {
|
} else {
|
||||||
@bulma.Notification(vm.Message, bulma.ColorError)
|
<div class="notification is-error">
|
||||||
|
{ vm.Message }
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
package users
|
package users
|
||||||
|
|
||||||
import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
|
||||||
|
|
||||||
// This is returned after the user creates an account.
|
// This is returned after the user creates an account.
|
||||||
// It just returns a partial view because it will overlap with the existing template.
|
// It just returns a partial view because it will overlap with the existing template.
|
||||||
templ AfterSignUp(message string, success bool) {
|
templ AfterSignUp(message string, success bool) {
|
||||||
if success {
|
if success {
|
||||||
@bulma.Notification(message, bulma.ColorSuccess)
|
<div class="notification is-success">
|
||||||
|
{ message }
|
||||||
|
</div>
|
||||||
} else {
|
} else {
|
||||||
@bulma.Notification(message, bulma.ColorError)
|
<div class="notification is-error">
|
||||||
|
{ message }
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
package users
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/form"
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
p = form.NewParam{
|
|
||||||
HxPost: "/users/login",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
templ LoginNew() {
|
|
||||||
@layout.WithTemplate() {
|
|
||||||
@form.New(p) {
|
|
||||||
@form.Field() {
|
|
||||||
@form.Label("Username")
|
|
||||||
@form.Control() {
|
|
||||||
@form.TextInput("username", "text", "email address")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@form.Field() {
|
|
||||||
@form.Label("Password")
|
|
||||||
@form.Control() {
|
|
||||||
@form.TextInput("password", form.InputTypePassword, "")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@form.Submit("Submit", "is-primary")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +1,10 @@
|
|||||||
package users
|
package users
|
||||||
|
|
||||||
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
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/internal/views/bulma"
|
||||||
|
|
||||||
templ Logout() {
|
templ Logout() {
|
||||||
@layout.WithTemplate(){
|
@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.")
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,20 +1,15 @@
|
|||||||
package users
|
package users
|
||||||
|
|
||||||
import (
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/bulma"
|
||||||
bh "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/html"
|
|
||||||
bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout"
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
|
||||||
)
|
|
||||||
|
|
||||||
templ Profile() {
|
templ Profile() {
|
||||||
@layout.WithTemplate() {
|
@layout.WithTemplate() {
|
||||||
@bl.Hero("Profile", "Here you can update your profile 😀")
|
@bulma.Hero("Profile", "Here you can update your profile 😀")
|
||||||
|
|
||||||
@bulma.H2("Sessions", false)
|
<button type="button" class="button">
|
||||||
@bulma.Button() {
|
<a href="/users/forcelogout">Logout Everywhere</a>
|
||||||
@bh.ALink("/users/forcelogout", "Terminate all active sessions")
|
Logout Everywhere</button>
|
||||||
}
|
<p class="subtitle">This will force all active sessions to stop working and require a new login.</p>
|
||||||
@bulma.Subitle("This will force you to login again as the application will give you a new session value.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,23 @@
|
|||||||
package users
|
package users
|
||||||
|
|
||||||
import (
|
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/form"
|
|
||||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
|
||||||
)
|
|
||||||
|
|
||||||
templ SignUp() {
|
templ SignUp() {
|
||||||
@layout.WithTemplate() {
|
@layout.WithTemplate() {
|
||||||
@form.New(form.NewParam{HxPost: "/users/signup"}) {
|
<form hx-post="/users/signup">
|
||||||
@form.Field(){
|
<div class="field">
|
||||||
@form.Label("Username")
|
<label class="label">Username</label>
|
||||||
@form.Control() {
|
<div class="control">
|
||||||
@form.TextInput("username", form.InputTypeText, "username or email address")
|
<input class="input" type="text" name="username" id="username"/>
|
||||||
}
|
</div>
|
||||||
}
|
</div>
|
||||||
@form.Field() {
|
<div class="field">
|
||||||
@form.Label("Password")
|
<label class="label">Password</label>
|
||||||
@form.Control() {
|
<div class="control">
|
||||||
@form.TextInput("password", form.InputTypePassword, "Nice strong password, like Ox!")
|
<input class="input" type="password" name="password" id="exampleInputPassword1"/>
|
||||||
}
|
</div>
|
||||||
}
|
</div>
|
||||||
@form.Submit("Submit", "")
|
<button type="submit" class="button is-primary">Submit</button>
|
||||||
}
|
</form>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user