Skip to content

Commit

Permalink
Fix all commits having showing button for multiline commits
Browse files Browse the repository at this point in the history
  • Loading branch information
sondr3 committed Nov 26, 2017
1 parent f4a48d2 commit 67fde4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/templates/helper.go
Expand Up @@ -112,6 +112,7 @@ func NewFuncMap() []template.FuncMap {
"RenderCommitMessageLink": RenderCommitMessageLink,
"RenderCommitBody": RenderCommitBody,
"RenderCommitBodyLink": RenderCommitBodyLink,
"IsMultilineCommitMessage": IsMultilineCommitMessage,
"ThemeColorMetaTag": func() string {
return setting.UI.ThemeColorMetaTag
},
Expand Down Expand Up @@ -306,6 +307,15 @@ func renderCommitBody(msg string, opts markup.RenderIssueIndexPatternOptions) te
return template.HTML(strings.Join(body, "\n"))
}

func IsMultilineCommitMessage(msg string) bool {
msgLines := strings.Split(strings.TrimSpace(msg), "\n")
if len(msgLines) > 1 {
return true
} else {
return false
}
}

// Actioner describes an action
type Actioner interface {
GetOpType() models.ActionType
Expand Down
2 changes: 2 additions & 0 deletions templates/repo/commits_table.tmpl
Expand Up @@ -61,8 +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>
<p class="commit-body" style="display: none;">{{RenderCommitBody .Message $.RepoLink $.Repository.ComposeMetas}}</span>
{{end}}
{{template "repo/commit_status" .Status}}
</td>
<td class="grey text right aligned">{{TimeSince .Author.When $.Lang}}</td>
Expand Down

0 comments on commit 67fde4d

Please sign in to comment.