Skip to content

Commit

Permalink
web: make new components work for GCP relative paths; fix workflow 20…
Browse files Browse the repository at this point in the history
…0 test
  • Loading branch information
rorycl committed Oct 16, 2023
1 parent 9a052e3 commit a33d280
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 505 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow-pushtag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ jobs:
- id: test
name: test endpoint with curl -Is
run: |
[ "$(curl -Is https://us-central1-github-timeaway-399312.cloudfunctions.net/timeaway/ | head -n 1 | cut -d " " -f 2)" == "500" ]
[ "$(curl -Is https://us-central1-github-timeaway-399312.cloudfunctions.net/timeaway/ | head -n 1 | cut -d " " -f 2)" == "200" ]
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="/static/htmx.min.js"></script>
<script src="/static/hyperscript.js"></script>
<script src="{{ .BaseURL }}/static/htmx.min.js"></script>
<script src="{{ .BaseURL }}/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="/partials/details/hide"></div>
<div hx-trigger="load" hx-get="{{ .BaseURL }}/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="/partials/report" hx-trigger="submit" hx-target="#results">
<form id="trip" hx-post="{{ .BaseURL }}/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="/partials/nocontent" hx-target="closest p" hx-swap="outerHTML">remove</button>
<button type="button" hx-trigger="click" hx-get="{{ .BaseURL }}/partials/nocontent" hx-target="closest p" hx-swap="outerHTML">remove</button>
</p>
{{ end }}
{{ end }}
{{ if not .InputDates }}
<p hx-trigger="load" hx-get="/partials/addtrip" hx-target="closest p" hx-swap="outerHTML">
<p hx-trigger="load" hx-get="{{ .BaseURL }}/partials/addtrip" hx-target="closest p" hx-swap="outerHTML">
</p>
{{ end }}
<div id="rpl"></div>
<p>
<button type="button" hx-trigger="click" hx-get="/partials/addtrip" hx-target="#rpl" hx-swap="outerHTML">add more trips</button>
<button type="button" hx-trigger="click" hx-get="{{ .BaseURL }}/partials/addtrip" hx-target="#rpl" hx-swap="outerHTML">add more trips</button>
</p>
<button class="submit" type="submit">Calculate</button>
</section>
Expand Down
246 changes: 0 additions & 246 deletions web/templates/home.orig.html

This file was deleted.

2 changes: 1 addition & 1 deletion web/templates/partial-addtrip.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<input _="on load set i to previous <input/> if i.value is not null put i.value into my value" type="date" class="start" name="Start" value="2023-01-01" min="2018-01-01" max="2033-01-01" required />
<label>end:</label>
<input _="on click 1 or focus 1 set i to previous <input/> put i.value into my value" type="date" class="end" name="End" value="" min="2018-01-01" max="2033-01-01" required />
<button type="button" hx-trigger="click" hx-get="/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>
<div id="rpl"></div>
2 changes: 1 addition & 1 deletion web/templates/partial-details-hide.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p>Click <span class="underline"
hx-trigger="click"
hx-get="/partials/details/show"
hx-get="./partials/details/show"
hx-target="#showDetails">here</span>
to show details of and background to the calculation method.
</p>
2 changes: 1 addition & 1 deletion web/templates/partial-details-show.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p>Click <span class="underline"
hx-trigger="click"
hx-get="/partials/details/hide"
hx-get="./partials/details/hide"
hx-target="#showDetails">here</span>
to hide these calculation method details.
</p>
Expand Down
Loading

0 comments on commit a33d280

Please sign in to comment.