From c407ee3530dd9ef3128662df82266147024cf816 Mon Sep 17 00:00:00 2001 From: Runar Ingebrigtsen Date: Fri, 30 Jan 2026 10:09:38 +0100 Subject: [PATCH] shared header, responsive --- app/views/entries/edit.html.erb | 15 +--- app/views/entries/index.html.erb | 22 +----- app/views/layouts/admin.html.erb | 85 ++++++++++++++++++++- app/views/requests/new.html.erb | 14 +--- app/views/shared/_header.html.erb | 122 ++++++++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 52 deletions(-) create mode 100644 app/views/shared/_header.html.erb diff --git a/app/views/entries/edit.html.erb b/app/views/entries/edit.html.erb index 6bb674a..e03004c 100644 --- a/app/views/entries/edit.html.erb +++ b/app/views/entries/edit.html.erb @@ -1,20 +1,7 @@ <% content_for :title, "Edit Entry" %>
-
-
-
- <%= link_to root_path, class: "flex items-center gap-2" do %> - Sanasto - Wiki - <% end %> -
- <%= link_to "Browse", entries_path, class: "text-sm font-medium text-slate-600 hover:text-indigo-600 transition" %> - <%= link_to "Download XLSX", download_entries_path(format: :xlsx), class: "text-xs font-bold text-indigo-700 px-3 py-2 rounded-md border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 transition" %> -
-
-
-
+ <%= render "shared/header", show_request_button: false, show_browse_button: true %>
diff --git a/app/views/entries/index.html.erb b/app/views/entries/index.html.erb index 238bfeb..890eb08 100644 --- a/app/views/entries/index.html.erb +++ b/app/views/entries/index.html.erb @@ -1,27 +1,7 @@ <% content_for :title, "Sanasto Wiki" %>
-
-
-
-
- Sanasto - Wiki -
-
- <%= link_to "Request Entry", new_request_path, - class: "text-xs font-bold text-emerald-700 px-3 py-2 rounded-md border border-emerald-200 bg-emerald-50 hover:bg-emerald-100 transition" %> - <%= link_to "Download XLSX", download_entries_path(format: :xlsx), - class: "text-xs font-bold text-indigo-700 px-3 py-2 rounded-md border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 transition" %> - <% if admin? %> - <%= link_to "Admin", admin_root_path, class: "bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-indigo-700 transition" %> - <% else %> - <%= link_to "Sign In", login_path, class: "bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-indigo-700 transition" %> - <% end %> -
-
-
-
+ <%= render "shared/header" %> <% if flash.any? %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index b7387fd..645b4ec 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -16,11 +16,13 @@
-
+ <%= link_to admin_dashboard_path, class: "flex items-center gap-2" do %> Sanasto Admin -
-
+ + +
+ + <% if flash.any? %>
diff --git a/app/views/requests/new.html.erb b/app/views/requests/new.html.erb index 44791de..5db5a26 100644 --- a/app/views/requests/new.html.erb +++ b/app/views/requests/new.html.erb @@ -1,19 +1,7 @@ <% content_for :title, "Request a New Entry" %>
-
-
-
- <%= link_to root_path, class: "flex items-center gap-2" do %> - Sanasto - Wiki - <% end %> -
- <%= link_to "Sign In", login_path, class: "text-sm font-medium text-slate-600 hover:text-indigo-600 transition" %> -
-
-
-
+ <%= render "shared/header", show_request_button: false %>
diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb new file mode 100644 index 0000000..1d2be47 --- /dev/null +++ b/app/views/shared/_header.html.erb @@ -0,0 +1,122 @@ +
+
+
+ <%= link_to root_path, class: "flex items-center gap-2" do %> + Sanasto + Wiki + <% end %> + + + + + +
+ <% if logged_in? %> + + <%= current_user.name.split.first %> + + <% end %> + +
+
+ + + +
+
+ +