From 73f1adb2e84b8b9cd4045bcdd7d9afa72d3875b5 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Tue, 27 Nov 2012 17:13:03 -0500 Subject: [PATCH] Added short commit id column to log and history tables (issue 168) --- groovy/sendmail-html.groovy | 41 +++++++++++++++++++++++++++-------------- 1 files changed, 27 insertions(+), 14 deletions(-) diff --git a/groovy/sendmail-html.groovy b/groovy/sendmail-html.groovy index 11227d4..e0cdecd 100644 --- a/groovy/sendmail-html.groovy +++ b/groovy/sendmail-html.groovy @@ -197,7 +197,11 @@ builder.span('class':'project') { mkp.yield "$type " span('class': 'repository', name ) - mkp.yield " $action ($number commits)" + if (number > 0) { + mkp.yield " $action ($number commits)" + } else { + mkp.yield " $action" + } } } } @@ -234,7 +238,7 @@ } - def writeCommitTable(commits) { + def writeCommitTable(commits, includeChangedPaths=true) { // Write commits table builder.table('class':"table table-disable-hover") { thead { @@ -250,11 +254,13 @@ for (commit in commits) { writeCommit(commit) - // Write detail on that particular commit - tr('class' : 'noborder') { - td (colspan: includeGravatar ? 3 : 2) - td (colspan:2) { writeStatusTable(commit) } - } + if (includeChangedPaths) { + // Write detail on that particular commit + tr('class' : 'noborder') { + td (colspan: includeGravatar ? 3 : 2) + td (colspan:2) { writeStatusTable(commit) } + } + } } } } @@ -329,7 +335,9 @@ writeStatusLabel("rename", "rename") } builder.td() { - a(href:blobDiffUrl(id, header.newPath), header.olPath + " -> " + header.newPath) + mkp.yield header.oldPath + mkp.yieldUnescaped "<b> -&rt; </b>" + a(href:blobDiffUrl(id, header.newPath), header.newPath) } } @@ -439,12 +447,17 @@ switch (command.type) { case ReceiveCommand.Type.CREATE: - def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse() - commitCount += commits.size() - // new branch - // Write header - writeBranchTitle(refType, ref, "created", commits.size()) - writeCommitTable(commits) + def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse() + commitCount += commits.size() + if (refType == 'Branch') { + // new branch + writeBranchTitle(refType, ref, "created", commits.size()) + writeCommitTable(commits, true) + } else { + // new tag + writeBranchTitle(refType, ref, "created", 0) + writeCommitTable(commits, false) + } break case ReceiveCommand.Type.UPDATE: def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse() -- Gitblit v1.9.1