diff options
author | Julian Jørgensen <julian@jtle.dk> | 2024-05-24 21:30:23 +0200 |
---|---|---|
committer | Julian Jørgensen <julian@jtle.dk> | 2024-05-24 21:30:23 +0200 |
commit | 2f83424ce8a0653e6e158318df1511daecf1a42d (patch) | |
tree | b29c1b5c8df940873521d013697209195956151e /templates | |
parent | 19f8454a680c5231df68fee36ed9758587df316c (diff) |
Time format rework
Diffstat (limited to 'templates')
-rw-r--r-- | templates/parts/entry.html | 20 | ||||
-rw-r--r-- | templates/parts/entryRows.html | 18 |
2 files changed, 20 insertions, 18 deletions
diff --git a/templates/parts/entry.html b/templates/parts/entry.html index f99fb90..9f05ffa 100644 --- a/templates/parts/entry.html +++ b/templates/parts/entry.html @@ -1,18 +1,18 @@ -<form id="entry-bar" autocomplete="off" class="status-{{if .Detached}}detached{{else}}{{if .Task}}started{{else}}stopped{{end}}{{end}}"> - <input style="display: none;" value="{{ if .Task }}{{ .Task.Id }}{{end}}" type="text" name="id" /> +<form id="entry-bar" autocomplete="off" class="status-{{if .Detached}}detached{{else}}{{if .Entry}}started{{else}}stopped{{end}}{{end}}"> + <input style="display: none;" value="{{ if .Entry }}{{ .Entry.Id }}{{end}}" type="text" name="id" /> {{ if .Detached }} - <span>{{ if gt .Task.Id -1 }}Redigerer opgave {{ .Task.Id }}{{else}}Redigerer ny opgave{{end}}{{ if .Tracking }}, med opgave i baggrunden!{{else}}.{{end}}</span><br> + <span>{{ if gt .Entry.Id -1 }}Redigerer opgave {{ .Entry.Id }}{{else}}Redigerer ny opgave{{end}}{{ if .Tracking }}, med opgave i baggrunden!{{else}}.{{end}}</span><br> {{end}} <div class="flex just-start"> <div class="entry-box"> <b>Interval</b> <div> <label for="fromTime">Fra: </label> - <input name="from" id="fromTime" type="time" class="form-control" {{if .Task}}value="{{formatTime .Task.From}}" required{{end}} aria-label="Time start"> + <input name="from" id="fromTime" type="time" class="form-control" {{if .Entry}}value="{{.Entry.From}}" required{{end}} aria-label="Time start"> </div> <div> <label for="toTime">Til: </label> - <input name="to" id="toTime" type="time" class="form-control" {{if not .Detached}}disabled{{end}} aria-label="Time stop"> + <input name="to" id="toTime" type="time" class="form-control" {{if .Entry}}value="{{if .Entry.To}}{{.Entry.To}}{{end}}" required{{end}} {{if not .Detached}}disabled{{end}} aria-label="Time stop"> </div> </div> <div class="entry-box"> @@ -30,16 +30,16 @@ </div> <div class="entry-box"> <b>Kommentar</b><br> - <textarea name="comment">{{if .Task}}{{.Task.Comment}}{{end}}</textarea> + <textarea name="comment">{{if .Entry}}{{.Entry.Comment}}{{end}}</textarea> </div> <div class="entry-box"> <b>Status</b><br> - {{ if not .Detached}}<i>{{ if .Task }}I gang{{ else }}Stoppet{{ end }}</i><br>{{end}} - {{ if .Task }}<span>1:34 timer</span>{{ end }} + {{ if not .Detached}}<i>{{ if .Entry }}I gang{{ else }}Stoppet{{ end }}</i><br>{{end}} + {{ if .Entry }}<span>1:34 timer</span>{{ end }} </div> </div> - {{ if .Task }} + {{ if .Entry }} <button hx-put="/save{{if .Detached}}?detached=true{{end}}" hx-trigger="click" @@ -56,7 +56,7 @@ hx-swap="outerHTML" >Tilbage</button> {{ else }} - {{ if .Task }} + {{ if .Entry }} <button hx-post="/stop" hx-trigger="click" diff --git a/templates/parts/entryRows.html b/templates/parts/entryRows.html index 1b364e3..fd14608 100644 --- a/templates/parts/entryRows.html +++ b/templates/parts/entryRows.html @@ -1,12 +1,14 @@ -<tbody hx-trigger="changedTasks from:body" hx-get="/entryRows"> - {{ range $task := .Tasks }} +<tbody hx-swap="outerHTML" hx-trigger="changedEntries from:body" hx-get="/entryRows"> + {{ range $entry := .Entries }} <tr> - <td>{{ $task.Id }}</td> - <td><input type="time" disabled value="{{formatTime $task.From }}" /></td> - <td><input type="time" disabled value="{{formatTime $task.To }}" /></td> - <td>{{ if $task.Tag}}{{ $task.Tag }}{{end}}</td> - <td>{{ $task.Comment }}</td> - <td></td> + <td>{{ $entry.Id }}</td> + <td><input type="time" disabled value="{{$entry.From }}" /></td> + <td><input type="time" disabled value="{{if $entry.To}}{{$entry.To }}{{end}}" /></td> + <td>{{ if $entry.Tag}}{{ $entry.Tag }}{{end}}</td> + <td>{{ $entry.Comment }}</td> + <td> + {{ if $entry.To }}<button hx-trigger="click" hx-swap="outerHTML" hx-target="#entry-bar" hx-get="/edit?id={{$entry.Id}}">e</button>{{end}} + </td> </tr> {{ end }} </tbody> |