diff --git a/ui/dev_server/server.go b/ui/dev_server/server.go index 5606508..73d7301 100644 --- a/ui/dev_server/server.go +++ b/ui/dev_server/server.go @@ -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") diff --git a/ui/geonet_footer/footer.css b/ui/geonet_footer/footer.css index 9f54d65..bb587d7 100644 --- a/ui/geonet_footer/footer.css +++ b/ui/geonet_footer/footer.css @@ -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; diff --git a/ui/geonet_footer/footer.go b/ui/geonet_footer/footer.go index fffde1c..5e58ede 100644 --- a/ui/geonet_footer/footer.go +++ b/ui/geonet_footer/footer.go @@ -2,8 +2,10 @@ package geonet_footer import ( "bytes" - _ "embed" + "embed" "html/template" + "net/http" + "path" ) //go:embed footer.html @@ -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. @@ -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 @@ -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 +} diff --git a/ui/geonet_footer/footer.html b/ui/geonet_footer/footer.html index 3625cd4..b7943ce 100644 --- a/ui/geonet_footer/footer.html +++ b/ui/geonet_footer/footer.html @@ -29,8 +29,8 @@
@@ -58,8 +58,8 @@