diff options
author | Norwin <noerw@users.noreply.github.com> | 2021-02-19 10:52:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-19 12:52:11 +0200 |
commit | d38ae597e19f58bcd732717fe09c1ea97ab8bb12 (patch) | |
tree | 839f0b3c92a4b98a7be3b8aa316925615c16c76e /templates | |
parent | 6a696b93b1e7e9dc1e7cc51d4eab2932b072170f (diff) | |
download | gitea-d38ae597e19f58bcd732717fe09c1ea97ab8bb12.tar.gz gitea-d38ae597e19f58bcd732717fe09c1ea97ab8bb12.zip |
Add UI to delete tracked times (#14100)
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments_delete_time.tmpl | 21 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index b971c6b1ae..cfacde9648 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -276,6 +276,7 @@ <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}} </span> + {{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }} <div class="detail"> {{svg "octicon-clock"}} <span class="text grey">{{.Content}}</span> @@ -291,6 +292,7 @@ <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.add_time_history" $createdStr | Safe}} </span> + {{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }} <div class="detail"> {{svg "octicon-clock"}} <span class="text grey">{{.Content}}</span> diff --git a/templates/repo/issue/view_content/comments_delete_time.tmpl b/templates/repo/issue/view_content/comments_delete_time.tmpl new file mode 100644 index 0000000000..a28d222f86 --- /dev/null +++ b/templates/repo/issue/view_content/comments_delete_time.tmpl @@ -0,0 +1,21 @@ +{{ if .comment.Time }} {{/* compatibility with time comments made before v1.14 */}} + {{ if (not .comment.Time.Deleted) }} + {{ if (or .ctx.IsAdmin (and .ctx.IsSigned (eq .ctx.SignedUserID .comment.PosterID))) }} + <span class="ui float right"> + <div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}"> + <form method="POST" class="delete-time-form" action="{{.ctx.RepoLink}}/issues/{{.ctx.Issue.Index}}/times/{{.comment.TimeID}}/delete"> + {{.ctx.CsrfTokenHtml}} + </form> + <div class="header">{{.ctx.i18n.Tr "repo.issues.del_time"}}</div> + <div class="actions"> + <div class="ui red approve button">{{.ctx.i18n.Tr "repo.issues.context.delete"}}</div> + <div class="ui cancel button">{{.ctx.i18n.Tr "repo.issues.add_time_cancel"}}</div> + </div> + </div> + <button class="ui icon button compact mini issue-delete-time poping up" data-id="{{.comment.Time.ID}}" data-content="{{.ctx.i18n.Tr "repo.issues.del_time"}}" data-position="top right" data-variation="tiny inverted"> + {{svg "octicon-trashcan"}} + </button> + </span> + {{end}} + {{end}} +{{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 3a21a9271b..9df7d7ed44 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -348,7 +348,7 @@ {{end}} <div class="ui buttons two fluid"> <button class="ui button poping up issue-start-time" data-content='{{.i18n.Tr "repo.issues.start_tracking"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.start_tracking_short"}}</button> - <div class="ui mini modal"> + <div class="ui mini modal issue-start-time-modal"> <div class="header">{{.i18n.Tr "repo.issues.add_time"}}</div> <div class="content"> <form method="POST" id="add_time_manual_form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/times/add" class="ui action input fluid"> |