Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions templates/repo/view_file.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,17 @@
{{end}}
</tbody>
</table>
<div class="code-view-menu-list ui fluid popup transition hidden">
<div class="ui column relaxed equal height">
<div class="column">
<div class="ui link list">
<a class="item ref-in-new-issue" href="{{.RepoLink}}/issues/new?body={{URLJoin AppUrl .RepoLink}}/src/commit/{{.CommitID}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.issues.context.reference_issue"}}</a>
{{if $.Permission.CanRead $.UnitTypeIssues}}
<div class="code-view-menu-list ui fluid popup transition hidden">
<div class="ui column relaxed equal height">
<div class="column">
<div class="ui link list">
<a class="item ref-in-new-issue" href="{{.RepoLink}}/issues/new?body={{URLJoin AppUrl .RepoLink}}/src/commit/{{.CommitID}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.issues.context.reference_issue"}}</a>
</div>
</div>
</div>
</div>
</div>
</div>
{{end}}
{{end}}
{{end}}
</div>
Expand Down
14 changes: 14 additions & 0 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2208,6 +2208,10 @@ function searchRepositories() {
}

function showCodeViewMenu() {
if ($('.code-view-menu-list').length === 0) {
return;
}

// Get clicked tr
const $code_tr = $('.code-view td.lines-code.active').parent();

Expand Down Expand Up @@ -2873,6 +2877,11 @@ function selectRange($list, $select, $from) {

// add hashchange to permalink
const $issue = $('a.ref-in-new-issue');

if ($issue.length === 0) {
return;
}

const matched = $issue.attr('href').match(/%23L\d+$|%23L\d+-L\d+$/);
if (matched) {
$issue.attr('href', $issue.attr('href').replace($issue.attr('href').substr(matched.index), `%23L${a}-L${b}`));
Expand All @@ -2888,6 +2897,11 @@ function selectRange($list, $select, $from) {

// add hashchange to permalink
const $issue = $('a.ref-in-new-issue');

if ($issue.length === 0) {
return;
}

const matched = $issue.attr('href').match(/%23L\d+$|%23L\d+-L\d+$/);
if (matched) {
$issue.attr('href', $issue.attr('href').replace($issue.attr('href').substr(matched.index), `%23${$select.attr('rel')}`));
Expand Down