From 7be09563a2311a805aa9308c9d61f5cd7b5b8834 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 19 Jun 2018 16:55:48 +0900 Subject: [PATCH 1/3] Add "Repositories" tab to the dashboard --- .../core/controller/DashboardController.scala | 10 +++++ .../gitbucket/core/dashboard/repos.scala.html | 37 +++++++++++++++++++ .../gitbucket/core/dashboard/tab.scala.html | 1 + 3 files changed, 48 insertions(+) create mode 100644 src/main/twirl/gitbucket/core/dashboard/repos.scala.html diff --git a/src/main/scala/gitbucket/core/controller/DashboardController.scala b/src/main/scala/gitbucket/core/controller/DashboardController.scala index 2c8a9826c..cb01a2525 100644 --- a/src/main/scala/gitbucket/core/controller/DashboardController.scala +++ b/src/main/scala/gitbucket/core/controller/DashboardController.scala @@ -21,6 +21,16 @@ class DashboardController trait DashboardControllerBase extends ControllerBase { self: IssuesService with PullRequestService with RepositoryService with AccountService with UsersAuthenticator => + get("/dashboard/repos")(usersOnly { + val userName = context.loginAccount.get.userName + + html.repos( + getGroupNames(userName), + Nil, + getUserRepositories(userName, withoutPhysicalInfo = true) + ) + }) + get("/dashboard/issues")(usersOnly { searchIssues("created_by") }) diff --git a/src/main/twirl/gitbucket/core/dashboard/repos.scala.html b/src/main/twirl/gitbucket/core/dashboard/repos.scala.html new file mode 100644 index 000000000..c5aa4c609 --- /dev/null +++ b/src/main/twirl/gitbucket/core/dashboard/repos.scala.html @@ -0,0 +1,37 @@ +@(groups: List[String], + recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo], + userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context) +@import gitbucket.core.view.helpers +@gitbucket.core.html.main("Repositories"){ + @gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){ + @gitbucket.core.dashboard.html.tab("repos") +
+ @if(userRepositories.isEmpty){ + No repositories + } else { + @userRepositories.map { repository => +
+
+ @gitbucket.core.helper.html.repositoryicon(repository, true) +
+
+
+ @repository.owner/@repository.name + @if(repository.repository.isPrivate){ + + } +
+ @if(repository.repository.originUserName.isDefined){ + + } + @if(repository.repository.description.isDefined){ +
@repository.repository.description
+ } +
Updated @gitbucket.core.helper.html.datetimeago(repository.repository.lastActivityDate)
+
+
+ } + } +
+ } +} diff --git a/src/main/twirl/gitbucket/core/dashboard/tab.scala.html b/src/main/twirl/gitbucket/core/dashboard/tab.scala.html index 597509f68..ee2c17d79 100644 --- a/src/main/twirl/gitbucket/core/dashboard/tab.scala.html +++ b/src/main/twirl/gitbucket/core/dashboard/tab.scala.html @@ -2,6 +2,7 @@