From 4ad1ebce249519369d24b4ea7da1da62a685627a Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 23 Nov 2012 12:01:47 -0500
Subject: [PATCH] Mostly functional Gitblit Certificate Authority tool

---
 groovy/sendmail-html.groovy |   45 +++++++++++++++++++++++++++------------------
 1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/groovy/sendmail-html.groovy b/groovy/sendmail-html.groovy
index 72de106..0076e83 100644
--- a/groovy/sendmail-html.groovy
+++ b/groovy/sendmail-html.groovy
@@ -115,7 +115,7 @@
 }
 
 // add all mailing lists defined in gitblit.properties or web.xml
-toAddresses.addAll(gitblit.getStrings(Keys.mail.mailingLists))
+toAddresses.addAll(GitBlit.getStrings(Keys.mail.mailingLists))
 
 // add all team mailing lists
 def teams = gitblit.getRepositoryTeams(repository)
@@ -154,6 +154,7 @@
     def mountParameters
 	def forwardSlashChar
 	def includeGravatar
+	def shortCommitIdLength
     def commitCount = 0
     def commands
     def writer = new StringWriter();
@@ -163,6 +164,10 @@
         builder.style(type:"text/css", '''
     .table td {
         vertical-align: middle;
+    }
+    tr.noborder td {
+        border: none;
+        padding-top: 0px;
     }
     .gravatar-column {
         width: 5%; 
@@ -176,14 +181,14 @@
     .status-column {
         width: 10%;
     }
-.table-disable-hover.table tbody tr:hover td,
-.table-disable-hover.table tbody tr:hover th {
-    background-color: inherit;
-}
-.table-disable-hover.table-striped tbody tr:nth-child(odd):hover td,
-.table-disable-hover.table-striped tbody tr:nth-child(odd):hover th {
-  background-color: #f9f9f9;
-}
+    .table-disable-hover.table tbody tr:hover td,
+    .table-disable-hover.table tbody tr:hover th {
+        background-color: inherit;
+    }
+    .table-disable-hover.table-striped tbody tr:nth-child(odd):hover td,
+    .table-disable-hover.table-striped tbody tr:nth-child(odd):hover th {
+      background-color: #f9f9f9;
+    }
     ''')
     }
 
@@ -246,7 +251,7 @@
                     writeCommit(commit)
 
                     // Write detail on that particular commit
-                    tr {
+                    tr('class' : 'noborder') {
                         td (colspan: includeGravatar ? 3 : 2)
                         td (colspan:2) { writeStatusTable(commit) }
                     }
@@ -256,7 +261,7 @@
     }
 
     def writeCommit(commit) {
-        def abbreviated = repository.newObjectReader().abbreviate(commit.id, 8).name()
+        def abbreviated = repository.newObjectReader().abbreviate(commit.id, shortCommitIdLength).name()
         def author = commit.authorIdent.name
         def email = commit.authorIdent.emailAddress
         def message = commit.shortMessage
@@ -288,7 +293,7 @@
             writeStatusLabel("addition", "addition")
         }
         builder.td {
-            a(href:blobDiffUrl(id, header.newPath)) { span(style:'font-family: monospace;', header.newPath) }
+            a(href:blobDiffUrl(id, header.newPath), header.newPath)
         }
     }
 
@@ -297,7 +302,7 @@
             writeStatusLabel("rename", "rename")
         }
         builder.td() {
-            a(href:blobDiffUrl(id, header.newPath)) { span(style : "font-family: monospace; ", header.oldPath + " copied to " + header.newPath) }
+            a(href:blobDiffUrl(id, header.newPath), header.oldPath + " copied to " + header.newPath)
         }
     }
 
@@ -306,7 +311,7 @@
             writeStatusLabel("deletion", "deletion")
         }
         builder.td() {
-            a(href:blobDiffUrl(id, header.oldPath)) { span(style : "font-family: monospace; ", header.oldPath) }
+            a(href:blobDiffUrl(id, header.oldPath), header.oldPath)
         }
     }
 
@@ -315,7 +320,7 @@
 			writeStatusLabel("modification", "modification")
         }
         builder.td() {
-            a(href:blobDiffUrl(id, header.oldPath)) { span(style : "font-family: monospace; ", header.oldPath) }
+            a(href:blobDiffUrl(id, header.oldPath), header.oldPath)
         }
     }
 
@@ -324,7 +329,9 @@
              writeStatusLabel("rename", "rename")
         }
         builder.td() {
-            a(href:blobDiffUrl(id, header.newPath)) { span(style : "font-family: monospace; ", header.olPath + " -> " + header.newPath) }
+            mkp.yield header.oldPath
+			mkp.yieldUnescaped "<b> -&rt; </b>"
+			a(href:blobDiffUrl(id, header.newPath),  header.newPath)
         }
     }
 
@@ -413,6 +420,7 @@
             head {
                 link(rel:"stylesheet", href:"${url}/bootstrap/css/bootstrap.css")
                 link(rel:"stylesheet", href:"${url}/gitblit.css")
+				link(rel:"stylesheet", href:"${url}/bootstrap/css/bootstrap-responsive.css")
                 writeStyle()
             }
             body {
@@ -480,8 +488,9 @@
 mailWriter.forwardSlashChar = forwardSlashChar
 mailWriter.commands = commands
 mailWriter.url = url
-mailWriter.mountParameters = gitblit.getBoolean(Keys.web.mountParameters, true)
-mailWriter.includeGravatar = gitblit.getBoolean(Keys.web.allowGravatar, true)
+mailWriter.mountParameters = GitBlit.getBoolean(Keys.web.mountParameters, true)
+mailWriter.includeGravatar = GitBlit.getBoolean(Keys.web.allowGravatar, true)
+mailWriter.shortCommitIdLength = GitBlit.getInteger(Keys.web.shortCommitIdLength, 8)
 
 def content = mailWriter.write()
 

--
Gitblit v1.9.1