diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2019-02-18 21:55:04 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-02-18 22:55:04 +0200 |
commit | 44114b38e601c8bf44f575daef1d0e0597f37d1d (patch) | |
tree | d2d271b31bff505a09c2faf04d5fea69a9f9d58c /templates | |
parent | 64ce159a6eacc81962d07a8f5ef7f69c17365363 (diff) | |
download | gitea-44114b38e601c8bf44f575daef1d0e0597f37d1d.tar.gz gitea-44114b38e601c8bf44f575daef1d0e0597f37d1d.zip |
Implement "conversation lock" for issue comments (#5073)
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/issue/view_content.tmpl | 34 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 36 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 85 |
3 files changed, 153 insertions, 2 deletions
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 2b13768d54..7445dcce86 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -69,7 +69,38 @@ {{if and .Issue.IsPull (not $.Repository.IsArchived)}} {{ template "repo/issue/view_content/pull". }} {{end}} - + {{if .IsSigned}} + {{ if or .IsRepoAdmin .IsRepoIssuesWriter (or (not .Issue.IsLocked)) }} + <div class="comment form"> + <a class="avatar" href="{{.SignedUser.HomeLink}}"> + <img src="{{.SignedUser.RelAvatarLink}}"> + </a> + <div class="content"> + <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post"> + {{template "repo/issue/comment_tab" .}} + {{.CsrfTokenHtml}} + <input id="status" name="status" type="hidden"> + <div class="text right"> + {{if and (or .IsIssueWriter .IsIssuePoster) (not .DisableStatusChange)}} + {{if .Issue.IsClosed}} + <div id="status-button" class="ui green basic button" tabindex="6" data-status="{{.i18n.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen"> + {{.i18n.Tr "repo.issues.reopen_issue"}} + </div> + {{else}} + <div id="status-button" class="ui red basic button" tabindex="6" data-status="{{.i18n.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.close_comment_issue"}}" data-status-val="close"> + {{.i18n.Tr "repo.issues.close_issue"}} + </div> + {{end}} + {{end}} + <button class="ui green button" tabindex="5"> + {{.i18n.Tr "repo.issues.create_comment"}} + </button> + </div> + </form> + </div> + </div> + {{ end }} + {{else}} {{if .Repository.IsArchived}} <div class="ui warning message"> {{if .Issue.IsPull}} @@ -114,6 +145,7 @@ </div> {{end}} {{end}} + {{end}} </ui> </div> diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 6fe09221c3..ac7e9a2332 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -2,7 +2,11 @@ {{range .Issue.Comments}} {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }} - <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE, 22 = REVIEW --> + <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, + 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, + 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, + 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE, + 22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED --> {{if eq .Type 0}} <div class="comment" id="{{.HashTag}}"> <a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> @@ -355,5 +359,35 @@ {{end}} {{end}} </div> + {{else if eq .Type 23}} + <div class="event"> + <span class="octicon octicon-lock" + style="font-size:20px;margin-left:-28.5px; margin-right: -1px"></span> + <a class="ui avatar image" href="{{.Poster.HomeLink}}"> + <img src="{{.Poster.RelAvatarLink}}"> + </a> + + {{ if .Content }} + <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> + {{$.i18n.Tr "repo.issues.lock_with_reason" .Content $createdStr | Safe}} + </span> + {{ else }} + <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> + {{$.i18n.Tr "repo.issues.lock_no_reason" $createdStr | Safe}} + </span> + {{ end }} + </div> + {{else if eq .Type 24}} + <div class="event"> + <span class="octicon octicon-key" + style="font-size:20px;margin-left:-28.5px; margin-right: -1px"></span> + <a class="ui avatar image" href="{{.Poster.HomeLink}}"> + <img src="{{.Poster.RelAvatarLink}}"> + </a> + + <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> + {{$.i18n.Tr "repo.issues.unlock_comment" $createdStr | Safe}} + </span> + </div> {{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 8cb01fe00e..47bf67f903 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -335,6 +335,91 @@ </div> {{end}} </div> + + {{ if .IsRepoAdmin }} + <div class="ui divider"></div> + <div class="ui watching"> + <div> + <button class="fluid ui show-modal button {{if .Issue.IsLocked }} negative {{ end }}" data-modal="#lock"> + {{if .Issue.IsLocked}} + <i class="octicon octicon-key"></i> + {{.i18n.Tr "repo.issues.unlock"}} + {{else}} + <i class="octicon octicon-lock"></i> + {{.i18n.Tr "repo.issues.lock"}} + {{end}} + </button> + </form> + </div> + </div> + + + <div class="ui tiny modal" id="lock"> + <div class="header"> + {{ if .Issue.IsLocked }} + {{.i18n.Tr "repo.issues.unlock.title"}} + {{ else }} + {{.i18n.Tr "repo.issues.lock.title"}} + {{ end }} + </div> + <div class="content"> + <div class="ui warning message text left"> + {{ if .Issue.IsLocked }} + {{.i18n.Tr "repo.issues.unlock.notice_1"}}<br> + {{.i18n.Tr "repo.issues.unlock.notice_2"}}<br> + {{ else }} + {{.i18n.Tr "repo.issues.lock.notice_1"}}<br> + {{.i18n.Tr "repo.issues.lock.notice_2"}}<br> + {{.i18n.Tr "repo.issues.lock.notice_3"}}<br> + {{ end }} + </div> + + <form class="ui form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}{{ if .Issue.IsLocked }}/unlock{{ else }}/lock{{ end }}" + method="post"> + {{.CsrfTokenHtml}} + + {{ if not .Issue.IsLocked }} + <div class="field"> + <strong> {{ .i18n.Tr "repo.issues.lock.reason" }} </strong> + </div> + + <div class="field"> + <div class="ui fluid dropdown selection" tabindex="0"> + + <select name="reason"> + <option value=""> </option> + {{range .LockReasons}} + <option value="{{.}}">{{.}}</option> + {{end}} + </select> + <i class="dropdown icon"></i> + + <div class="default text"> </div> + + <div class="menu transition hidden" tabindex="-1" style="display: block !important;"> + {{range .LockReasons}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + </div> + {{ end }} + + <div class="text right actions"> + <div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div> + <button class="ui red button"> + {{ if .Issue.IsLocked }} + {{.i18n.Tr "repo.issues.unlock_confirm"}} + {{ else }} + {{.i18n.Tr "repo.issues.lock_confirm"}} + {{ end }} + </button> + </div> + </form> + </div> + </div> + {{ end }} + </div> </div> {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} |