aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2019-11-19 12:33:42 -0600
committerLauris BH <lauris@nix.lv>2019-11-19 20:33:42 +0200
commiteb0359cad4b725553c8bca3e95ada9c789c5da0b (patch)
tree2c0fe67141d8d4bafe785c5bf22f0d3b35d64866 /templates/repo
parentaf7f08bca87852d453848be93e2044e697820b87 (diff)
downloadgitea-eb0359cad4b725553c8bca3e95ada9c789c5da0b.tar.gz
gitea-eb0359cad4b725553c8bca3e95ada9c789c5da0b.zip
Context menus for comments (#9043)
* Add quote replies Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/diff/comments.tmpl9
-rw-r--r--templates/repo/issue/view_content.tmpl8
-rw-r--r--templates/repo/issue/view_content/comments.tmpl81
-rw-r--r--templates/repo/issue/view_content/context_menu.tmpl22
4 files changed, 64 insertions, 56 deletions
diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl
index 85c84c6bac..cc62f19a32 100644
--- a/templates/repo/diff/comments.tmpl
+++ b/templates/repo/diff/comments.tmpl
@@ -21,12 +21,7 @@
{{end}}
{{end}}
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) }}
- {{if or $.root.Permission.IsAdmin (eq .Poster.ID $.root.SignedUserID)}}
- <div class="item action">
- <a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
- <a class="delete-comment" href="#" data-comment-id={{.HashTag}} data-url="{{$.root.RepoLink}}/comments/{{.ID}}/delete" data-locale="{{$.root.i18n.Tr "repo.issues.delete_comment_confirm"}}"><i class="octicon octicon-x"></i></a>
- </div>
- {{end}}
+ {{template "repo/issue/view_content/context_menu" Dict "ctx" $.root "item" . "delete" true "diff" true }}
</div>
</div>
<div class="ui attached segment">
@@ -37,7 +32,7 @@
<span class="no-content">{{$.root.i18n.Tr "repo.issues.no_content"}}</span>
{{end}}
</div>
- <div class="raw-content hide">{{.Content}}</div>
+ <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-context="{{$.root.RepoLink}}"></div>
</div>
{{$reactions := .Reactions.GroupByType}}
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index 2379d21e9c..5b5d7c45d7 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -29,11 +29,7 @@
{{if not $.Repository.IsArchived}}
<div class="ui right actions">
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) }}
- {{if or .IsIssueWriter .IsIssuePoster}}
- <div class="item action">
- <a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
- </div>
- {{end}}
+ {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "diff" false }}
</div>
{{end}}
</div>
@@ -45,7 +41,7 @@
<span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
{{end}}
</div>
- <div class="raw-content hide">{{.Issue.Content}}</div>
+ <div id="comment-{{.Issue.ID}}" class="raw-content hide">{{.Issue.Content}}</div>
<div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div>
</div>
{{$reactions := .Issue.Reactions.GroupByType}}
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index 86860fe8f4..1ea626ab84 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -23,28 +23,23 @@
{{else}}
<span class="text grey"><a {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}</span>
{{end}}
- {{if not $.Repository.IsArchived}}
- <div class="ui right actions">
- {{if gt .ShowTag 0}}
- <div class="item tag">
- {{if eq .ShowTag 1}}
- {{$.i18n.Tr "repo.issues.poster"}}
- {{else if eq .ShowTag 2}}
- {{$.i18n.Tr "repo.issues.collaborator"}}
- {{else if eq .ShowTag 3}}
- {{$.i18n.Tr "repo.issues.owner"}}
- {{end}}
- </div>
- {{end}}
- {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) }}
- {{if or $.Permission.IsAdmin (eq .Poster.ID $.SignedUserID)}}
- <div class="item action">
- <a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
- <a class="delete-comment" href="#" data-comment-id={{.HashTag}} data-url="{{$.RepoLink}}/comments/{{.ID}}/delete" data-locale="{{$.i18n.Tr "repo.issues.delete_comment_confirm"}}"><i class="octicon octicon-x"></i></a>
- </div>
- {{end}}
- </div>
- {{end}}
+ {{if not $.Repository.IsArchived}}
+ <div class="ui right actions">
+ {{if gt .ShowTag 0}}
+ <div class="item tag">
+ {{if eq .ShowTag 1}}
+ {{$.i18n.Tr "repo.issues.poster"}}
+ {{else if eq .ShowTag 2}}
+ {{$.i18n.Tr "repo.issues.collaborator"}}
+ {{else if eq .ShowTag 3}}
+ {{$.i18n.Tr "repo.issues.owner"}}
+ {{end}}
+ </div>
+ {{end}}
+ {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) }}
+ {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "diff" false }}
+ </div>
+ {{end}}
</div>
<div class="ui attached segment">
<div class="render-content markdown has-emoji">
@@ -54,7 +49,7 @@
<span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
{{end}}
</div>
- <div class="raw-content hide">{{.Content}}</div>
+ <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
</div>
{{$reactions := .Reactions.GroupByType}}
@@ -277,29 +272,29 @@
<span class="octicon octicon-primitive-dot"></span>
<a class="ui avatar image" href="{{.Poster.HomeLink}}">
<img src="{{.Poster.RelAvatarLink}}">
- </a>
- <span class="text grey">
- {{$.i18n.Tr "repo.issues.dependency.added_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
- </span>
- <div class="detail">
+ </a>
+ <span class="text grey">
+ {{$.i18n.Tr "repo.issues.dependency.added_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
+ </span>
+ <div class="detail">
<span class="octicon octicon-plus"></span>
- <span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></span>
- </div>
- </div>
+ <span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></span>
+ </div>
+ </div>
{{else if eq .Type 20}}
<div class="event" id="{{.HashTag}}">
- <span class="octicon octicon-primitive-dot"></span>
- <a class="ui avatar image" href="{{.Poster.HomeLink}}">
- <img src="{{.Poster.RelAvatarLink}}">
- </a>
- <span class="text grey">
- {{$.i18n.Tr "repo.issues.dependency.removed_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
- </span>
- <div class="detail">
- <span class="text grey octicon octicon-trashcan"></span>
- <span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></span>
- </div>
- </div>
+ <span class="octicon octicon-primitive-dot"></span>
+ <a class="ui avatar image" href="{{.Poster.HomeLink}}">
+ <img src="{{.Poster.RelAvatarLink}}">
+ </a>
+ <span class="text grey">
+ {{$.i18n.Tr "repo.issues.dependency.removed_dependency" .Poster.HomeLink (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
+ </span>
+ <div class="detail">
+ <span class="text grey octicon octicon-trashcan"></span>
+ <span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></span>
+ </div>
+ </div>
{{else if eq .Type 22}}
<div class="event" id="{{.HashTag}}">
<span class="octicon octicon-{{.Review.Type.Icon}} issue-symbol"></span>
diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl
new file mode 100644
index 0000000000..468e004c91
--- /dev/null
+++ b/templates/repo/issue/view_content/context_menu.tmpl
@@ -0,0 +1,22 @@
+{{if .ctx.IsSigned}}
+<div class="item action ui pointing top right custom dropdown context-dropdown">
+ <a class="context-menu">
+ <i class="fa fa-ellipsis-h"></i>
+ </a>
+ <div class="menu">
+ {{if .diff}}
+ <div class="item context clipboard" data-clipboard-text="{{Printf "%s%s/pulls/%d/files#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag}}">{{.ctx.i18n.Tr "repo.issues.context.copy_link"}}</div>
+ {{else}}
+ <div class="item context clipboard" data-clipboard-text="{{Printf "%s%s/issues/%d#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag}}">{{.ctx.i18n.Tr "repo.issues.context.copy_link"}}</div>
+ {{end}}
+ <div class="item context quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.ID}}">{{.ctx.i18n.Tr "repo.issues.context.quote_reply"}}</div>
+ {{if or .ctx.Permission.IsAdmin (eq .item.Poster.ID .ctx.SignedUserID)}}
+ <div class="divider"></div>
+ <div class="item context edit-content">{{.ctx.i18n.Tr "repo.issues.context.edit"}}</div>
+ {{if .delete}}
+ <div class="item context delete-comment" data-comment-id={{.item.HashTag}} data-url="{{.ctx.RepoLink}}/comments/{{.item.ID}}/delete" data-locale="{{.ctx.i18n.Tr "repo.issues.delete_comment_confirm"}}">{{.ctx.i18n.Tr "repo.issues.context.delete"}}</div>
+ {{end}}
+ {{end}}
+ </div>
+</div>
+{{end}}