Add subscription/archive links to public pages.

This commit is contained in:
Kailash Nadh 2022-11-09 22:24:34 +05:30
parent ebf63b5bed
commit 23fb178ec4
6 changed files with 41 additions and 21 deletions

View file

@ -695,7 +695,9 @@ func initHTTPServer(app *App) *echo.Echo {
templates: tpl,
RootURL: app.constants.RootURL,
LogoURL: app.constants.LogoURL,
FaviconURL: app.constants.FaviconURL}
FaviconURL: app.constants.FaviconURL,
EnablePublicSubPage: app.constants.EnablePublicSubPage,
}
// Initialize the static file server.
fSrv := app.fs.FileServer()

View file

@ -29,6 +29,7 @@ type tplRenderer struct {
RootURL string
LogoURL string
FaviconURL string
EnablePublicSubPage bool
}
// tplData is the data container that is injected
@ -37,6 +38,7 @@ type tplData struct {
RootURL string
LogoURL string
FaviconURL string
EnablePublicSubPage bool
Data interface{}
L *i18n.I18n
}
@ -86,6 +88,7 @@ func (t *tplRenderer) Render(w io.Writer, name string, data interface{}, c echo.
RootURL: t.RootURL,
LogoURL: t.LogoURL,
FaviconURL: t.FaviconURL,
EnablePublicSubPage: t.EnablePublicSubPage,
Data: data,
L: c.Get("app").(*App).i18n,
})

View file

@ -15,6 +15,7 @@ body {
}
a {
color: #0055d4;
text-decoration-color: #abcbfb;
}
a:hover {
color: #111;
@ -57,6 +58,9 @@ input[disabled] {
.center {
text-align: center;
}
.right {
text-align: right;
}
.button {
background: #0055d4;
padding: 15px 30px;
@ -145,7 +149,7 @@ input[disabled] {
font-size: 0.875em;
}
.archive li {
margin-bottom: 10px;
margin-bottom: 15px;
}
.pagination {

View file

@ -16,6 +16,12 @@
{{ L.T "public.archiveEmpty" }}
{{ end }}
{{ if .EnablePublicSubPage }}
<p class="right">
<a href="{{ .RootURL }}/subscription/form">Subscribe</a>
</p>
{{ end }}
{{ if gt .Data.TotalPages 1 }}
<div class="pagination">{{ .Data.Pagination }}</div>
{{ end }}

View file

@ -20,11 +20,13 @@
<div class="container wrap">
<header class="header">
<div class="logo">
<a href="{{ if .EnablePublicSubPage }}{{ .RootURL}}/subscription/form{{ end }}">
{{ if ne .LogoURL "" }}
<img src="{{ .LogoURL }}" alt="{{ .Data.Title }}" />
<img src="{{ .LogoURL }}" alt="{{ .Data.Title }}" /></a>
{{ else }}
<img src="/public/static/logo.svg" alt="{{ .Data.Title }}" />
{{ end }}
</a>
</div>
</header>
{{ end }}

View file

@ -30,6 +30,9 @@
</ul>
<p>
<button type="submit" class="button">{{ L.T "public.sub" }}</button>
<p class="right">
<a href="{{ .RootURL }}/archive">{{ L.T "public.archiveTitle" }}</a>
</p>
</p>
</div>
</form>