git ssb

30+

cel / git-ssb-web



Commit 1b7253ee8c5a23c7ec17bd44c7a7753732087c88

Streamline tag and branch updates in activity view

Charles Lehner committed on 4/21/2016, 2:33:01 AM
Parent: 5d337c4159aafea99132ed379d8507ff68f8f024

Files changed

index.jschanged
locale/en.jsonchanged
locale/eo.jsonchanged
index.jsView
@@ -1456,25 +1456,34 @@
14561456 // return renderFeedItem(msg, cb)
14571457 // TODO: render post, issue, pull-request
14581458 }
14591459
1460- var refs = c.refs ? Object.keys(c.refs).map(function (ref) {
1461- return {name: ref, value: c.refs[ref]}
1462- }) : []
1460+ var branches = []
1461+ var tags = []
1462+ if (c.refs) for (var name in c.refs) {
1463+ var m = name.match(/^refs\/(heads|tags)\/(.*)$/) || [,, name]
1464+ ;(m[1] == 'tags' ? tags : branches)
1465+ .push({name: m[2], value: c.refs[name]})
1466+ }
14631467 var numObjects = c.objects ? Object.keys(c.objects).length : 0
14641468
14651469 var dateStr = new Date(msg.value.timestamp).toLocaleString(req._locale)
14661470 return '<section class="collapse">' +
14671471 link([msg.key], dateStr) + '<br>' +
1468- refs.map(function (update) {
1469- var name = escapeHTML(update.name)
1472+ branches.map(function (update) {
14701473 if (!update.value) {
1471- return req._t('DeletedBranch', {branch: name})
1474+ return '<s>' + escapeHTML(update.name) + '</s><br/>'
14721475 } else {
14731476 var commitLink = link([repo.id, 'commit', update.value])
1474- return name + ' &rarr; <tt>' + commitLink + '</tt>'
1477+ var branchLink = link([repo.id, 'tree', update.name])
1478+ return branchLink + ' &rarr; <tt>' + commitLink + '</tt><br/>'
14751479 }
1476- }).join('<br>') +
1480+ }).join('') +
1481+ tags.map(function (update) {
1482+ return update.value
1483+ ? link([repo.id, 'tag', update.value], update.name)
1484+ : '<s>' + escapeHTML(update.name) + '</s>'
1485+ }).join(', ') +
14771486 '</section>'
14781487 }
14791488
14801489 /* Repo commits */
locale/en.jsonView
@@ -57,9 +57,8 @@
5757 "Tree": "Tree",
5858 "Branch": "Branch",
5959 "Search": "Search",
6060 "PushedObjects": "Pushed %{smart_count} object |||| Pushed %{smart_count} objects",
61- "DeletedBranch": "Deleted %{branch}",
6261 "AuthoredOn": "%{name} authored on %{date}",
6362 "CommittedOn": "%{name} committed on %{date}",
6463 "TaggedOn": "%{name} tagged on %{date}",
6564 "Branches": "Branches",
locale/eo.jsonView
@@ -57,9 +57,8 @@
5757 "Tree": "Arbo",
5858 "Branch": "Branĉo",
5959 "Search": "Serĉi",
6060 "PushedObjects": "Puŝis %{smart_count} objektoj |||| Puŝis %{smart_count} objekto",
61- "DeletedBranch": "Forviis %{branch}",
6261 "AuthoredOn": "%{name} aŭtoris je %{date}",
6362 "CommittedOn": "%{name} enmetis je %{date}",
6463 "TaggedOn": "%{name} etikedis je %{date}",
6564 "Branches": "Branĉoj",

Built with git-ssb-web