def baseCommitUrl = url + "/commit?r=$repo&h="\r
def baseBlobDiffUrl = url + "/blobdiff/?r=$repo&h="\r
def baseCommitDiffUrl = url + "/commitdiff/?r=$repo&h="\r
+def forwardSlashChar = gitblit.getString(Keys.web.forwardSlashCharacter, '/')\r
\r
if (gitblit.getBoolean(Keys.web.mountParameters, true)) {\r
- repo = repo.replace('/', gitblit.getString(Keys.web.forwardSlashCharacter, '/')).replace('/', '%2F')\r
+ repo = repo.replace('/', forwardSlashChar).replace('/', '%2F')\r
summaryUrl = url + "/summary/$repo"\r
baseCommitUrl = url + "/commit/$repo/"\r
baseBlobDiffUrl = url + "/blobdiff/$repo/"\r
def baseCommitDiffUrl\r
def baseBlobDiffUrl\r
def mountParameters\r
+ def forwardSlashChar\r
+ def includeGravatar\r
def commitCount = 0\r
def commands\r
def writer = new StringWriter();\r
\r
def writeStyle() {\r
builder.style(type:"text/css", '''\r
- a {\r
- text-decoration: none;\r
- }\r
.table td {\r
vertical-align: middle;\r
}\r
}\r
\r
def writeBranchTitle(type, name, action, number) {\r
- builder.h2 {\r
- mkp.yield "$type "\r
- span(style:"font-family: monospace;", name )\r
- mkp.yield " $action ($number commits)"\r
+ builder.div('class' : 'pageTitle') {\r
+ builder.span('class':'project') {\r
+ mkp.yield "$type "\r
+ span('class': 'repository', name )\r
+ mkp.yield " $action ($number commits)"\r
+ }\r
}\r
}\r
\r
def writeBranchDeletedTitle(type, name) {\r
- builder.h2 {\r
- mkp.yield "$type "\r
- span(style:"font-family: monospace;", name )\r
- mkp.yield " deleted"\r
- }\r
+ builder.div('class' : 'pageTitle', 'style':'color:red') {\r
+ builder.span('class':'project') {\r
+ mkp.yield "$type "\r
+ span('class': 'repository', name )\r
+ mkp.yield " deleted"\r
+ }\r
+ }\r
}\r
\r
def commitUrl(RevCommit commit) {\r
}\r
\r
def encoded(String path) {\r
- path.replace('/', '!')\r
+ path.replace('/', forwardSlashChar).replace('/', '%2F')\r
}\r
\r
def blobDiffUrl(objectId, path) {\r
builder.table('class':"table table-disable-hover") {\r
thead {\r
tr {\r
- th(colspan:2, "Author")\r
+ th(colspan: includeGravatar ? 2 : 1, "Author")\r
th( "Commit" )\r
th( "Message" )\r
}\r
\r
// Write detail on that particular commit\r
tr {\r
- td (colspan:2)\r
+ td (colspan: includeGravatar ? 3 : 2)\r
td (colspan:2) { writeStatusTable(commit) }\r
}\r
}\r
}\r
\r
def writeCommit(commit) {\r
- def abbreviated = repository.newObjectReader().abbreviate(commit.id, 6).name()\r
+ def abbreviated = repository.newObjectReader().abbreviate(commit.id, 8).name()\r
def author = commit.authorIdent.name\r
def email = commit.authorIdent.emailAddress\r
def message = commit.shortMessage\r
builder.tr {\r
- td('class':"gravatar-column") {\r
- img(src:gravatarUrl(email), 'class':"img-rounded")\r
- }\r
+ if (includeGravatar) {\r
+ td('class':"gravatar-column") {\r
+ img(src:gravatarUrl(email), 'class':"gravatar")\r
+ }\r
+ }\r
td('class':"author-column", author)\r
td('class':"commit-column") {\r
a(href:commitUrl(commit)) {\r
}\r
td {\r
mkp.yield message\r
- a(href:commitDiffUrl(commit), " [commitdiff]" )\r
+ a('class':'link', href:commitDiffUrl(commit), " [commitdiff]" )\r
}\r
}\r
}\r
\r
- def writeStatusLabel(style, label) {\r
- builder.span('class' : "label " + style, label )\r
+ def writeStatusLabel(style, tooltip) {\r
+ builder.span('class' : style, 'title' : tooltip )\r
}\r
\r
- def writeAddStatusLine(ObjectId id, FileHeader header) {\r
- builder.td('class':"status-column") {\r
- a(href:blobDiffUrl(id, header.newPath)) { writeStatusLabel("label-success", "add") }\r
+ def writeAddStatusLine(ObjectId id, FileHeader header) { \r
+ builder.td('class':'changeType') {\r
+ writeStatusLabel("addition", "addition")\r
}\r
builder.td {\r
- span(style:'font-family: monospace;', header.newPath)\r
+ a(href:blobDiffUrl(id, header.newPath)) { span(style:'font-family: monospace;', header.newPath) }\r
}\r
}\r
\r
def writeCopyStatusLine(ObjectId id, FileHeader header) {\r
- builder.td('class':"status-column") {\r
- a(href:blobDiffUrl(id, header.newPath)) { writeStatusLabel("label-warning", "copy") }\r
+ builder.td('class':'changeType') {\r
+ writeStatusLabel("rename", "rename")\r
}\r
builder.td() {\r
- span(style : "font-family: monospace; ", header.oldPath + " copied to " + header.newPath)\r
+ a(href:blobDiffUrl(id, header.newPath)) { span(style : "font-family: monospace; ", header.oldPath + " copied to " + header.newPath) }\r
}\r
}\r
\r
def writeDeleteStatusLine(ObjectId id, FileHeader header) {\r
- builder.td('class':"status-column") {\r
- a(href:blobDiffUrl(id, header.oldPath)) { writeStatusLabel("label-important", "delete") }\r
+ builder.td('class':'changeType') {\r
+ writeStatusLabel("deletion", "deletion")\r
}\r
builder.td() {\r
- span(style : "font-family: monospace; ", header.oldPath)\r
+ a(href:blobDiffUrl(id, header.oldPath)) { span(style : "font-family: monospace; ", header.oldPath) }\r
}\r
}\r
\r
def writeModifyStatusLine(ObjectId id, FileHeader header) {\r
- builder.td('class':"status-column") {\r
- a(href:blobDiffUrl(id, header.oldPath)) { writeStatusLabel("", "modify") }\r
+ builder.td('class':'changeType') {\r
+ writeStatusLabel("modification", "modification")\r
}\r
builder.td() {\r
- span(style : "font-family: monospace; ", header.oldPath)\r
+ a(href:blobDiffUrl(id, header.oldPath)) { span(style : "font-family: monospace; ", header.oldPath) }\r
}\r
}\r
\r
def writeRenameStatusLine(ObjectId id, FileHeader header) {\r
- builder.td('class':"status-column") {\r
- a(href:blobDiffUrl(id, header.newPath)) { writeStatusLabel("label-info", "rename") }\r
+ builder.td('class':'changeType') {\r
+ writeStatusLabel("rename", "rename")\r
}\r
builder.td() {\r
- span(style : "font-family: monospace; ", header.olPath + " -> " + header.newPath)\r
+ a(href:blobDiffUrl(id, header.newPath)) { span(style : "font-family: monospace; ", header.olPath + " -> " + header.newPath) }\r
}\r
}\r
\r
new CanonicalTreeParser(null, rw.objectReader, commit.tree))\r
}\r
// Write status table\r
- builder.table('class':"table table-condensed table-bordered table-disable-hover") {\r
+ builder.table('class':"plain") {\r
tbody() {\r
for (DiffEntry entry in diffs) {\r
FileHeader header = formatter.toFileHeader(entry)\r
mailWriter.baseCommitUrl = baseCommitUrl\r
mailWriter.baseBlobDiffUrl = baseBlobDiffUrl\r
mailWriter.baseCommitDiffUrl = baseCommitDiffUrl\r
+mailWriter.forwardSlashChar = forwardSlashChar\r
mailWriter.commands = commands\r
mailWriter.url = url\r
mailWriter.mountParameters = gitblit.getBoolean(Keys.web.mountParameters, true)\r
+mailWriter.includeGravatar = gitblit.getBoolean(Keys.web.allowGravatar, true)\r
\r
def content = mailWriter.write()\r
\r
\r
// tell Gitblit to send the message (Gitblit filters duplicate addresses)\r
def repositoryName = repository.name.substring(0, repository.name.length() - 4)\r
-gitblit.sendHtmlMail("${emailprefix}[$repositoryName] ${userModel.displayName} pushed ${mailWriter.commitCount} commits",\r
+gitblit.sendHtmlMail("${emailprefix} ${userModel.displayName} pushed ${mailWriter.commitCount} commits => $repositoryName",\r
content,\r
toAddresses)\r