login

<     >

2023-07-21 13:23:19 (UTC-03:00)

Marcel Rodrigues <marcelgmr@gmail.com>

show more info in repo history

instead of just commit message, also show date and author
the style is also improved a bit

diff --git a/cogit/cogit.lua b/cogit/cogit.lua
index 8c4ea5d..be593e7 100644
--- a/cogit/cogit.lua
+++ b/cogit/cogit.lua
@@ -243,7 +243,7 @@ local function new_cogit(path, port, title, log_level)
         port=tonumber(port) or 8080,
         title=title or "cogit",
         log_level=log_levels[log_level or "INFO"],
-        limit=25,
+        limit=20,
         session_age=3*24*60*60,
         sessions={},
         initialized=false,

diff --git a/view/history.html b/view/history.html
index d02db76..02b8e43 100644
--- a/view/history.html
+++ b/view/history.html
@@ -6,6 +6,16 @@
   <style>
     #nav-bar { float: left; }
     % include view/auth.css
+    #page-nav {
+      font-size: x-large;
+      color: grey;
+    }
+    .page-shift {
+      text-decoration: none;
+      font-weight: bolder;
+      color: blue;
+    }
+    % include view/table.css
   </style>
 </head>
 <body>
@@ -19,32 +29,43 @@
     <a href="/repo/{{$rname}}/commit/{{$first}}/tree/">tree</a>
   </div>
   % include view/auth.html
-  <br>
-  % if $prev then
-  <a href="/repo/{{$rname}}/history/{{$prev:id()}}">&lt</a>
-  % else
-  &lt
-  % end
-  &nbsp;&nbsp;&nbsp;
-  % set i = 0
-  % set next = $commit
-  % while $next and $i < $limit do
-    % set next = $next:parent()
-    % set i = $i + 1
-  % end
-  % if $next then
-  <a href="/repo/{{$rname}}/history/{{$next:id()}}">&gt</a>
-  % else
-  &gt
-  % end
-  <p>Commits:</p>
-  <ul>
+  <br><br>
+  <span id="page-nav">
+    % if $prev then
+    <a class="page-shift" href="/repo/{{$rname}}/history/{{$prev:id()}}">&lt</a>
+    % else
+    &lt
+    % end
+    &nbsp;
+    % set i = 0
+    % set next = $commit
+    % while $next and $i < $limit do
+      % set next = $next:parent()
+      % set i = $i + 1
+    % end
+    % if $next then
+    <a class="page-shift" href="/repo/{{$rname}}/history/{{$next:id()}}">&gt</a>
+    % else
+    &gt
+    % end
+  </span>
+  <table>
+    <tr>
+      <th>date</th>
+      <th>commit</th>
+      <th>author</th>
+    </tr>
     % set i = 0
     % while $commit and $i < $limit do
-    <li><a href="/repo/{{$rname}}/commit/{{$commit:id()}}">{{$commit:summary()}}</a></li>
+    % set sig = $commit:signature()
+    <tr>
+      <td>{{os.date("%Y-%m-%d", $sig.time_)}}</td>
+      <td><a href="/repo/{{$rname}}/commit/{{$commit:id()}}">{{$commit:summary()}}</a></th>
+      <td>{{$sig.email}}</td>
+    </tr>
       % set commit = $commit:parent()
       % set i = $i + 1
     % end
-  </ul>
+  </table>
 </body>
 </html>

diff --git a/view/home.html b/view/home.html
index 49ff88d..43f1e1d 100644
--- a/view/home.html
+++ b/view/home.html
@@ -6,17 +6,7 @@
   <style>
     #nav-bar { float: left; }
     % include view/auth.css
-    table {
-      border-collapse: collapse;
-      display: flex;
-      align-items: center;
-      justify-content: center;
-    }
-    th { background-color: #EEEEEE; }
-    th, td {
-      padding: 3px 12px;
-      border: 1px solid #006;
-    }
+    % include view/table.css
     .private { background-color: #FFFF90; }
   </style>
 </head>
@@ -28,7 +18,7 @@
   <p><em>no repos found</em></p>
   % else
   <br>
-  <table>
+  <table class="center">
     <tr>
       <th>repo</th>
       <th>description</th>

diff --git a/view/table.css b/view/table.css
new file mode 100644
index 0000000..b31e871
--- /dev/null
+++ b/view/table.css
@@ -0,0 +1,13 @@
+    table {
+      border-collapse: collapse;
+    }
+    th { background-color: #EEEEEE; }
+    th, td {
+      padding: 3px 12px;
+      border: 1px solid #006;
+    }
+    .center {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+    }