aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/render-msg.js7
-rw-r--r--lib/render.js7
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 316709e..99c4ddf 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -32,8 +32,8 @@ RenderMsg.prototype.toUrl = function (href) {
return this.render.toUrl(href)
}
-RenderMsg.prototype.linkify = function (text) {
- return this.render.linkify(text)
+RenderMsg.prototype.linkify = function (text, opts) {
+ return this.render.linkify(text, opts)
}
RenderMsg.prototype.raw = function (cb) {
@@ -749,8 +749,9 @@ RenderMsg.prototype.gitUpdate = function (cb) {
var path = id && ('/git/' + type + '/' + encodeURIComponent(id)
+ '?msg=' + encodeURIComponent(self.msg.key))
+ '&search=1'
+ var name = ref.replace(/^refs\/(heads|tags)\//, '')
return h('li',
- ref.replace(/^refs\/(heads|tags)\//, ''), ': ',
+ self.linkify(name, {ellipsis: true}), ': ',
id ? h('a', {href: self.render.toUrl(path)}, h('code', id))
: h('em', 'deleted'))
})) : '',
diff --git a/lib/render.js b/lib/render.js
index e6da13c..32085e4 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -192,10 +192,13 @@ Render.prototype.formatSize = function (size) {
return size.toFixed(2) + ' MB'
}
-Render.prototype.linkify = function (text) {
+Render.prototype.linkify = function (text, opts) {
+ var ellipsis = opts && opts.ellipsis
var arr = text.split(u.ssbRefEncRegex)
for (var i = 1; i < arr.length; i += 2) {
- arr[i] = h('a', {href: this.toUrlEnc(arr[i])}, arr[i])
+ var id = arr[i]
+ var text = ellipsis && id.length > 8 ? id.substr(0, 8) + '…' : id
+ arr[i] = h('a', {href: this.toUrlEnc(id)}, text)
}
return arr
}