Show platform flag on every page
This commit is contained in:
parent
ff50ec1040
commit
65c5c3ebf1
7 changed files with 42 additions and 28 deletions
|
@ -40,9 +40,10 @@ type platformDetails struct {
|
|||
|
||||
var (
|
||||
templates = template.Must(template.New("").
|
||||
Funcs(template.FuncMap{
|
||||
Funcs(template.FuncMap{
|
||||
"renderMoney": renderMoney,
|
||||
}).ParseGlob("templates/*.html"))
|
||||
plat platformDetails
|
||||
)
|
||||
|
||||
func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -80,7 +81,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
//get env and render correct platform banner.
|
||||
var env = os.Getenv("ENV_PLATFORM")
|
||||
plat := platformDetails{}
|
||||
plat = platformDetails{}
|
||||
plat.setPlatformDetails(strings.ToLower(env))
|
||||
|
||||
if err := templates.ExecuteTemplate(w, "home", map[string]interface{}{
|
||||
|
@ -168,6 +169,8 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request)
|
|||
"product": product,
|
||||
"recommendations": recommendations,
|
||||
"cart_size": cartSize(cart),
|
||||
"platform_css": plat.css,
|
||||
"platform_name": plat.provider,
|
||||
}); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
@ -275,6 +278,8 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
|
|||
"total_cost": totalPrice,
|
||||
"items": items,
|
||||
"expiration_years": []int{year, year + 1, year + 2, year + 3, year + 4},
|
||||
"platform_css": plat.css,
|
||||
"platform_name": plat.provider,
|
||||
}); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
@ -335,6 +340,8 @@ func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Reque
|
|||
"order": order.GetOrder(),
|
||||
"total_paid": &totalPaid,
|
||||
"recommendations": recommendations,
|
||||
"platform_css": plat.css,
|
||||
"platform_name": plat.provider,
|
||||
}); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
|
|
@ -6,9 +6,7 @@ body {
|
|||
font-family: 'Roboto', sans-serif;
|
||||
}
|
||||
|
||||
hr {
|
||||
border-top: 1px solid #b4b2bb;
|
||||
}
|
||||
|
||||
|
||||
.text-muted {
|
||||
color: #707070;
|
||||
|
@ -232,7 +230,6 @@ footer .footer-top .app {
|
|||
|
||||
footer .footer-top .footer-social {
|
||||
padding: 31px;
|
||||
border-bottom: 1px solid #b4b2bb;
|
||||
}
|
||||
|
||||
footer .footer-top .footer-social h4 {
|
||||
|
@ -243,9 +240,6 @@ footer .footer-top .footer-social div {
|
|||
width: 50%;
|
||||
}
|
||||
|
||||
.footer-top .social {
|
||||
border-right: 1px solid #b4b2bb;
|
||||
}
|
||||
|
||||
.footer-top .social h4 {
|
||||
font-size: 24px;
|
||||
|
@ -264,6 +258,7 @@ footer .footer-top .footer-social div {
|
|||
|
||||
.footer-top .app {
|
||||
justify-content: flex-end;
|
||||
padding-left: 100px;
|
||||
}
|
||||
|
||||
.footer-top .app h4 {
|
||||
|
@ -546,7 +541,6 @@ main.home {
|
|||
.aws-platform,
|
||||
.aws-platform .platform-flag {
|
||||
background-color: #ff9900;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.onprem-platform,
|
||||
|
@ -561,7 +555,7 @@ main.home {
|
|||
|
||||
.azure-platform,
|
||||
.azure-platform .platform-flag {
|
||||
background-color:#F25022;
|
||||
background-color: #f35426;
|
||||
}
|
||||
|
||||
.platform-flag {
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{{ define "cart" }}
|
||||
{{ template "header" . }}
|
||||
|
||||
<div {{ with $.platform_css }} class="{{.}}" {{ end }}>
|
||||
<span class="platform-flag">
|
||||
{{$.platform_name}}
|
||||
</span>
|
||||
</div>
|
||||
<main role="main" class="cart">
|
||||
<div class="cart-bg">
|
||||
<div class="container py-3 px-lg-5 py-lg-5">
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{{ define "error" }}
|
||||
{{ template "header" . }}
|
||||
|
||||
<div {{ with $.platform_css }} class="{{.}}" {{ end }}>
|
||||
<span class="platform-flag">
|
||||
{{$.platform_name}}
|
||||
</span>
|
||||
</div>
|
||||
<main role="main">
|
||||
<div class="py-5">
|
||||
<div class="container bg-light py-3 px-lg-5 py-lg-5">
|
||||
|
|
|
@ -3,12 +3,8 @@
|
|||
<footer class="py-5">
|
||||
<div class="footer-top">
|
||||
<div class="container footer-social">
|
||||
<div class="social">
|
||||
<h5>© 2020 Google Inc - <a href="https://github.com/GoogleCloudPlatform/microservices-demo">Source Code</a></h5>
|
||||
</div>
|
||||
<div class="app">
|
||||
<h5>This website is hosted for demo purposes only. It is not an actual shop. This is not a Google product.</h5>
|
||||
</div>
|
||||
<p>© 2020 Google Inc (<a href="https://github.com/GoogleCloudPlatform/microservices-demo">Source Code</a>) — </p>
|
||||
<p class="footer-disclaimer"> This website is hosted for demo purposes only. It is not an actual shop. This is not a Google product.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{{ define "order" }}
|
||||
{{ template "header" . }}
|
||||
|
||||
<div {{ with $.platform_css }} class="{{.}}" {{ end }}>
|
||||
<span class="platform-flag">
|
||||
{{$.platform_name}}
|
||||
</span>
|
||||
</div>
|
||||
<main role="main" class="order">
|
||||
<div class="py-5">
|
||||
<div class="container py-3 px-lg-5">
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{{ define "product" }}
|
||||
{{ template "header" . }}
|
||||
<div {{ with $.platform_css }} class="{{.}}" {{ end }}>
|
||||
<span class="platform-flag">
|
||||
{{$.platform_name}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<main role="main">
|
||||
<div class="h-product">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue