Commit 1a22640b2f30c7715e2737f2267a858d400207a7

Thomas de Grivel 2023-01-02T04:08:20

commit message list group

diff --git a/assets/css/app.scss b/assets/css/app.scss
index 56b45a5..6bfa696 100644
--- a/assets/css/app.scss
+++ b/assets/css/app.scss
@@ -88,7 +88,6 @@ $border-radius: 0.375rem;
     background: #faf9ff;
 }
 .commit-avatar {
-    float: left;
     margin-right: 0.5em;
 }
 .clear {
@@ -143,8 +142,13 @@ img.qrcode {
     }
     word-break: break-all;
 }
-table.admin-properties th {
-    min-width: 8em;
+table.properties {
+    td {
+        vertical-align: middle;
+    }
+    th {
+        min-width: 8em;
+    }
 }
 .file_content {
     padding: 0;
diff --git a/lib/kmxgit_web/templates/admin/organisation/show.html.heex b/lib/kmxgit_web/templates/admin/organisation/show.html.heex
index f99b43d..40a546f 100644
--- a/lib/kmxgit_web/templates/admin/organisation/show.html.heex
+++ b/lib/kmxgit_web/templates/admin/organisation/show.html.heex
@@ -1,7 +1,7 @@
 <div class="container-fluid">
   <h1><%= gettext("Organisation %{org}", org: @org.name || @org.slug_) %></h1>
 
-  <table class="table admin-properties">
+  <table class="table properties">
     <tr>
       <th><%= gettext "Id" %></th>
       <td><%= @org.id %></td>
diff --git a/lib/kmxgit_web/templates/admin/repository/show.html.heex b/lib/kmxgit_web/templates/admin/repository/show.html.heex
index e152469..27156a1 100644
--- a/lib/kmxgit_web/templates/admin/repository/show.html.heex
+++ b/lib/kmxgit_web/templates/admin/repository/show.html.heex
@@ -1,7 +1,7 @@
 <div class="container-fluid">
   <h1><%= gettext("Repository %{repo}", repo: Repository.full_slug(@repo)) %></h1>
 
-  <table class="table admin-properties">
+  <table class="table properties">
     <tr>
       <th><%= gettext "Id" %></th>
       <td><%= @repo.id %></td>
diff --git a/lib/kmxgit_web/templates/admin/user/show.html.heex b/lib/kmxgit_web/templates/admin/user/show.html.heex
index 79f3407..289feae 100644
--- a/lib/kmxgit_web/templates/admin/user/show.html.heex
+++ b/lib/kmxgit_web/templates/admin/user/show.html.heex
@@ -1,7 +1,7 @@
 <div class="container-fluid">
   <h1>User <%= User.login(@user) %></h1>
 
-  <table class="table admin-properties">
+  <table class="table properties">
     <tr>
       <th><%= gettext "Id" %></th>
       <td><%= @user.id %></td>
diff --git a/lib/kmxgit_web/templates/organisation/show.html.heex b/lib/kmxgit_web/templates/organisation/show.html.heex
index 643447f..e881157 100644
--- a/lib/kmxgit_web/templates/organisation/show.html.heex
+++ b/lib/kmxgit_web/templates/organisation/show.html.heex
@@ -38,7 +38,7 @@
             <h2><%= gettext "Properties" %></h2>
           </li>
           <li class="list-group-item">
-            <table class="table admin-properties">
+            <table class="table properties">
               <tr>
                 <th><%= gettext "Name" %></th>
                 <td><%= @org.name %></td>
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 e36e16f..ed698b5 100644
--- a/lib/kmxgit_web/templates/repository/show_commit_message.html.heex
+++ b/lib/kmxgit_web/templates/repository/show_commit_message.html.heex
@@ -1,16 +1,38 @@
 <p>
-  <div class="log1">
-    <%= render(KmxgitWeb.UserView, "avatar.html", conn: @conn, email: @git.log1.author_email, size: 48, title: @git.log1.author, class: "commit-avatar") %>
-    <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", @tree] ++ (if @path, do: String.split(@path, "/"), else: []))) <> "##{@git.log1.hash}" %>
-    </span>
-    <span class="date">
-      <%= NaiveDateTime.add(~N[1970-01-01 00:00:00], @git.log1.date) %>
-    </span>
-    <br/>
-    <span class="message" %>
-      <%= @git.log1.message %>
-    </span>
-  </div>
-  <div class="clear"></div>
+  <ul class="list-group">
+    <li class="list-group-item bg-h">
+      <h2>Commit</h2>
+    </li>
+    <li class="list-group-item">
+      <table class="table properties">
+        <tr>
+          <th><%= gettext "Hash" %></th>
+          <td>
+            <%= link id: @git.log1.hash,
+                     to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_commit", @git.log1.hash])) do %>
+              <%= String.slice(@git.log1.hash, 0..7) %>
+            <% end %>
+          </td>
+        </tr>
+        <tr>
+          <th><%= gettext "Author" %></th>
+          <td>
+            <%= render(KmxgitWeb.UserView, "avatar.html", conn: @conn, email: @git.log1.author_email, size: 48, right: @git.log1.author, title: @git.log1.author, class: "commit-avatar") %>
+          </td>
+        </tr>
+        <tr>
+          <th><%= gettext "Date" %></th>
+          <td>
+            <%= link NaiveDateTime.add(~N[1970-01-01 00:00:00], @git.log1.date), to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo, ["_log", @tree] ++ (if @path, do: String.split(@path, "/"), else: []))) <> "##{@git.log1.hash}" %>
+          </td>
+        </tr>
+        <tr>
+          <th><%= gettext "Message" %></th>
+          <td>
+            <pre><%= @git.log1.message %></pre>
+          </td>
+        </tr>
+      </table>
+    </li>
+  </ul>
 </p>
diff --git a/lib/kmxgit_web/templates/repository/show_properties.html.heex b/lib/kmxgit_web/templates/repository/show_properties.html.heex
index f901f64..0c58cb4 100644
--- a/lib/kmxgit_web/templates/repository/show_properties.html.heex
+++ b/lib/kmxgit_web/templates/repository/show_properties.html.heex
@@ -4,7 +4,7 @@
       <h2><%= gettext "Properties" %></h2>
     </li>
     <li class="list-group-item">
-      <table class="table admin-properties">
+      <table class="table properties">
         <%= if @repo.public_access do %>
           <tr>
             <th><%= gettext "Git HTTP" %></th>
diff --git a/lib/kmxgit_web/templates/user/avatar.html.heex b/lib/kmxgit_web/templates/user/avatar.html.heex
index cbf3563..605fefd 100644
--- a/lib/kmxgit_web/templates/user/avatar.html.heex
+++ b/lib/kmxgit_web/templates/user/avatar.html.heex
@@ -1,7 +1,12 @@
+<% right = try do
+if @right, do: " #{@right}", else: nil
+rescue
+_ -> nil
+end %>
 <% user = UserManager.get_user_by_email(@email) %>
 <%= if user do %>
   <% avatar_path = Avatar.path(user, @size) %>
-  <%= link to: Routes.slug_path(@conn, :show, User.login(user)) do %><%= if File.exists?(avatar_path) do %><%= img_tag(Routes.user_path(@conn, :avatar, User.login(user), @size), alt: @title, title: @title, class: @class) %><% else %><img src={Exgravatar.gravatar_url(@email, s: @size)} alt={@title} title={@title} class={@class} /><% end %><% end %>
+  <%= link to: Routes.slug_path(@conn, :show, User.login(user)) do %><%= if File.exists?(avatar_path) do %><%= img_tag(Routes.user_path(@conn, :avatar, User.login(user), @size), alt: @title, title: @title, class: @class) %><% else %><img src={Exgravatar.gravatar_url(@email, s: @size)} alt={@title} title={@title} class={@class} /><% end %><%= right %><% end %>
 <% else %>
   <img src={Exgravatar.gravatar_url(@email, s: @size)} alt={@title} title={@title} class={@class} />
 <% end %>
diff --git a/lib/kmxgit_web/templates/user/show.html.heex b/lib/kmxgit_web/templates/user/show.html.heex
index bfa564e..7e51c51 100644
--- a/lib/kmxgit_web/templates/user/show.html.heex
+++ b/lib/kmxgit_web/templates/user/show.html.heex
@@ -65,7 +65,7 @@
             <h2><%= gettext "Properties" %></h2>
           </li>
           <li class="list-group-item">
-            <table class="table admin-properties">
+            <table class="table properties">
               <tr>
                 <th><%= gettext "Name" %></th>
                 <td><%= @user.name %></td>
diff --git a/priv/static/_assets/app.css b/priv/static/_assets/app.css
index d425cdc..311c5a3 100644
--- a/priv/static/_assets/app.css
+++ b/priv/static/_assets/app.css
@@ -19316,11 +19316,6 @@ pre.wrap {
   background: #faf9ff;
 }
 
-.commit-avatar {
-  float: left;
-  margin-right: 0.5em;
-}
-
 .clear {
   clear: both;
 }
@@ -19382,7 +19377,10 @@ img.qrcode {
   color: #5a60f9;
 }
 
-table.admin-properties th {
+table.properties td {
+  vertical-align: middle;
+}
+table.properties th {
   min-width: 8em;
 }