Commit 51ef99439ee5b79427144eb4872945bb14f243c2

Thomas de Grivel 2024-05-14T16:29:58

public access icons

diff --git a/lib/kmxgit_web/templates/admin/repository/index.html.heex b/lib/kmxgit_web/templates/admin/repository/index.html.heex
index b281113..6e6554b 100644
--- a/lib/kmxgit_web/templates/admin/repository/index.html.heex
+++ b/lib/kmxgit_web/templates/admin/repository/index.html.heex
@@ -7,6 +7,7 @@
       <tr>
         <th><%= link gettext("Id"), to: Routes.admin_repository_path(@conn, :index, search: @search, sort: "id#{if @index.column == "id" && !@index.reverse, do: "-"}") %><%= if @index.column == "id" do %><%= if @index.reverse do %> <i class="fa fa-angle-down"></i><% else %> <i class="fa fa-angle-up"></i><% end %><% end %></th>
         <th><%= link gettext("Owner"), to: Routes.admin_repository_path(@conn, :index, search: @search, sort: "owner#{if @index.column == "owner" && !@index.reverse, do: "-"}") %><%= if @index.column == "owner" do %><%= if @index.reverse do %> <i class="fa fa-angle-down"></i><% else %> <i class="fa fa-angle-up"></i><% end %><% end %></th>
+        <th><%= link gettext("Public access ?"), to: Routes.admin_repository_path(@conn, :index, search: @search, sort: "slug#{if @index.column == "public_access" && !@index.reverse, do: "-"}") %><%= if @index.column == "public_access" do %><%= if @index.reverse do %> <i class="fa fa-angle-down"></i><% else %> <i class="fa fa-angle-up"></i><% end %><% end %></th>
         <th><%= link gettext("Slug"), to: Routes.admin_repository_path(@conn, :index, search: @search, sort: "slug#{if @index.column == "slug" && !@index.reverse, do: "-"}") %><%= if @index.column == "slug" do %><%= if @index.reverse do %> <i class="fa fa-angle-down"></i><% else %> <i class="fa fa-angle-up"></i><% end %><% end %></th>
         <th><%= link gettext("Disk usage"), to: Routes.admin_repository_path(@conn, :index, search: @search, sort: "du#{if @index.column != "du" || (@index.column == "du" && !@index.reverse), do: "-"}") %><%= if @index.column == "du" do %><%= if @index.reverse do %> <i class="fa fa-angle-down"></i><% else %> <i class="fa fa-angle-up"></i><% end %><% end %></th>
         <th><%= gettext("Actions") %></th>
@@ -24,6 +25,13 @@
                 <%= link User.login(owner), to: Routes.admin_user_path(@conn, :show, owner) %>
             <% end %>
           </td>
+          <td>
+            <%= if GitManager.public_access?(Repository.full_slug(repo)) do %>
+              <i class="fa fa-code-fork"></i>
+            <% else %>
+              <i class="fa fa-lock"></i>
+            <% end %>
+          </td>
           <td><%= link Repository.full_slug(repo), to: Routes.admin_repository_path(@conn, :show, repo) %></td>
           <td><%= disk_usage(repo.disk_usage) %></td>
           <td>
diff --git a/lib/kmxgit_web/templates/repository/show_title.html.heex b/lib/kmxgit_web/templates/repository/show_title.html.heex
index 2bfb620..923b656 100644
--- a/lib/kmxgit_web/templates/repository/show_title.html.heex
+++ b/lib/kmxgit_web/templates/repository/show_title.html.heex
@@ -1,4 +1,4 @@
-<h1 id="repo_title"><%= if ! @public_access do %><i class="fa fa-lock"></i> <% end %><%= link Repository.owner_slug(@repo), to: Routes.slug_path(@conn, :show, Repository.owner_slug(@repo)) %>/<%= link @repo.slug, to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo)) %><%= if @path do %>/<%= link @path, to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_tree", @tree] ++ String.split(@path, "/"))) %><% end %></h1>
+<h1 id="repo_title"><%= if @public_access do %><i class="fa fa-code-fork"></i><% else %><i class="fa fa-lock"></i> <% end %><%= link Repository.owner_slug(@repo), to: Routes.slug_path(@conn, :show, Repository.owner_slug(@repo)) %>/<%= link @repo.slug, to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo)) %><%= if @path do %>/<%= link @path, to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_tree", @tree] ++ String.split(@path, "/"))) %><% end %></h1>
 <%= if @repo.forked_from do %>
   <%= gettext("Forked from") %>
   <%= link Repository.full_slug(@repo.forked_from), to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo.forked_from), Repository.splat(@repo.forked_from)) %>