Compare commits
No commits in common. "435dfbda40a29022fd293a2bb0b251a33779612a" and "6cc21192b122c3b15968a22ad753483cdf03000e" have entirely different histories.
435dfbda40
...
6cc21192b1
@ -71,8 +71,8 @@ func NewServer(ctx context.Context, configs config.Configs, apiClient apiclient.
|
||||
users.POST("/login", s.UserAfterLogin)
|
||||
users.GET("/signup", s.UserSignUp)
|
||||
users.POST("/signup", s.UserAfterSignUp)
|
||||
users.GET("/logout", s.UsersLogout)
|
||||
users.Use(ValidateJwtMiddleware(configs.JwtSecret))
|
||||
users.GET("/logout", s.UsersLogout)
|
||||
users.GET("/profile", s.UserProfile)
|
||||
|
||||
s.Router = router
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
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 {
|
||||
|
@ -1,34 +0,0 @@
|
||||
package bulma
|
||||
|
||||
templ Button(color string, isLight, isDark bool) {
|
||||
if isLight {
|
||||
<button type="button" class={ "button", "is-light", color }>
|
||||
{ children... }
|
||||
</button>
|
||||
}
|
||||
if isDark {
|
||||
<button type="button" class={ "button", "is-dark", color }>
|
||||
{ children... }
|
||||
</button>
|
||||
}
|
||||
if !isLight && !isDark {
|
||||
<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,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,9 +0,0 @@
|
||||
package form
|
||||
|
||||
templ Input(color, id, fieldType string) {
|
||||
if color == "" {
|
||||
<input class={ "input" } id={ id } type={ fieldType }/>
|
||||
} else {
|
||||
<input class={ "input", color } id={ id } type={ fieldType }/>
|
||||
}
|
||||
}
|
@ -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,7 +0,0 @@
|
||||
package form
|
||||
|
||||
templ New(postUrl string) {
|
||||
<form hx-post={ postUrl }>
|
||||
{ children... }
|
||||
</form>
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package form
|
||||
|
||||
templ Submit(text, color string) {
|
||||
<button type="submit" class={ "button", color }>{ text }</button>
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package form
|
||||
|
||||
const (
|
||||
InputTypeText = "text"
|
||||
InputTypePassword = "password"
|
||||
)
|
@ -1,10 +0,0 @@
|
||||
package bulma
|
||||
|
||||
const (
|
||||
ColorPrimary = "is-primary"
|
||||
ColorInfo = "is-info"
|
||||
ColorLink = "is-link"
|
||||
ColorWarning = "is-warning"
|
||||
ColorSuccess = "is-success"
|
||||
ColorError = "is-error"
|
||||
)
|
@ -1,19 +1,10 @@
|
||||
package sources
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||
|
||||
templ Add(model models.AddSourcePayloadModel) {
|
||||
@layout.WithTemplate() {
|
||||
<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)
|
||||
}
|
||||
<form hx-post="/sources/add"></form>
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,12 @@
|
||||
package sources
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
import "git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
|
||||
|
||||
templ ListAll(model models.ListAllSourcesViewModel) {
|
||||
@layout.WithTemplate() {
|
||||
for _, item := range model.Items {
|
||||
@bulma.Button(bulma.ColorPrimary, false, false) {
|
||||
@bulma.ANewTab(item.Url, item.DisplayName)
|
||||
}
|
||||
<a href={ templ.SafeURL(item.Url) } target="_blank" rel="noopener noreferrer">{ item.DisplayName } - { item.Source } </a>
|
||||
<br/>
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
package users
|
||||
|
||||
import (
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/bulma/form"
|
||||
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
|
||||
)
|
||||
|
||||
templ LoginNew() {
|
||||
@layout.WithTemplate() {
|
||||
@form.New("/users/login") {
|
||||
@form.Field() {
|
||||
@form.Label("Username")
|
||||
@form.Control() {
|
||||
@form.Input("", "username", "text")
|
||||
}
|
||||
}
|
||||
@form.Field(){
|
||||
@form.Label("Password")
|
||||
@form.Control(){
|
||||
@form.Input("", "password", form.InputTypePassword)
|
||||
}
|
||||
}
|
||||
@form.Submit("Submit", "is-primary")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user