Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/dev_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func main() {
http.Handle("/", fs) // Serve static files
http.Handle("/geonetheader", http.HandlerFunc(testUIhandler))
http.Handle("/geonetfooter", http.HandlerFunc(testUIhandler))
http.Handle(footer.ReturnFooterAssetPattern(), footer.ReturnFooterAssetServer())
http.Handle("/geonetheaderbasic", http.HandlerFunc(testUIhandler))

log.Println("starting server")
Expand Down
10 changes: 9 additions & 1 deletion ui/geonet_footer/footer.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
/* Projects that import the GeoNet header must contain the following CSS in
the HTML files that use it. These are extra styles on top of the standard
the HTML files that use it. These are CSS for some image/s, and extra styles on top of the standard
GeoNet Bootstrap.css file (which also needs to be present) */

.esi-logo {
object-fit: contain;
max-width: 180px;
max-height: 68.7px;
width: 100%;
height: 100%
}

/* Bootstrap overrides - this should be changed in the main Bootstrap file at some point*/
#footer .row {
width: auto !important;
Expand Down
28 changes: 21 additions & 7 deletions ui/geonet_footer/footer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package geonet_footer

import (
"bytes"
_ "embed"
"embed"
"html/template"
"net/http"
"path"
)

//go:embed footer.html
Expand All @@ -13,24 +15,26 @@ var footerTmpl = template.Must(template.New("footer").Parse(footerHTML))
//go:embed images/geonet_logo.svg
var geonetLogo template.HTML

//go:embed images/gns_logo.svg
var gnsLogo template.HTML

//go:embed images/toka_tu_ake_nhc_logo.svg
var nhcLogo template.HTML

//go:embed images/toka_tu_ake_nhc_logo_stacked.svg
var nhcLogoStacked template.HTML

//go:embed images/footer_pngs/*
var FooterAssetServer embed.FS

const FOOTER_ASSET_DIR = "/images/footer_pngs/"

type FooterConfig struct {
// Whether to use relative links in footer. If false, uses www.geonet.org.nz.
UseRelativeLinks bool
// The origin to be used at the beginning of GeoNet links in the footer.
// Cannot be changed.
Origin string
// The GeoNet, GNS, and NHC logos are fixed and cannot be changed.
// The GeoNet, ESI, and NHC logos are fixed and cannot be changed.
GeoNetLogo template.HTML
GnsLogo template.HTML
EsiLogo string
NhcLogo template.HTML
NhcLogoStacked template.HTML
// URLs for extra logos to be added to the footer can be passed in.
Expand All @@ -54,7 +58,7 @@ func ReturnGeoNetFooter(config FooterConfig) (template.HTML, error) {
var contents template.HTML

config.GeoNetLogo = geonetLogo
config.GnsLogo = gnsLogo
config.EsiLogo = path.Join(FOOTER_ASSET_DIR, "esi_logo_cropped_downsized.png")
config.NhcLogo = nhcLogo
config.NhcLogoStacked = nhcLogoStacked

Expand All @@ -68,3 +72,13 @@ func ReturnGeoNetFooter(config FooterConfig) (template.HTML, error) {
}
return template.HTML(b.String()), nil // nolint: gosec // The source is our HTML file.
}

// ReturnFooterAssetServer returns a handler for serving embedded PNGs for the footer.
func ReturnFooterAssetServer() http.Handler {
return http.FileServer(http.FS(FooterAssetServer))
}

// ReturnFooterAssetPattern returns the path pattern for the footer asset server.
func ReturnFooterAssetPattern() string {
return FOOTER_ASSET_DIR
}
12 changes: 6 additions & 6 deletions ui/geonet_footer/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
</div>
<div class="row">
<div class="col-12 d-md-none pb-4">
<a target="_blank" href="http://www.gns.cri.nz" rel="external noopener noreferrer">
{{.GnsLogo}}
<a target="_blank" href="https://earthsciences.nz" rel="external noopener noreferrer">
<img class="esi-logo" src={{.EsiLogo}} alt="Earth Sciences New Zealand logo">
</a>
</div>
</div>
Expand Down Expand Up @@ -58,17 +58,17 @@
</div>
<div class="col-sm-12 col-md-6 footer-middle-col">
<p>GeoNet is a collaboration between <a target="_blank" href="https://www.naturalhazards.govt.nz" rel="external noopener noreferrer">NHC Toka Tū Ake</a>
and <a target="_blank" href="http://www.gns.cri.nz" rel="external noopener noreferrer">GNS Science</a>.</p>
<p>GeoNet content is copyright <a target="_blank" href="http://www.gns.cri.nz" rel="external noopener noreferrer">GNS Science</a> and is
and <a target="_blank" href="https://earthsciences.nz" rel="external noopener noreferrer">Earth Sciences New Zealand</a>.</p>
<p>GeoNet content is copyright <a target="_blank" href="https://earthsciences.nz" rel="external noopener noreferrer">Earth Sciences New Zealand</a> and is
licensed under a <a rel="license external noopener noreferrer" target="_blank"
href="http://creativecommons.org/licenses/by/3.0/nz/">Creative Commons
Attribution 3.0 New Zealand License</a></p>
</div>
<div class="col-md-3 d-none d-md-block">
<div class="row d-flex align-items-center">
<div class="col-xl-6 col-12">
<a target="_blank" href="http://www.gns.cri.nz" rel="external noopener noreferrer">
{{.GnsLogo}}
<a target="_blank" href="https://earthsciences.nz" rel="external noopener noreferrer">
<img class="esi-logo" src={{.EsiLogo}} alt="Earth Sciences New Zealand logo">
</a>
</div>
<div class="col-xl-6 col-12">
Expand Down
Binary file added ui/geonet_footer/images/footer_pngs/esi_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ui/geonet_header/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="d-none d-lg-block">
<div class="d-flex align-items-center justify-content-end">
<a href="https://www.naturalhazards.govt.nz/" class="external-link text-white ms-4" rel="external noopener noreferrer" target="_blank">NHC Toka Tū Ake</a>
<a href="http://www.gns.cri.nz/" class="external-link text-white ms-4 me-4" rel="external noopener noreferrer" target="_blank">GNS Science</a>
<a href="https://earthsciences.nz" class="external-link text-white ms-4 me-4" rel="external noopener noreferrer" target="_blank">Earth Sciences NZ</a>
<a href="{{.Origin}}/news" class="text-white">
<span>{{$.NewsIcon}}News</span>
</a>
Expand Down Expand Up @@ -168,7 +168,7 @@
</div>
<div class="d-flex align-items-center mobile-menu-link-panel">
<span class="mobile-menu-link d-flex align-items-center"><a href="https://www.naturalhazards.govt.nz/" rel="external noopener noreferrer" target="_blank">NHC Toka Tū Ake</a></span>
<span class="mobile-menu-link d-flex align-items-center"><a href="http://www.gns.cri.nz/" rel="external noopener noreferrer" target="_blank">GNS Science</a></span>
<span class="mobile-menu-link d-flex align-items-center"><a href="https://earthsciences.nz" rel="external noopener noreferrer" target="_blank">Earth Sciences NZ</a></span>
</div>
</div>
</form>
Expand Down
Loading