git ssb

16+

Dominic / patchbay



Commit 038a737d7b268452a2d1ca1cd1e3ade9b5e966ff

add message title section and corresponding module

Michael Williams authored on 12/28/2016, 11:16:39 AM
mix irving committed on 12/30/2016, 9:55:59 PM
Parent: 25a8b716544bd1f58eeba52a1feb6bb5a6eb78ae

Files changed

modules_basic/message.jschanged
modules_basic/message.mcsschanged
modules_basic/post.jschanged
modules_extra/git.jschanged
modules_basic/message.jsView
@@ -11,8 +11,9 @@
1111 message_author: 'first',
1212 message_backlinks: 'first',
1313 message_content: 'first',
1414 message_content_mini: 'first',
15 + message_title: 'first',
1516 message_link: 'first',
1617 message_meta: 'map',
1718 }
1819
@@ -40,8 +41,9 @@
4041 tabindex: '0'
4142 }
4243 }, [
4344 h('header.author', api.message_author(msg)),
45 + h('section.title', api.message_title(msg)),
4446 h('section.meta', api.message_meta(msg)),
4547 h('section.content', content),
4648 h('section.action', api.message_action(msg)),
4749 h('footer.backlinks', api.message_backlinks(msg))
modules_basic/message.mcssView
@@ -5,21 +5,31 @@
55
66 -mini {
77 padding-top: 0.25rem
88 padding-bottom: 0.25rem
9 +
10 + section.content {
11 + clear: none
12 + }
913 }
1014
1115 header.author {
1216 float: left
1317 display: flex
1418 flex-direction: column
1519 }
1620
21 + section.title {
22 + float: left
23 + }
24 +
1725 section.meta {
1826 float: right
1927 }
2028
2129 section.content {
30 + clear: both
31 +
2232 (img) {
2333 max-width: 100%
2434 }
2535 }
modules_basic/post.jsView
@@ -11,22 +11,30 @@
1111 //
1212
1313 exports.needs = { message_link: 'first', markdown: 'first' }
1414
15-exports.gives = 'message_content'
15 +exports.gives = {
16 + message_content: true,
17 + message_title: true
18 +}
1619
1720 exports.create = function (api) {
18- return function (data) {
21 + return {
22 + message_content,
23 + message_title
24 + }
25 +
26 + function message_content (data) {
1927 if(!data.value.content || !data.value.content.text) return
2028
21- var root = data.value.content.root
22- var re = !root ? null : h('span', 're: ', api.message_link(root))
23-
2429 return h('div',
25- re,
2630 api.markdown(data.value.content)
2731 )
32 + }
2833
34 + function message_title (data) {
35 + var root = data.value.content && data.value.content.root
36 + return !root ? null : h('span', 're: ', api.message_link(root))
2937 }
3038 }
3139
3240
modules_extra/git.jsView
@@ -33,9 +33,10 @@
3333
3434 exports.gives = {
3535 message_action: true,
3636 message_meta: true,
37- message_content: true
37 + message_content: true,
38 + message_title: true
3839 }
3940
4041
4142 var self_id = require('../keys').id
@@ -301,10 +302,8 @@
301302 if(c.type === 'git-repo') {
302303 var branchesT, tagsT, openIssuesT, closedIssuesT, openPRsT, closedPRsT
303304 var forksT
304305 var div = h('div',
305- h('p', 'git repo ', repoName(msg.key)),
306- c.upstream ? h('p', 'fork of ', repoLink(c.upstream)) : '',
307306 h('p', h('code', 'ssb://' + msg.key)),
308307 h('div.git-table-wrapper', {style: {'max-height': '12em'}},
309308 h('table',
310309 branchesT = tableRows(h('tr',
@@ -409,9 +408,8 @@
409408 }
410409
411410 if(c.type === 'git-update') {
412411 return [
413- h('p', 'pushed to ', repoLink(c.repo)),
414412 c.refs ? h('ul', Object.keys(c.refs).map(function (ref) {
415413 var rev = c.refs[ref]
416414 return h('li',
417415 shortRefName(ref) + ': ',
@@ -449,25 +447,55 @@
449447 }
450448
451449 if(c.type === 'issue') {
452450 return h('div',
453- h('p', 'opened issue on ', repoLink(c.project)),
454451 c.title ? h('h4', c.title) : '',
455452 api.markdown(c)
456453 )
457454 }
458455
459456 if(c.type === 'pull-request') {
460457 return h('div',
461- h('p', 'opened pull-request ',
462- 'to ', repoLink(c.repo), ':', c.branch, ' ',
463- 'from ', repoLink(c.head_repo), ':', c.head_branch),
464458 c.title ? h('h4', c.title) : '',
465459 api.markdown(c)
466460 )
467461 }
468462 },
469463
464 + message_title: function (msg) {
465 + var c = msg.value.content
466 +
467 + if(c.type === 'git-repo') {
468 + return h('div', [
469 + h('p', 'git repo ', repoName(msg.key)),
470 + c.upstream ? h('p', 'fork of ', repoLink(c.upstream)) : ''
471 + ])
472 + }
473 +
474 + if(c.type === 'git-update') {
475 + return h('p', 'pushed to ', repoLink(c.repo))
476 + }
477 +
478 + if(c.type === 'issue-edit'
479 + || (c.type === 'post' && c.text === '')) {
480 + return h('div',
481 + c.issue ? renderIssueEdit(c) : null,
482 + c.issues ? c.issues.map(renderIssueEdit) : null)
483 + }
484 +
485 + if(c.type === 'issue') {
486 + return h('p', 'opened issue on ', repoLink(c.project))
487 + }
488 +
489 + if(c.type === 'pull-request') {
490 + return h('p', 'opened pull-request ',
491 + 'to ', repoLink(c.repo), ':', c.branch, ' ',
492 + 'from ', repoLink(c.head_repo), ':', c.head_branch
493 + )
494 + }
495 +
496 + },
497 +
470498 message_meta: function (msg, sbot) {
471499 var type = msg.value.content.type
472500 if (type === 'issue' || type === 'pull-request') {
473501 var el = h('em', '...')

Built with git-ssb-web