-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Expandable commit bodies #2980
Expandable commit bodies #2980
Changes from 20 commits
f4a48d2
67fde4d
524f957
053cc1d
7afb927
23b92b8
7f25cd8
65e6a19
ed572c2
3767880
2856f9e
76e640d
f325cf2
a452635
a47c4c1
8f02f61
63fec45
e521e8a
f55878c
083af01
f7592bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1606,3 +1606,11 @@ | |
} | ||
} | ||
} | ||
|
||
.commit-list { | ||
vertical-align: baseline; | ||
} | ||
|
||
.commit-body { | ||
white-space: pre-wrap; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
<th class="three wide right aligned">{{.i18n.Tr "repo.commits.date"}}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tbody class="commit-list"> | ||
{{ $r:= List .Commits}} | ||
{{range $r}} | ||
<tr> | ||
|
@@ -61,6 +61,10 @@ | |
</td> | ||
<td class="message collapsing"> | ||
<span class="has-emoji{{if gt .ParentCount 1}} grey text{{end}}">{{RenderCommitMessage .Summary $.RepoLink $.Repository.ComposeMetas}}</span> | ||
{{if IsMultilineCommitMessage .Message}} | ||
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button> | ||
<pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $.RepoLink $.Repository.ComposeMetas}}</pre> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is inline CSS here, could you change it out with a CSS class? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or perhaps hide the button if the user doesn't have JS is another option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @techknowlogick I think for this inline style is ok There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree it's not the prettiest, but the |
||
{{end}} | ||
{{template "repo/commit_status" .Status}} | ||
</td> | ||
<td class="grey text right aligned">{{TimeSince .Author.When $.Lang}}</td> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<table id="repo-files-table" class="ui fixed single line table"> | ||
<thead> | ||
<tr> | ||
<tr class="commit-list"> | ||
<th class="four wide"> | ||
{{if .LatestCommitUser}} | ||
<img class="ui avatar image img-12" src="{{.LatestCommitUser.RelAvatarLink}}" /> | ||
|
@@ -28,6 +28,10 @@ | |
{{end}} | ||
</a> | ||
<span class="grey has-emoji">{{RenderCommitMessage .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}} | ||
{{if IsMultilineCommitMessage .LatestCommit.Message}} | ||
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button> | ||
<pre class="commit-body" style="display: none;">{{RenderCommitBody .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above regarding inline CSS |
||
{{end}} | ||
{{template "repo/commit_status" .LatestCommitStatus}}</span> | ||
</th> | ||
<th class="nine wide"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should differentiate between single and double new-lines, since a single newline may just be wrapping a long line, but a double newline typically indicates the start of a new paragraph. In fact, I think the best solution is just to render newlines as they appear in the commit message (this is what Github does).
Also, note that newlines in a(the crossed-out part is incorrect, ignore it)template.HTML
will not be rendered as newlines. The somewhat hacky way to fix this problem is to replace newlines with<br>
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I initially tried joining on
<br>
but then I looked at Github and saw that they wrapped their commit messages in<pre>
. However, if that's the case I think the method needs to work differently because it already splits on\n
and then I discard the first element and join the others. It seems to render correctly, but I'll see what I can figure out.