Skip to content

Commit

Permalink
web: update relative paths in home template, server; update README
Browse files Browse the repository at this point in the history
  • Loading branch information
rorycl committed Oct 16, 2023
1 parent a33d280 commit bb1c018
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![test, lint, release and deploy](https://github.com/rorycl/timeaway/actions/workflows/workflow-pushtag.yml/badge.svg)](https://github.com/rorycl/timeaway/actions/workflows/workflow-pushtag.yml)

version v0.6.0 : 15 October 2023
version v0.6.3 : 16 October 2023

A small web app to calculate if the compound length of trips to Schengen
countries by non-EU visitors conform with Regulation (EU) No 610/2013
Expand Down
14 changes: 7 additions & 7 deletions web/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
.underline { color: blue; text-decoration: underline; cursor: pointer}
</style>
<title>{{.Title}}</title>
<script src="{{ .BaseURL }}/static/htmx.min.js"></script>
<script src="{{ .BaseURL }}/static/hyperscript.js"></script>
<script src="./static/htmx.min.js"></script>
<script src="./static/hyperscript.js"></script>
</head>

<body>
Expand All @@ -34,7 +34,7 @@ <h1>Calculator for visits to the Schengen states</h1>
<h2>Background and method</h2>

<div id="showDetails">
<div hx-trigger="load" hx-get="{{ .BaseURL }}/partials/details/hide"></div>
<div hx-trigger="load" hx-get="./partials/details/hide"></div>
</div>

<h2>Make a calculation</h2>
Expand All @@ -43,7 +43,7 @@ <h2>Make a calculation</h2>
rule. The order of the trips isn't important, but they shouldn't overlap in time. As noted in the details above, if they
do overlap, consider the trips a single trip for the purposes of the calculator, or split them on adjoining days.</p>

<form id="trip" hx-post="{{ .BaseURL }}/partials/report" hx-trigger="submit" hx-target="#results">
<form id="trip" hx-post="./partials/report" hx-trigger="submit" hx-target="#results">
<section>

{{ if .InputDates }}
Expand All @@ -53,17 +53,17 @@ <h2>Make a calculation</h2>
<input type="date" class="start" name="Start" value="{{ $date.Start.Format "2006-01-02" }}" min="2018-01-01" max="2033-01-01" required />
<label>end:</label>
<input type="date" class="end" name="End" value="{{ $date.End.Format "2006-01-02" }}" min="2018-01-01" max="2033-01-01" required />
<button type="button" hx-trigger="click" hx-get="{{ .BaseURL }}/partials/nocontent" hx-target="closest p" hx-swap="outerHTML">remove</button>
<button type="button" hx-trigger="click" hx-get="./partials/nocontent" hx-target="closest p" hx-swap="outerHTML">remove</button>
</p>
{{ end }}
{{ end }}
{{ if not .InputDates }}
<p hx-trigger="load" hx-get="{{ .BaseURL }}/partials/addtrip" hx-target="closest p" hx-swap="outerHTML">
<p hx-trigger="load" hx-get="./partials/addtrip" hx-target="closest p" hx-swap="outerHTML">
</p>
{{ end }}
<div id="rpl"></div>
<p>
<button type="button" hx-trigger="click" hx-get="{{ .BaseURL }}/partials/addtrip" hx-target="#rpl" hx-swap="outerHTML">add more trips</button>
<button type="button" hx-trigger="click" hx-get="./partials/addtrip" hx-target="#rpl" hx-swap="outerHTML">add more trips</button>
</p>
<button class="submit" type="submit">Calculate</button>
</section>
Expand Down
2 changes: 0 additions & 2 deletions web/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,11 @@ func Home(w http.ResponseWriter, r *http.Request) {
Title string
Address string
Port string
BaseURL string
InputDates []trips.Holiday
}{
"trip calculator",
ServerAddress,
ServerPort,
BaseURL,
holidays,
}
err = t.Execute(w, data)
Expand Down

0 comments on commit bb1c018

Please sign in to comment.