diff --git a/lib/kmxgit_web/controllers/admin/user_controller.ex b/lib/kmxgit_web/controllers/admin/user_controller.ex
index 34f062b..ab491d3 100644
--- a/lib/kmxgit_web/controllers/admin/user_controller.ex
+++ b/lib/kmxgit_web/controllers/admin/user_controller.ex
@@ -2,7 +2,9 @@ defmodule KmxgitWeb.Admin.UserController do
use KmxgitWeb, :controller
alias Kmxgit.GitManager
+ alias Kmxgit.RepositoryManager
alias Kmxgit.UserManager
+ alias Kmxgit.UserManager.User
alias KmxgitWeb.ErrorView
def index(conn, _params) do
@@ -16,8 +18,12 @@ defmodule KmxgitWeb.Admin.UserController do
def show(conn, params) do
user = UserManager.get_user(params["id"])
if user do
+ owned_repos = User.owned_repositories(user)
+ contributor_repos = RepositoryManager.list_contributor_repositories(user)
+ repos = owned_repos ++ contributor_repos
conn
|> assign(:page_title, gettext("User %{login}", login: user.slug.slug))
+ |> assign(:repos, repos)
|> assign(:user, user)
|> render("show.html")
else
diff --git a/lib/kmxgit_web/controllers/slug_controller.ex b/lib/kmxgit_web/controllers/slug_controller.ex
index 3c0b871..36dce96 100644
--- a/lib/kmxgit_web/controllers/slug_controller.ex
+++ b/lib/kmxgit_web/controllers/slug_controller.ex
@@ -15,9 +15,11 @@ defmodule KmxgitWeb.SlugController do
else
user = slug.user
if user do
+ owned_repos = User.owned_repositories(user)
+ contributor_repos = RepositoryManager.list_contributor_repositories(user)
+ repos = owned_repos ++ contributor_repos
conn
- |> assign(:contributor_repos, RepositoryManager.list_contributor_repositories(user))
- |> assign(:owned_repos, User.owned_repositories(user))
+ |> assign(:repos, repos)
|> assign(:page_title, gettext("User %{login}", login: user.slug.slug))
|> assign(:user, user)
|> put_view(UserView)
diff --git a/lib/kmxgit_web/templates/admin/user/show.html.heex b/lib/kmxgit_web/templates/admin/user/show.html.heex
index e2986ed..d78a989 100644
--- a/lib/kmxgit_web/templates/admin/user/show.html.heex
+++ b/lib/kmxgit_web/templates/admin/user/show.html.heex
@@ -37,6 +37,18 @@
</td>
</tr>
<tr>
+ <th><%= gettext "Repositories" %></th>
+ <td>
+ <ul>
+ <%= for repo <- @repos do %>
+ <li>
+ <%= link(Repository.full_slug(repo), to: Routes.admin_repository_path(@conn, :show, repo), class: "repo") %>
+ </li>
+ <% end %>
+ </ul>
+ </td>
+ </tr>
+ <tr>
<th><%= gettext "Admin" %></th>
<td><%= @user.is_admin %></td>
</tr>
diff --git a/lib/kmxgit_web/templates/user/show.html.heex b/lib/kmxgit_web/templates/user/show.html.heex
index 817a0f8..ab65bb5 100644
--- a/lib/kmxgit_web/templates/user/show.html.heex
+++ b/lib/kmxgit_web/templates/user/show.html.heex
@@ -20,12 +20,7 @@
<hr/>
<h2><%= gettext "Repositories" %></h2>
<ul>
- <%= for repo <- @owned_repos do %>
- <li>
- <%= link Repository.full_slug(repo), to: Routes.repository_path(@conn, :show, Repository.owner_slug(repo), Repository.splat(repo)) %>
- </li>
- <% end %>
- <%= for repo <- @contributor_repos do %>
+ <%= for repo <- @repos do %>
<li>
<%= link Repository.full_slug(repo), to: Routes.repository_path(@conn, :show, Repository.owner_slug(repo), Repository.splat(repo)) %>
</li>
diff --git a/lib/kmxgit_web/views/admin/user_view.ex b/lib/kmxgit_web/views/admin/user_view.ex
index fdb6fbe..200672b 100644
--- a/lib/kmxgit_web/views/admin/user_view.ex
+++ b/lib/kmxgit_web/views/admin/user_view.ex
@@ -1,3 +1,5 @@
defmodule KmxgitWeb.Admin.UserView do
use KmxgitWeb, :view
+
+ alias Kmxgit.RepositoryManager.Repository
end