Commit db91aed1fa5552019a41c22156528bbe2215531a

Thomas de Grivel 2022-01-09T11:59:00

short commit hash

diff --git a/lib/kmxgit_web/templates/repository/commit.html.heex b/lib/kmxgit_web/templates/repository/commit.html.heex
index fcec2ac..7b791ad 100644
--- a/lib/kmxgit_web/templates/repository/commit.html.heex
+++ b/lib/kmxgit_web/templates/repository/commit.html.heex
@@ -12,12 +12,12 @@
     </h2>
 
     <div class="commit">
-      <div class="date">
-        <%= @commit.date |> String.replace("T", " ") |> String.replace("+", " +") %>
-      </div>
       <div class="author">
         <%= @commit.author %>
       </div>
+      <div class="date">
+        <%= @commit.date |> String.replace("T", " ") |> String.replace("+", " +") %>
+      </div>
       <div class="message" %>
         <%= @commit.message %>
       </div>
diff --git a/lib/kmxgit_web/templates/repository/log.html.heex b/lib/kmxgit_web/templates/repository/log.html.heex
index 63fc752..9bc81a6 100644
--- a/lib/kmxgit_web/templates/repository/log.html.heex
+++ b/lib/kmxgit_web/templates/repository/log.html.heex
@@ -8,7 +8,7 @@
 
   <div class="row">
     <div class="col">
-      <%= if @path do %>
+      <%= if @path && @path != "" do %>
         <hr/>
         <h2><%= link @path, to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_tree", @branch] ++ String.split(@path, "/"))) %></h2>
       <% end %>
@@ -32,7 +32,7 @@
           <%= for commit <- @log do %>
             <tr class="commit">
               <td class="hash">
-                <%= link commit.hash, id: commit.hash, to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_commit", @git.log1.hash])) %>
+                <%= link String.slice(commit.hash, 0..8), id: commit.hash, to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_commit", @git.log1.hash])) %>
               </td>
               <td class="author">
                 <%= commit.author %>
diff --git a/lib/kmxgit_web/templates/repository/show_commit_message.html.heex b/lib/kmxgit_web/templates/repository/show_commit_message.html.heex
index 381041b..7a1ca8c 100644
--- a/lib/kmxgit_web/templates/repository/show_commit_message.html.heex
+++ b/lib/kmxgit_web/templates/repository/show_commit_message.html.heex
@@ -1,13 +1,14 @@
-<%= link to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_log", @branch] ++ (if @path, do: @path |> String.split("/")))) <> "##{@git.log1.hash}" do %>
-  <div class="log1">
-    <div class="date">
-      <%= @git.log1.date |> String.replace("T", " ") |> String.replace("+", " +") %>
-    </div>
-    <div class="author">
-      <%= @git.log1.author %>
-    </div>
-    <div class="message" %>
-      <%= @git.log1.message %>
-    </div>
+<div class="log1">
+  <span class="hash">
+    <%= link String.slice(@git.log1.hash, 0..8), to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_log", @branch] ++ (if @path, do: @path |> String.split("/")))) <> "##{@git.log1.hash}" %>
+  </span>
+  <span class="author">
+    <%= @git.log1.author %>
+  </span>
+  <span class="date">
+    <%= @git.log1.date |> String.replace("T", " ") |> String.replace("+", " +") %>
+  </span>
+  <div class="message" %>
+    <%= @git.log1.message %>
   </div>
-<% end %>
+</div>