Skip to content

Commit da14a61

Browse files
committed
Fix a new names, unify on ems
1 parent 4199e68 commit da14a61

12 files changed

Lines changed: 72 additions & 80 deletions

File tree

backend/web/accounts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func HandleAccountList(repo *repository.Repository) http.Handler {
2121
}
2222

2323
data := page.AccountsData{
24-
BaseData: util.TemplateBaseData(r, w),
24+
BaseData: util.GetTemplateBaseData(r, w),
2525

2626
Accounts: accounts,
2727
}

backend/web/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func HandleSignIn(enableDebugAuth bool) http.Handler {
108108
http.SetCookie(w, &cookie)
109109

110110
data := page.SignInData{
111-
BaseData: util.TemplateBaseData(r, w),
111+
BaseData: util.GetTemplateBaseData(r, w),
112112

113113
EnableDebugAuth: enableDebugAuth,
114114
}

backend/web/blog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func HandleBlogRead(repo *repository.Repository) http.Handler {
3434
}
3535

3636
data := page.BlogData{
37-
BaseData: util.TemplateBaseData(r, w),
37+
BaseData: util.GetTemplateBaseData(r, w),
3838

3939
Blog: blog,
4040
Posts: posts,

backend/web/blogs.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ func HandleBlogList(find *finder.Finder) http.Handler {
3333
}
3434

3535
data := page.BlogsData{
36-
BaseData: util.TemplateBaseData(r, w),
36+
BaseData: util.GetTemplateBaseData(r, w),
3737
}
3838
for _, blog := range blogs {
3939
data.Blogs = append(data.Blogs, page.BlogsBlogData{
40-
BaseData: util.TemplateBaseData(r, w),
40+
BaseData: util.GetTemplateBaseData(r, w),
4141

4242
BlogForAccount: blog,
4343
})
@@ -202,7 +202,7 @@ func HandleBlogFollowForm(repo *repository.Repository, find *finder.Finder) http
202202
// If the request came in via HTMX, re-render the individual blog row.
203203
if util.IsHTMXRequest(r) {
204204
data := page.BlogsBlogData{
205-
BaseData: util.TemplateBaseData(r, w),
205+
BaseData: util.GetTemplateBaseData(r, w),
206206

207207
BlogForAccount: finder.BlogForAccount{
208208
ID: blog.ID(),
@@ -270,7 +270,7 @@ func HandleBlogUnfollowForm(repo *repository.Repository, find *finder.Finder) ht
270270
// If the request came in via HTMX, re-render the individual row.
271271
if util.IsHTMXRequest(r) {
272272
data := page.BlogsBlogData{
273-
BaseData: util.TemplateBaseData(r, w),
273+
BaseData: util.GetTemplateBaseData(r, w),
274274

275275
BlogForAccount: finder.BlogForAccount{
276276
ID: blog.ID(),

backend/web/index.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func HandleIndexPage(find *finder.Finder) http.Handler {
9999
}
100100

101101
data := page.IndexData{
102-
BaseData: util.TemplateBaseData(r, w),
102+
BaseData: util.GetTemplateBaseData(r, w),
103103

104104
Search: search,
105105
Articles: articles,

backend/web/page/signin.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"io"
77

88
"github.com/theandrew168/bloggulus/backend/web/layout"
9-
"golang.org/x/oauth2"
109
)
1110

1211
//go:embed signin.html
@@ -15,9 +14,6 @@ var SignInHTML string
1514
type SignInData struct {
1615
layout.BaseData
1716

18-
GithubConf *oauth2.Config
19-
Errors map[string]string
20-
2117
EnableDebugAuth bool
2218
}
2319

backend/web/page/signin.html

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,18 @@ <h2 class="signin__heading">Welcome!</h2>
1313
<img class="signin__icon" src="/img/bloggulus.png" />
1414
Sign in with Debug
1515
</button>
16-
{{with .Errors.google}}
17-
<p class="signin__error">{{.}}</p>
18-
{{end}}
1916
</form>
2017
{{end}}
2118

2219
<a class="signin__button" href="/github/signin">
2320
<img class="signin__icon" src="/img/github.png" />
2421
Sign in with GitHub
2522
</a>
26-
{{with .Errors.github}}
27-
<p class="signin__error">{{.}}</p>
28-
{{end}}
2923

3024
<a class="signin__button" href="/google/signin">
3125
<img class="signin__icon" src="/img/google.png" />
3226
Sign in with Google
3327
</a>
34-
{{with .Errors.google}}
35-
<p class="signin__error">{{.}}</p>
36-
{{end}}
3728
</article>
3829
</section>
3930

backend/web/pages.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func HandlePageList(repo *repository.Repository) http.Handler {
3333
}
3434

3535
data := page.PagesData{
36-
BaseData: util.TemplateBaseData(r, w),
36+
BaseData: util.GetTemplateBaseData(r, w),
3737

3838
Pages: pages,
3939
}
@@ -226,7 +226,7 @@ func HandlePageUnfollowForm(repo *repository.Repository) http.Handler {
226226
}
227227

228228
data := page.PagesData{
229-
BaseData: util.TemplateBaseData(r, w),
229+
BaseData: util.GetTemplateBaseData(r, w),
230230

231231
Pages: pages,
232232
}

backend/web/post.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func HandlePostRead(repo *repository.Repository) http.Handler {
2929
}
3030

3131
data := page.PostData{
32-
BaseData: util.TemplateBaseData(r, w),
32+
BaseData: util.GetTemplateBaseData(r, w),
3333

3434
Post: post,
3535
}

backend/web/util/error.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func BadRequestResponse(w http.ResponseWriter, r *http.Request) {
6262
tmpl := page.NewError()
6363
code := http.StatusBadRequest
6464
data := page.ErrorData{
65-
BaseData: TemplateBaseData(r, w),
65+
BaseData: GetTemplateBaseData(r, w),
6666

6767
StatusCode: code,
6868
StatusText: http.StatusText(code),
@@ -79,7 +79,7 @@ func ForbiddenResponse(w http.ResponseWriter, r *http.Request) {
7979
tmpl := page.NewError()
8080
code := http.StatusForbidden
8181
data := page.ErrorData{
82-
BaseData: TemplateBaseData(r, w),
82+
BaseData: GetTemplateBaseData(r, w),
8383

8484
StatusCode: code,
8585
StatusText: http.StatusText(code),
@@ -96,7 +96,7 @@ func NotFoundResponse(w http.ResponseWriter, r *http.Request) {
9696
tmpl := page.NewError()
9797
code := http.StatusNotFound
9898
data := page.ErrorData{
99-
BaseData: TemplateBaseData(r, w),
99+
BaseData: GetTemplateBaseData(r, w),
100100

101101
StatusCode: code,
102102
StatusText: http.StatusText(code),
@@ -118,7 +118,7 @@ func InternalServerErrorResponse(w http.ResponseWriter, r *http.Request, err err
118118
tmpl := page.NewError()
119119
code := http.StatusInternalServerError
120120
data := page.ErrorData{
121-
BaseData: TemplateBaseData(r, w),
121+
BaseData: GetTemplateBaseData(r, w),
122122

123123
StatusCode: code,
124124
StatusText: http.StatusText(code),

0 commit comments

Comments
 (0)