Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Reference" section to Issue view sidebar #19609

Merged
merged 7 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ func (issue *Issue) PatchURL() string {
return ""
}

func (issue *Issue) ReferenceLink() string {
return fmt.Sprintf("%s#%d", issue.Repo.FullName(), issue.Index)
}

// State returns string representation of issue status.
func (issue *Issue) State() api.StateType {
if issue.IsClosed {
Expand Down
10 changes: 10 additions & 0 deletions templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,16 @@
{{end}}
{{end}}

<div class="ui divider"></div>
<div class="ui reference equal width compact grid">
<div class="row">
<span class="text column">References: {{.Issue.ReferenceLink}}</span>
<span class="copy-button two wide column" data-clipboard-text="{{.Issue.ReferenceLink}}">
{{svg "octicon-copy"}}
</span>
</div>
</div>

{{if and .IsRepoAdmin (not .Repository.IsArchived)}}
<div class="ui divider"></div>
<div class="ui watching">
Expand Down
13 changes: 13 additions & 0 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,19 @@
}
}
}

.ui.reference {
.text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding-right: 1rem;
}

.copy-button {
cursor: pointer;
}
}
}

.comment.form {
Expand Down