git ssb

0+

dangerousbeans / yap



forked from Dominic / yap

Tree: 8c686fb2b73c28246604759c61d6636e2812d871

Files: 8c686fb2b73c28246604759c61d6636e2812d871 / apis / publish.js

1025 bytesRaw
1var u = require('../util')
2var Translations = require('../translations')
3
4module.exports = function (sbot) {
5 return function (opts, apply, req) {
6 var context = req.cookies
7 var id = opts.id
8 var tr = Translations(context.lang)
9
10 var content = opts.content || opts.meta || {}
11 return ['form', {name: 'publish', method: 'POST'},
12 //selected id to post from. this should
13 //be a dropdown, that only defaults to context.id
14 (
15 id ?
16 ['input', { name: 'id', value: id, type: 'hidden'}] :
17 apply('identitySelect', {restrict: content.recps, main: false})
18 ),
19 // opts.suggestedRecps ? api('suggestedRecipients', {suggestedRecps: opts.suggestedRecps, content: content}) : '',
20 //root + branch. not shown in interface.
21 u.createHiddenInputs(content, 'content'),
22 opts.inputs,
23 ['button', {type: 'submit', name: 'type', value:'preview'}, opts.name || tr('Publish')],
24 // TODO: lookup mentions before publishing. (disable for now)
25 ]
26 }
27}
28
29
30
31
32
33

Built with git-ssb-web