summaryrefslogtreecommitdiffstats
path: root/templates/base
diff options
context:
space:
mode:
authorNorwin <noerw@users.noreply.github.com>2021-01-21 14:51:52 +0000
committerGitHub <noreply@github.com>2021-01-21 15:51:52 +0100
commitb5570d3e680570343c1552bfc972b19b161209cd (patch)
tree548fbcdb9a760b47c54ac931c0180d87d08029d5 /templates/base
parent56a89296050096df29d0a653019c194631cc6562 (diff)
downloadgitea-b5570d3e680570343c1552bfc972b19b161209cd.tar.gz
gitea-b5570d3e680570343c1552bfc972b19b161209cd.zip
Display current stopwatch in navbar (#14122)
* add notification about running stopwatch to header * serialize seconds, duration in stopwatches api * ajax update stopwatch i should get my testenv working locally... * new variant: hover dialog * noscript compatibility * js: live-update stopwatch time * js live update robustness
Diffstat (limited to 'templates/base')
-rw-r--r--templates/base/head_navbar.tmpl38
1 files changed, 38 insertions, 0 deletions
diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl
index a2b4d4f1d9..efab76f33c 100644
--- a/templates/base/head_navbar.tmpl
+++ b/templates/base/head_navbar.tmpl
@@ -67,6 +67,44 @@
</div>
{{else if .IsSigned}}
<div class="right stackable menu">
+ {{$issueURL := Printf "%s/%s/issues/%d" AppSubUrl .ActiveStopwatch.RepoSlug .ActiveStopwatch.IssueIndex}}
+ <a class="active-stopwatch-trigger item ui label {{if not .ActiveStopwatch}}hidden{{end}}" href="{{$issueURL}}">
+ <span class="text">
+ <span class="fitted item">
+ {{svg "octicon-stopwatch"}}
+ <span class="red" style="position:absolute; right:-0.6em; top:-0.6em;">{{svg "octicon-dot-fill"}}</span>
+ </span>
+ <span class="sr-mobile-only">{{.i18n.Tr "active_stopwatch"}}</span>
+ </span>
+ </a>
+ <div class="ui popup very wide">
+ <div class="df ac">
+ <a class="stopwatch-link df ac" href="{{$issueURL}}">
+ {{svg "octicon-issue-opened"}}
+ <span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span>
+ <span class="ui label blue stopwatch-time my-0 mx-4" data-seconds="{{.ActiveStopwatch.Seconds}}">
+ {{if .ActiveStopwatch}}{{Sec2Time .ActiveStopwatch.Seconds}}{{end}}
+ </span>
+ </a>
+ <form class="stopwatch-commit" method="POST" action="{{$issueURL}}/times/stopwatch/toggle">
+ {{.CsrfTokenHtml}}
+ <button
+ class="ui button mini compact basic icon fitted poping up"
+ data-content="{{.i18n.Tr "repo.issues.stop_tracking"}}"
+ data-position="top right" data-variation="small inverted"
+ >{{svg "octicon-square-fill"}}</button>
+ </form>
+ <form class="stopwatch-cancel" method="POST" action="{{$issueURL}}/times/stopwatch/cancel">
+ {{.CsrfTokenHtml}}
+ <button
+ class="ui button mini compact basic icon fitted poping up"
+ data-content="{{.i18n.Tr "repo.issues.cancel_tracking"}}"
+ data-position="top right" data-variation="small inverted"
+ >{{svg "octicon-trashcan"}}</button>
+ </form>
+ </div>
+ </div>
+
<a href="{{AppSubUrl}}/notifications" class="item poping up" data-content='{{.i18n.Tr "notifications"}}' data-variation="tiny inverted">
<span class="text">
<span class="fitted">{{svg "octicon-bell"}}</span>