Eccosia's weather widget wingding challenge for WWG Berlin
go test ./... && go build . && ./go-weather-widget -api_key=YOUR_KEY_TO_WORLD_WEATHER_ONLINE
At the very top our application always renders a template named "layout" - which we define in the tmpl/templates/layouts/layout.tmpl file.
Layout:
- Start the template by defining the "layout" template
{{define "layout"}} {{end}}
- Inside layout render the enclosing
<html></html>
tags. - Inside the
<html></html>
element render the "head" template (defined in the head.tmpl) -{{template "head" .}}
- The dot is to pass the arguments to the head template. - Add the wrapping
<body></body>
element and inside the<html>
element. - Inside your body element, render the template "content" (don't forget to pass in the arguments).
- Define empty "content" and "head" at the very end of your file (to prevent errors and allow rendering with default definitions of those templates.
Now we are ready to implement the "head" template in the tmpl/templates/layouts/head.tmpl file.
Head:
- Define the "head" template in head.tmpl.
- Inside the head template render the
<head></head>
wrapping html tags - Inside the head element render the "title" template.
- Inside the head element render the "styles" template.
- Add empty default "styles" and "title" templates at the end of the file.
There's a comment inside where your implementation should go.
Your task here is to register the function clothes in the helpers FuncMap and call it with the description and the celsius values. Range over the returned values and for each render a <div/>
element with a class of the respective clothing piece.
- Implement BuildTemplate according to instructions
- Implement RenderTemplate according to instructions
Follow the instructions in the file to implement the widgetHandler