Skip to content

Commit d508b8c

Browse files
committed
Merge branch 'master' of https://github.com/mmuraki/gitbucket-gist-plugin into mmuraki-master
2 parents eb1fde7 + 15aca1d commit d508b8c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main/scala/gitbucket/gist/controller/GistController.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,25 @@ trait GistControllerBase extends ControllerBase {
292292
html.editor(count, "", JGitUtil.ContentInfo("text", None, Some("UTF-8")))
293293
}
294294

295+
get("/gist/_public"){
296+
val page = request.getParameter("page") match {
297+
case ""|null => 1
298+
case s => s.toInt
299+
}
300+
val result = getPublicGists((page - 1) * Limit, Limit)
301+
val count = countPublicGists()
302+
303+
val gists: Seq[(Gist, GistInfo)] = result.map { gist =>
304+
val userName = gist.userName
305+
val repoName = gist.repositoryName
306+
val files = getGistFiles(userName, repoName)
307+
val (fileName, source) = files.head
308+
309+
(gist, GistInfo(fileName, source, files.length, getForkedCount(userName, repoName), getCommentCount(userName, repoName)))
310+
}
311+
html.list(None, gists, page, page * Limit < count)
312+
}
313+
295314
////////////////////////////////////////////////////////////////////////////////
296315
//
297316
// Fork Actions

0 commit comments

Comments
 (0)