everywhere: use common html to generate footer

This commit is contained in:
Adhityaa 2018-06-22 19:27:19 +05:30
parent c1c2a19842
commit 584698df94
6 changed files with 34 additions and 89 deletions

View File

@ -22,6 +22,7 @@ type staticAssetPlugs struct {
type staticHtmlPlugs struct { type staticHtmlPlugs struct {
CdnPrefix string CdnPrefix string
Footer template.HTML
} }
func initStaticRouter(router *mux.Router) error { func initStaticRouter(router *mux.Router) error {
@ -80,6 +81,12 @@ func initStaticRouter(router *mux.Router) error {
} }
} }
footer, err := ioutil.ReadFile(os.Getenv("STATIC") + string(os.PathSeparator) + "footer.html")
if err != nil {
logger.Errorf("cannot read file footer.html: %v", err)
return err
}
pages := []string{ pages := []string{
"login", "login",
"forgot", "forgot",
@ -108,7 +115,7 @@ func initStaticRouter(router *mux.Router) error {
} }
var buf bytes.Buffer var buf bytes.Buffer
t.Execute(&buf, &staticHtmlPlugs{CdnPrefix: os.Getenv("CDN_PREFIX")}) t.Execute(&buf, &staticHtmlPlugs{CdnPrefix: os.Getenv("CDN_PREFIX"), Footer: template.HTML(string(footer))})
html[page] = buf.String() html[page] = buf.String()
} }

22
frontend/footer.html Normal file
View File

@ -0,0 +1,22 @@
<div class="footer">
<div class="footer-inner">
<div class="links">
<div class="link-group">
<div class="header">Your Installation</div>
<a class="link" href="/login">Login</a>
<a class="link" href="/signup">Signup</a>
<a class="link" href="/dashboard">Dashboard</a>
</div>
<div class="link-group">
<div class="header">Documentation</div>
<a class="link" href="https://docs.commento.io/">Documentation</a>
<a class="link" href="https://gitlab.com/commento">Open Source</a>
</div>
<div class="link-group">
<div class="header">About</div>
<a class="link" href="https://commento.io">About Commento</a>
<a class="link" href="https://commento.io/help">Help</a>
</div>
</div>
</div>
</div>

View File

@ -29,26 +29,5 @@
</div> </div>
</div> </div>
<div class="footer"> <<<.Footer>>>
<div class="footer-inner">
<div class="links">
<div class="link-group">
<div class="header">Your Installation</div>
<a class="link" href="/login">Login</a>
<a class="link" href="/signup">Signup</a>
<a class="link" href="/dashboard">Dashboard</a>
</div>
<div class="link-group">
<div class="header">Documentation</div>
<a class="link" href="https://docs.commento.io/">Documentation</a>
<a class="link" href="https://gitlab.com/commento">Open Source</a>
</div>
<div class="link-group">
<div class="header">About</div>
<a class="link" href="https://commento.io">About Commento</a>
<a class="link" href="https://commento.io/help">Help</a>
</div>
</div>
</div>
</div>
</html> </html>

View File

@ -47,26 +47,5 @@
</div> </div>
</div> </div>
<div class="footer"> <<<.Footer>>>
<div class="footer-inner">
<div class="links">
<div class="link-group">
<div class="header">Your Installation</div>
<a class="link" href="/login">Login</a>
<a class="link" href="/signup">Signup</a>
<a class="link" href="/dashboard">Dashboard</a>
</div>
<div class="link-group">
<div class="header">Documentation</div>
<a class="link" href="https://docs.commento.io/">Documentation</a>
<a class="link" href="https://gitlab.com/commento">Open Source</a>
</div>
<div class="link-group">
<div class="header">About</div>
<a class="link" href="https://commento.io">About Commento</a>
<a class="link" href="https://commento.io/help">Help</a>
</div>
</div>
</div>
</div>
</html> </html>

View File

@ -37,26 +37,5 @@
</div> </div>
</div> </div>
<div class="footer"> <<<.Footer>>>
<div class="footer-inner">
<div class="links">
<div class="link-group">
<div class="header">Your Installation</div>
<a class="link" href="/login">Login</a>
<a class="link" href="/signup">Signup</a>
<a class="link" href="/dashboard">Dashboard</a>
</div>
<div class="link-group">
<div class="header">Documentation</div>
<a class="link" href="https://docs.commento.io/">Documentation</a>
<a class="link" href="https://gitlab.com/commento">Open Source</a>
</div>
<div class="link-group">
<div class="header">About</div>
<a class="link" href="https://commento.io">About Commento</a>
<a class="link" href="https://commento.io/help">Help</a>
</div>
</div>
</div>
</div>
</html> </html>

View File

@ -59,26 +59,5 @@
</div> </div>
</div> </div>
<div class="footer"> <<<.Footer>>>
<div class="footer-inner">
<div class="links">
<div class="link-group">
<div class="header">Your Installation</div>
<a class="link" href="/login">Login</a>
<a class="link" href="/signup">Signup</a>
<a class="link" href="/dashboard">Dashboard</a>
</div>
<div class="link-group">
<div class="header">Documentation</div>
<a class="link" href="https://docs.commento.io/">Documentation</a>
<a class="link" href="https://gitlab.com/commento">Open Source</a>
</div>
<div class="link-group">
<div class="header">About</div>
<a class="link" href="https://commento.io">About Commento</a>
<a class="link" href="https://commento.io/help">Help</a>
</div>
</div>
</div>
</div>
</html> </html>