Added link to gitea commit to sidebar
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
2026-05-28 19:43:56 +02:00
parent b4c57b6f14
commit 0ede18f6f0
3 changed files with 37 additions and 1 deletions

View File

@@ -27,7 +27,7 @@
<span class="collapse-text ml-3 transition-all duration-300 ease-in-out max-w-[180px] opacity-100 overflow-hidden whitespace-nowrap">Kategorien</span> <span class="collapse-text ml-3 transition-all duration-300 ease-in-out max-w-[180px] opacity-100 overflow-hidden whitespace-nowrap">Kategorien</span>
<% end %> <% end %>
<!-- 5. NEU: RÄUME & STANDORTE --> <!-- 5. RÄUME & STANDORTE -->
<%= link_to rooms_path, class: nav_link_class("rooms") do %> <%= link_to rooms_path, class: nav_link_class("rooms") do %>
<svg class="h-5 w-5 shrink-0 ml-0.5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> <svg class="h-5 w-5 shrink-0 ml-0.5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /> <path stroke-linecap="round" stroke-linejoin="round" d="M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />

View File

@@ -86,6 +86,31 @@
Ausloggen Ausloggen
</span> </span>
<% end %> <% end %>
<%
repo_url = "https://gitea.daboh.ipv64.de/daboh/vault171/"
commit_url = CURRENT_COMMIT.present? ? "#{repo_url}/commit/#{CURRENT_COMMIT}" : repo_url
%>
<%= link_to commit_url, target: "_blank",
class: "group flex items-center justify-center px-3 py-1 text-[11px] rounded-md text-gray-400 hover:text-gray-700 hover:bg-gray-50/50 transition w-full",
title: "Aktuelle Git-Revision anzeigen" do %>
<!-- Das Icon bleibt klein und zentriert -->
<svg class="h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700 transition-colors" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5" />
</svg>
<!-- Durch 'w-0 group-data-[collapsed]:w-0' oder ähnliche Selektoren blockiert der Text beim Einklappen 0 Pixel Platz -->
<span class="collapse-text ml-1.5 transition-all duration-300 ease-in-out max-w-[180px] opacity-100 overflow-hidden whitespace-nowrap font-mono tracking-wider origin-left">
<% if CURRENT_COMMIT.present? %>
<%= CURRENT_COMMIT %>
<% else %>
repository
<% end %>
</span>
<% end %>
</div>
</div> </div>
</aside> </aside>

View File

@@ -0,0 +1,11 @@
# config/initializers/git_revision.rb
# 1. Versuch: Über eine Umgebungsvariable (Standard bei Docker/Render/Heroku)
CURRENT_COMMIT = ENV["GIT_COMMIT_SHA"] ||
ENV["RENDER_GIT_COMMIT"] ||
# 2. Versuch: Direkt aus dem lokalen .git Ordner auslesen
begin
`git rev-parse --short HEAD`.strip
rescue
nil
end