Skip to content

Commit 93488c2

Browse files
committed
make code-line-menu work in blame
1 parent 859ca47 commit 93488c2

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

templates/repo/blame.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
{{end}}
7676
</tbody>
7777
</table>
78+
<div class="code-line-menu tippy-target">
79+
{{if $.Permission.CanRead $.UnitTypeIssues}}
80+
<a class="item ref-in-new-issue" role="menuitem" data-url-issue-new="{{.RepoLink}}/issues/new" data-url-param-body-link="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}" rel="nofollow noindex">{{ctx.Locale.Tr "repo.issues.context.reference_issue"}}</a>
81+
{{end}}
82+
<a class="item copy-line-permalink" role="menuitem" data-url="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}">{{ctx.Locale.Tr "repo.file_copy_permalink"}}</a>
83+
</div>
7884
</div>
7985
</div>
8086
</div>

web_src/js/features/repo-code.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ function showLineButton() {
102102
}
103103

104104
// find active row and add button
105-
const tr = document.querySelector('.code-view tr.active .lines-code').closest('tr');
106-
const td = tr.querySelector('td');
105+
const tr = document.querySelector('.code-view tr.active');
106+
const td = tr.querySelector('td.lines-num');
107107
const btn = document.createElement('button');
108108
btn.classList.add('code-line-button', 'ui', 'basic', 'button');
109109
btn.innerHTML = svg('octicon-kebab-horizontal');
@@ -148,10 +148,7 @@ export function initRepoCodeView() {
148148
document.selection.empty();
149149
}
150150

151-
// show code view menu marker (don't show in blame page)
152-
if (!isBlame()) {
153-
showLineButton();
154-
}
151+
showLineButton();
155152
});
156153

157154
$(window).on('hashchange', () => {

0 commit comments

Comments
 (0)