git ssb

16+

Dominic / patchbay



Commit 7be27d2e405a2a962e2b8b3743cb328dca84c297

Factor out getting repo name as a text node

Charles Lehner authored on 9/25/2016, 6:21:51 PM
Dominic Tarr committed on 10/24/2016, 8:26:19 PM
Parent: 7830521a20a57b285da7357ef05f53b3dd072424

Files changed

modules/git.jschanged
modules/git.jsView
@@ -76,18 +76,26 @@
7676 })
7777 )
7878 }
7979
80-function repoLink(id) {
81- var el = h('a', {href: '#'+id}, id.substr(0, 10) + '…')
80 +function repoText(id) {
81 + var text = document.createTextNode(id.substr(0, 10) + '…')
8282 getAvatar({links: sbot_links, get: sbot_get}, self_id, id,
83- function (err, avatar) {
83 + function (err, avatar) {
8484 if(err) return console.error(err)
85- el.textContent = avatar.name
85 + text.nodeValue = avatar.name
8686 })
87- return el
87 + return text
8888 }
8989
90 +function repoLink(id) {
91 + return h('a', {href: '#'+id}, repoText(id))
92 +}
93 +
94 +function repoName(id) {
95 + return h('ins', repoText(id))
96 +}
97 +
9098 function getIssueState(id, cb) {
9199 pull(
92100 sbot_links({dest: id, rel: 'issues', values: true, reverse: true}),
93101 pull.map(function (msg) {
@@ -131,19 +139,8 @@
131139 }
132140 return t
133141 }
134142
135-function repoName(id, link) {
136- var el = link
137- ? h('a', {href: '#'+id}, id.substr(0, 8) + '…')
138- : h('ins', id.substr(0, 8) + '…')
139- getAvatar({links: sbot_links}, self_id, id, function (err, avatar) {
140- if(err) return console.error(err)
141- el.textContent = avatar.name
142- })
143- return el
144-}
145-
146143 function renderIssueEdit(c) {
147144 var id = c.issue || c.link
148145 return [
149146 c.title ? h('p', 'renamed issue ', message_link(id),
@@ -159,9 +156,9 @@
159156 var branchesT, tagsT, openIssuesT, closedIssuesT, openPRsT, closedPRsT
160157 var forksT
161158 var div = h('div',
162159 h('p', 'git repo ', repoName(msg.key)),
163- c.upstream ? h('p', 'fork of ', repoName(c.upstream, true)) : '',
160 + c.upstream ? h('p', 'fork of ', repoLink(c.upstream)) : '',
164161 h('p', h('code', 'ssb://' + msg.key)),
165162 h('div.git-table-wrapper', {style: {'max-height': '12em'}},
166163 h('table',
167164 branchesT = tableRows(h('tr',
@@ -247,9 +244,9 @@
247244 pull(
248245 getForks(msg.key),
249246 pull.drain(function (fork) {
250247 forksT.append(h('tr', h('td',
251- repoName(fork.id, true),
248 + repoLink(fork.id),
252249 ' by ', h('a', {href: '#'+fork.author}, avatar_name(fork.author)))))
253250 }, function (err) {
254251 if (err) console.error(err)
255252 })
@@ -401,9 +398,9 @@
401398 pull.once({id: msg.key, author: msg.value.author}),
402399 getForks(msg.key)
403400 ]), pull.map(function (fork) {
404401 return h('option', {value: fork.id},
405- repoName(fork.id), ' by ', avatar_name(fork.author))
402 + repoLink(fork.id), ' by ', avatar_name(fork.author))
406403 }))
407404 }),
408405 ':',
409406 headBranchInput,

Built with git-ssb-web