git ssb

30+

cel / git-ssb-web



Commit 146b882f03f54a5434b1c04f368c8987172fe3ab

refactor serverEmptyRepo to use hyperscript

mix irving committed on 11/10/2016, 7:33:09 AM
Parent: 08cc79deadf85dd2e68e2c46d595570f1b665c91

Files changed

lib/repos/index.jschanged
lib/util.jschanged
lib/repos/index.jsView
@@ -256,30 +256,38 @@
256256 }
257257
258258 R.serveEmptyRepo = function (req, repo) {
259259 if (repo.feed != this.web.myId)
260- return this.renderRepoPage(req, repo, 'code', null, null, pull.once(
261- '<section>' +
262- '<h3>' + req._t('EmptyRepo') + '</h3>' +
263- '</section>'))
260 + return this.renderRepoPage(req, repo, 'code', null, null,
261 + h('section', [
262 + h('h3', req._t('EmptyRepo'))
263 + ])
264 + )
264265
265266 var gitUrl = 'ssb://' + repo.id
266- return this.renderRepoPage(req, repo, 'code', null, null, pull.once(
267- '<section>' +
268- '<h3>' + req._t('initRepo.GettingStarted') + '</h3>' +
269- '<h4>' + req._t('initRepo.CreateNew') + '</h4><pre>' +
270- 'touch ' + req._t('initRepo.README') + '.md\n' +
271- 'git init\n' +
272- 'git add ' + req._t('initRepo.README') + '.md\n' +
273- 'git commit -m "' + req._t('initRepo.InitialCommit') + '"\n' +
274- 'git remote add origin ' + gitUrl + '\n' +
275- 'git push -u origin master</pre>\n' +
276- '<h4>' + req._t('initRepo.PushExisting') + '</h4>\n' +
277- '<pre>git remote add origin ' + gitUrl + '\n' +
278- 'git push -u origin master</pre>' +
279- '</section>'))
267 + return this.renderRepoPage(req, repo, 'code', null, null,
268 + h('section', [
269 + h('h3', req._t('initRepo.GettingStarted')),
270 + h('h4', req._t('initRepo.CreateNew')),
271 + preInitRepo(req, gitUrl),
272 + h('h4', req._t('initRepo.PushExisting')),
273 + preRemote(gitUrl)
274 + ])
275 + )
280276 }
277 +var preInitRepo = (req, gitUrl) => h('pre',
278 +`touch ${req._t('initRepo.README')}.md
279 +git init
280 +git add ${req._t('initRepo.README')}.md
281 +git commit -m ${req._t('initRepo.InitialCommit')}
282 +git remote add origin ${gitUrl}
283 +git push -u origin master`)
281284
285 +var preRemote = (gitUrl) => h('pre',
286 +`git remote add origin ${gitUrl}
287 +git push -u origin master`)
288 +
289 +
282290 R.serveRepoTree = function (req, repo, rev, path) {
283291 var type = repo.isCommitHash(rev) ? 'Tree' : 'Branch'
284292 var title = (path.length ? path.join('/') + ' · ' : '') +
285293 '%{author}/%{repo}' +
lib/util.jsView
@@ -102,17 +102,8 @@
102102 pull.once(after || '')
103103 ])
104104 }
105105
106- //return pull.once(['<nav>'].concat(
107- //links.map(function (link) {
108- //var href = typeof link[0] == 'string' ? link[0] : u.encodeLink(link[0])
109- //var props = link[2] == page ? ' class="active"' : ''
110- //return '<a href="' + href + '"' + props + '>' + link[1] + '</a>'
111- //}), after || '', '</nav>').join('')
112- //)
113-//}
114-
115106 u.hiddenInputs = function (values) {
116107 return Object.keys(values).map(function (key) {
117108 return '<input type="hidden"' +
118109 ' name="' + u.escape(key) + '"' +

Built with git-ssb-web