aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorKN4CK3R <KN4CK3R@users.noreply.github.com>2021-01-21 14:51:17 +0100
committerGitHub <noreply@github.com>2021-01-21 14:51:17 +0100
commit56a89296050096df29d0a653019c194631cc6562 (patch)
tree9082430c3e700d55d5627ce8052d27de6d2bed46 /templates
parent1c230f69d9951af1174f2956064f18e2d135723d (diff)
downloadgitea-56a89296050096df29d0a653019c194631cc6562.tar.gz
gitea-56a89296050096df29d0a653019c194631cc6562.zip
Comment - Reference in new issue (#14366)
* Implemented "Reference in new issue" * Fixed menu style on "pulls/x/files" because "button" has a style. * Added context menu for PR file comments. * Use only a single modal for every comment. * Use current repository as default. Added search filter. * Added suggested changes. * Fixed assignment. Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/diff/box.tmpl2
-rw-r--r--templates/repo/issue/view_content.tmpl4
-rw-r--r--templates/repo/issue/view_content/context_menu.tmpl13
-rw-r--r--templates/repo/issue/view_content/reference_issue_dialog.tmpl30
4 files changed, 43 insertions, 6 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 8533f9b910..f01795ad15 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -164,6 +164,8 @@
</div>
{{end}}
+ {{template "repo/issue/view_content/reference_issue_dialog" .}}
+
{{if .IsSplitStyle}}
<script>
document.addEventListener('DOMContentLoaded', () => {
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index 37628a74e8..0119c12cd8 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -52,7 +52,7 @@
</div>
{{end}}
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}}
- {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "diff" false "IsCommentPoster" $.IsIssuePoster}}
+ {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}}
{{end}}
</div>
</div>
@@ -210,6 +210,8 @@
</div>
</div>
+{{template "repo/issue/view_content/reference_issue_dialog" .}}
+
<div class="hide" id="no-content">
<span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
</div>
diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl
index 41786242ba..f5a965b8a9 100644
--- a/templates/repo/issue/view_content/context_menu.tmpl
+++ b/templates/repo/issue/view_content/context_menu.tmpl
@@ -4,12 +4,15 @@
{{svg "octicon-kebab-horizontal"}}
</a>
<div class="menu">
- {{if .issue}}
- <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>
- {{else}}
- <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>
- {{end}}
+ {{ $referenceUrl := "" }}
+ {{ if .issue }}
+ {{ $referenceUrl = Printf "%s%s/issues/%d#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }}
+ {{ else }}
+ {{ $referenceUrl = Printf "%s%s/pulls/%d/files#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }}
+ {{ end }}
+ <div class="item context clipboard" data-clipboard-text="{{$referenceUrl}}">{{.ctx.i18n.Tr "repo.issues.context.copy_link"}}</div>
<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>
+ <div class="item context reference-issue" data-target="{{.item.ID}}" data-modal="#reference-issue-modal" data-poster="{{.item.Poster.GetDisplayName}}" data-reference="{{$referenceUrl}}">{{.ctx.i18n.Tr "repo.issues.context.reference_issue"}}</div>
{{if or .ctx.Permission.IsAdmin .IsCommentPoster .ctx.HasIssuesOrPullsWritePermission}}
<div class="divider"></div>
<div class="item context edit-content">{{.ctx.i18n.Tr "repo.issues.context.edit"}}</div>
diff --git a/templates/repo/issue/view_content/reference_issue_dialog.tmpl b/templates/repo/issue/view_content/reference_issue_dialog.tmpl
new file mode 100644
index 0000000000..2133df520a
--- /dev/null
+++ b/templates/repo/issue/view_content/reference_issue_dialog.tmpl
@@ -0,0 +1,30 @@
+<div class="ui small modal" id="reference-issue-modal">
+ <div class="header">
+ {{.i18n.Tr "repo.issues.context.reference_issue"}}
+ </div>
+ <div class="content" style="text-align:left">
+ <form class="ui form" action="{{ Printf "%s/issues/new" .Repository.Link }}" method="post">
+ {{.CsrfTokenHtml}}
+ <div class="ui segment content">
+ <div class="field">
+ <span class="text"><strong>{{.i18n.Tr "repository"}}</strong></span>
+ <div class="ui search normal selection dropdown issue_reference_repository_search">
+ <div class="default text">{{.Repository.FullName}}</div>
+ <div class="menu"></div>
+ </div>
+ </div>
+ <div class="field">
+ <span class="text"><strong>{{.i18n.Tr "repo.milestones.title"}}</strong></span>
+ <input name="title" value="" autofocus required maxlength="255" autocomplete="off">
+ </div>
+ <div class="field">
+ <span class="text"><strong>{{.i18n.Tr "repo.issues.reference_issue.body"}}</strong></span>
+ <textarea name="content" class="form-control"></textarea>
+ </div>
+ <div class="text right">
+ <button class="ui green button">{{.i18n.Tr "repo.issues.create"}}</button>
+ </div>
+ </div>
+ </form>
+ </div>
+</div>