diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 407ec9f84e..22fe9ae2f8 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -927,6 +927,9 @@ star_guest_user = Sign in to star this repository.
copy_link = Copy
copy_link_success = Link has been copied
copy_link_error = Use ⌘C or Ctrl-C to copy
+copy_branch = Copy
+copy_branch_success = Branch name has been copied
+copy_branch_error = Use ⌘C or Ctrl-C to copy
copied = Copied OK
unwatch = Unwatch
watch = Watch
diff --git a/templates/repo/clone_buttons.tmpl b/templates/repo/clone_buttons.tmpl
index 9eb7fa781d..0a86e586fc 100644
--- a/templates/repo/clone_buttons.tmpl
+++ b/templates/repo/clone_buttons.tmpl
@@ -14,7 +14,7 @@
{{end}}
{{if or (not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))}}
-
+
{{svg "octicon-paste"}}
{{end}}
diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl
index b6bf965a15..798ab7638c 100644
--- a/templates/repo/issue/view_title.tmpl
+++ b/templates/repo/issue/view_title.tmpl
@@ -32,28 +32,29 @@
{{if .Issue.IsPull}}
{{$headHref := .HeadTarget|Escape}}
{{if .HeadBranchHTMLURL}}
- {{$headHref = printf "%s " .HeadBranchHTMLURL $headHref}}
+ {{$headHref = printf "%s " (.HeadBranchHTMLURL | Escape) $headHref}}
{{end}}
+ {{$headHref = printf "%s %s " $headHref (.i18n.Tr "repo.copy_branch") (.i18n.Tr "repo.copy_branch_success") (.i18n.Tr "repo.copy_branch_error") (.HeadTarget | Escape) (svg "octicon-copy" 14)}}
{{$baseHref := .BaseTarget|Escape}}
{{if .BaseBranchHTMLURL}}
- {{$baseHref = printf "%s " .BaseBranchHTMLURL $baseHref}}
+ {{$baseHref = printf "%s " (.BaseBranchHTMLURL | Escape) $baseHref}}
{{end}}
{{if .Issue.PullRequest.HasMerged}}
{{ $mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.Lang }}
{{if .Issue.OriginalAuthor }}
{{.Issue.OriginalAuthor}}
- {{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Str2html}}
+ {{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}}
{{else}}
{{.Issue.PullRequest.Merger.GetDisplayName}}
- {{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Str2html}}
+ {{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}}
{{end}}
{{else}}
{{if .Issue.OriginalAuthor }}
- {{.Issue.OriginalAuthor}} {{$.i18n.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Str2html}}
+ {{.Issue.OriginalAuthor}} {{$.i18n.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}}
{{else}}
{{.Issue.Poster.GetDisplayName}}
- {{$.i18n.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Str2html}}
+ {{$.i18n.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}}
{{end}}
diff --git a/web_src/js/features/clipboard.js b/web_src/js/features/clipboard.js
index 2c7ad013bd..8d28b4e281 100644
--- a/web_src/js/features/clipboard.js
+++ b/web_src/js/features/clipboard.js
@@ -4,16 +4,18 @@
function onSuccess(btn) {
if (!btn.dataset.content) return;
$(btn).popup('destroy');
+ const oldContent = btn.dataset.content;
btn.dataset.content = btn.dataset.success;
$(btn).popup('show');
- btn.dataset.content = btn.dataset.original;
+ btn.dataset.content = oldContent;
}
function onError(btn) {
if (!btn.dataset.content) return;
+ const oldContent = btn.dataset.content;
$(btn).popup('destroy');
btn.dataset.content = btn.dataset.error;
$(btn).popup('show');
- btn.dataset.content = btn.dataset.original;
+ btn.dataset.content = oldContent;
}
/**
diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less
index 8f9c5ba6b5..cddc2c2e7d 100644
--- a/web_src/less/_repository.less
+++ b/web_src/less/_repository.less
@@ -686,6 +686,15 @@
code {
color: var(--color-primary);
}
+ a[data-clipboard-text] {
+ cursor: pointer;
+ svg {
+ vertical-align: middle;
+ position: relative;
+ top: -2px;
+ right: 1px;
+ }
+ }
}
.pull {