git ssb

30+

cel / git-ssb-web



Commit 5dba96e0853a4d7f84670f78b8043ab9bd5adc08

Rename renderRepoPage to serveRepoTemplate

It is a render function, not a serve function
cel committed on 11/22/2016, 3:04:22 AM
Parent: 3d2a5e32855f52ed3827b6f4890b30985f34cca5

Files changed

lib/repos/index.jschanged
lib/repos/issues.jschanged
lib/repos/pulls.jschanged
lib/repos/index.jsView
@@ -159,9 +159,9 @@
159159 '<pre>' + u.escape(err.stack) + '</pre>'
160160 ]))
161161 }
162162
163-R.renderRepoPage = function (req, repo, page, branch, titleTemplate, body) {
163 +R.serveRepoTemplate = function (req, repo, page, branch, titleTemplate, body) {
164164 var self = this
165165 var gitUrl = 'ssb://' + repo.id
166166 var host = req.headers.host || '127.0.0.1:7718'
167167 var path = '/' + encodeURIComponent(repo.id)
@@ -291,9 +291,9 @@
291291 (path.length ? `${path.join('/')} · ` : '') +
292292 '%{author}/%{repo}' +
293293 (repo.head == `refs/heads/${rev}` ? '' : `@${rev}`)
294294
295- return this.renderRepoPage(req, repo, 'code', rev, title,
295 + return this.serveRepoTemplate(req, repo, 'code', rev, title,
296296 u.readNext((cb) => {
297297 repo.getLatestAvailableRev(rev, 10e3, (err, revGot, numSkipped) => {
298298 if (err) return cb(err)
299299 cb(null, cat([
@@ -324,9 +324,9 @@
324324
325325 R.serveRepoActivity = function (req, repo, branch) {
326326 var self = this
327327 var title = req._t('Activity') + ' · %{author}/%{repo}'
328- return self.renderRepoPage(req, repo, 'activity', branch, title, cat([
328 + return self.serveRepoTemplate(req, repo, 'activity', branch, title, cat([
329329 h('h3', req._t('Activity')),
330330 pull(
331331 self.web.ssb.links({
332332 dest: repo.id,
@@ -401,9 +401,9 @@
401401
402402 R.serveRepoCommits = function (req, repo, branch) {
403403 var query = req._u.query
404404 var title = req._t('Commits') + ' · %{author}/%{repo}'
405- return this.renderRepoPage(req, repo, 'commits', branch, title, cat([
405 + return this.serveRepoTemplate(req, repo, 'commits', branch, title, cat([
406406 pull.once('<h3>' + req._t('Commits') + '</h3>'),
407407 pull(
408408 repo.readLog(query.start || branch),
409409 pull.take(20),
@@ -589,15 +589,15 @@
589589 var self = this
590590 return u.readNext(function (cb) {
591591 repo.getCommitParsed(rev, function (err, commit) {
592592 if (err) return cb(null,
593- self.renderRepoPage(req, repo, null, rev, `%{author}/%{repo}@${rev}`,
593 + self.serveRepoTemplate(req, repo, null, rev, `%{author}/%{repo}@${rev}`,
594594 pull.once(self.web.renderError(err))))
595595 var commitPath = [repo.id, 'commit', commit.id]
596596 var treePath = [repo.id, 'tree', commit.id]
597597 var title = u.escape(commit.title) + ' · ' +
598598 '%{author}/%{repo}@' + commit.id.substr(0, 8)
599- cb(null, self.renderRepoPage(req, repo, null, rev, title, cat([
599 + cb(null, self.serveRepoTemplate(req, repo, null, rev, title, cat([
600600 pull.once(
601601 '<h3>' + u.link(commitPath,
602602 req._t('CommitRev', {rev: rev})) + '</h3>' +
603603 '<section class="collapse">' +
@@ -647,9 +647,9 @@
647647 }) + ' · %{author}/%{repo}'
648648 var body = (tag.title + '\n\n' +
649649 tag.body.replace(/-----BEGIN PGP SIGNATURE-----\n[^.]*?\n-----END PGP SIGNATURE-----\s*$/, '')).trim()
650650 var date = tag.tagger.date
651- cb(null, self.renderRepoPage(req, repo, 'tags', tag.object, title,
651 + cb(null, self.serveRepoTemplate(req, repo, 'tags', tag.object, title,
652652 pull.once(
653653 '<section class="collapse">' +
654654 '<h3>' + u.link([repo.id, 'tag', rev], tag.tag) + '</h3>' +
655655 req._t('TaggedOn', {
@@ -787,9 +787,9 @@
787787
788788 /* An unknown message linking to a repo */
789789
790790 R.serveRepoSomething = function (req, repo, id, msg, path) {
791- return this.renderRepoPage(req, repo, null, null, null,
791 + return this.serveRepoTemplate(req, repo, null, null, null,
792792 pull.once('<section><h3>' + u.link([id]) + '</h3>' +
793793 u.json(msg) + '</section>'))
794794 }
795795
@@ -809,9 +809,9 @@
809809 var raw = req._u.query.raw != null
810810 var title = req._t('Update') + ' · %{author}/%{repo}'
811811
812812 if (raw)
813- return self.renderRepoPage(req, repo, 'activity', null, title, pull.once(
813 + return self.serveRepoTemplate(req, repo, 'activity', null, title, pull.once(
814814 '<a href="?" class="raw-link header-align">' +
815815 req._t('Info') + '</a>' +
816816 '<h3>' + req._t('Update') + '</h3>' +
817817 '<section class="collapse">' +
@@ -859,9 +859,9 @@
859859 pull.filter()
860860 )
861861 ])
862862
863- return self.renderRepoPage(req, repo, 'activity', null, title, cat([
863 + return self.serveRepoTemplate(req, repo, 'activity', null, title, cat([
864864 pull.once('<a href="?raw" class="raw-link header-align">' +
865865 req._t('Data') + '</a>' +
866866 '<h3>' + req._t('Update') + '</h3>'),
867867 pull(
@@ -892,9 +892,9 @@
892892 var extension = u.getExtension(filename)
893893 var title = (path.length ? path.join('/') + ' · ' : '') +
894894 '%{author}/%{repo}' +
895895 (repo.head == 'refs/heads/' + rev ? '' : '@' + rev)
896- cb(null, self.renderRepoPage(req, repo, 'code', rev, title, cat([
896 + cb(null, self.serveRepoTemplate(req, repo, 'code', rev, title, cat([
897897 pull.once('<section><form action="" method="get">' +
898898 '<h3>' + req._t(type) + ': ' + rev + ' '),
899899 self.revMenu(req, repo, rev),
900900 pull.once('</h3></form>'),
@@ -937,9 +937,9 @@
937937 var self = this
938938 return u.readNext(cb => {
939939 var title = req._t('Digs') + ' · %{author}/%{repo}'
940940 self.web.getVotes(repo.id, (err, votes) => {
941- cb(null, self.renderRepoPage(req, repo, null, null, title,
941 + cb(null, self.serveRepoTemplate(req, repo, null, null, title,
942942 h('section', [
943943 h('h3', req._t('Digs')),
944944 h('div', `${req._t('Total')}: ${votes.upvotes}`),
945945 h('ul', u.paraSourceMap(Object.keys(votes.upvoters), (feedId, cb) => {
@@ -1010,9 +1010,9 @@
10101010
10111011 R.serveRepoForks = function (req, repo) {
10121012 var hasForks
10131013 var title = req._t('Forks') + ' · %{author}/%{repo}'
1014- return this.renderRepoPage(req, repo, null, null, title, cat([
1014 + return this.serveRepoTemplate(req, repo, null, null, title, cat([
10151015 pull.once('<h3>' + req._t('Forks') + '</h3>'),
10161016 pull(
10171017 this.getForks(repo),
10181018 pull.map(function (msg) {
@@ -1032,9 +1032,9 @@
10321032 }
10331033
10341034 R.serveRepoForkPrompt = function (req, repo) {
10351035 var title = req._t('Fork') + ' · %{author}/%{repo}'
1036- return this.renderRepoPage(req, repo, null, null, title, pull.once(
1036 + return this.serveRepoTemplate(req, repo, null, null, title, pull.once(
10371037 '<form action="" method="post" onreset="history.back()">' +
10381038 '<h3>' + req._t('ForkRepoPrompt') + '</h3>' +
10391039 '<p>' + u.hiddenInputs({ id: repo.id }) +
10401040 '<button class="btn open" type="submit" name="action" value="fork">' +
lib/repos/issues.jsView
@@ -34,9 +34,9 @@
3434 var state = req._u.query.state || 'open'
3535 var newPath = isPRs ? [repo.id, 'compare'] : [repo.id, 'issues', 'new']
3636 var title = req._t('Issues') + ' · %{author}/%{repo}'
3737 var page = isPRs ? 'pulls' : 'issues'
38- return self.repo.renderRepoPage(req, repo, page, null, title, cat([
38 + return self.repo.serveRepoTemplate(req, repo, page, null, title, cat([
3939 pull.once(
4040 (self.web.isPublic ? '' :
4141 '<form class="right-bar" method="get"' +
4242 ' action="' + u.encodeLink(newPath) + '">' +
@@ -85,9 +85,9 @@
8585 /* New Issue */
8686
8787 I.serveRepoNewIssue = function (req, repo, issueId, path) {
8888 var title = req._t('issue.New') + ' · %{author}/%{repo}'
89- return this.repo.renderRepoPage(req, repo, 'issues', null, title, pull.once(
89 + return this.repo.serveRepoTemplate(req, repo, 'issues', null, title, pull.once(
9090 '<h3>' + req._t('issue.New') + '</h3>' +
9191 '<section><form action="" method="post">' +
9292 '<input type="hidden" name="action" value="new-issue">' +
9393 forms.post(req, repo, null, 8) +
@@ -100,9 +100,9 @@
100100 I.serveRepoIssue = function (req, repo, issue, path, postId) {
101101 var self = this
102102 var newestMsg = {key: issue.id, value: {timestamp: issue.created_at}}
103103 var title = u.escape(issue.title) + ' · %{author}/%{repo}'
104- return self.repo.renderRepoPage(req, repo, 'issues', null, title, cat([
104 + return self.repo.serveRepoTemplate(req, repo, 'issues', null, title, cat([
105105 pull.once(
106106 '<h3>' + u.link([issue.id], issue.title) + '</h3>' +
107107 '<code>' + issue.id + '</code>' +
108108 '<section class="collapse">' +
lib/repos/pulls.jsView
@@ -26,9 +26,9 @@
2626 var self = this
2727 var headRepo, authorLink
2828 var page = path[0] || 'activity'
2929 var title = u.escape(pr.title) + ' · %{author}/%{repo}'
30- return self.repo.renderRepoPage(req, repo, 'pulls', null, title, cat([
30 + return self.repo.serveRepoTemplate(req, repo, 'pulls', null, title, cat([
3131 pull.once('<div class="pull-request">' +
3232 '<h3>' + u.link([pr.id], pr.title) + '</h3>' +
3333 '<code>' + pr.id + '</code>'),
3434 u.readOnce(function (cb) {
@@ -248,9 +248,9 @@
248248 var base
249249 var count = 0
250250 var title = req._t('CompareChanges') + ' · %{author}/%{repo}'
251251
252- return self.repo.renderRepoPage(req, repo, 'pulls', null, title, cat([
252 + return self.repo.serveRepoTemplate(req, repo, 'pulls', null, title, cat([
253253 pull.once('<h3>' + req._t('CompareChanges') + '</h3>' +
254254 '<form action="' + u.encodeLink(repo.id) + '/comparing" method="get">' +
255255 '<section>'),
256256 pull.once(req._t('BaseBranch') + ': '),
@@ -346,9 +346,9 @@
346346 var backHref = u.encodeLink([repo.id, 'compare']) + req._u.search
347347 var title = req._t(query.expand ? 'OpenPullRequest': 'ComparingChanges')
348348 var pageTitle = title + ' · %{author}/%{repo}'
349349
350- return self.repo.renderRepoPage(req, repo, 'pulls', null, pageTitle, cat([
350 + return self.repo.serveRepoTemplate(req, repo, 'pulls', null, pageTitle, cat([
351351 pull.once('<h3>' + title + '</h3>'),
352352 u.readNext(function (cb) {
353353 self.web.getRepo(headRepoId, function (err, headRepo) {
354354 if (err) return cb(err)

Built with git-ssb-web