From ab0b75e59cb79149cc36e3e3aed61936081d89d1 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 26 Oct 2025 00:34:50 +0900 Subject: [PATCH 1/8] Move yyyymm selector to the page header --- app/views/layouts/application.html.erb | 18 +++++++++++--- app/views/messages/index.html.erb | 29 ---------------------- app/views/shared/_yyyymm_selector.html.erb | 28 +++++++++++++++++++++ 3 files changed, 42 insertions(+), 33 deletions(-) create mode 100644 app/views/shared/_yyyymm_selector.html.erb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 42cc57d..e8d1d3c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -21,10 +21,20 @@
-

- <%= link_to @list&.name || 'blade.ruby-lang.org', @list || root_path, class: "hover:text-red-600 dark:hover:text-red-400 transition-colors" %> -

-

Mailing list archive

+
+
+

+ <%= link_to @list&.name || 'blade.ruby-lang.org', @list || root_path, class: "hover:text-red-600 dark:hover:text-red-400 transition-colors" %> +

+

Mailing list archive

+
+ + <% if @yyyymms.present? %> +
+ <%= render 'shared/yyyymm_selector' %> +
+ <% end %> +
diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb index e97cd38..48e6f08 100644 --- a/app/views/messages/index.html.erb +++ b/app/views/messages/index.html.erb @@ -6,35 +6,6 @@ <% end %> -
- <% - selected_year = @yyyymm&.[](0, 4) - selected_month = @yyyymm&.[](4, 2) - years_with_months = @yyyymms.group_by {|yyyymm| yyyymm[0, 4] }.sort.reverse - %> - - -
- <% years_with_months.each do |year, months| %> - <%= link_to year, [@list, yyyymm: "#{year}#{months.sort.first[4, 2]}"], class: "px-3 py-1 text-sm font-medium rounded whitespace-nowrap transition-colors #{selected_year == year ? 'bg-red-600 dark:bg-red-500 text-white' : 'bg-gray-100 dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'}" %> - <% end %> -
- - - <% if selected_year %> -
- <% available_months = years_with_months.detect {|y, _| y == selected_year }&.last&.map {|yyyymm| yyyymm[4, 2] } || [] %> - <% ('01'..'12').each do |month| %> - <% if available_months.include?(month) %> - <%= link_to month, [@list, yyyymm: "#{selected_year}#{month}"], class: "px-2 py-1 text-xs font-medium rounded transition-colors #{selected_month == month ? 'bg-red-600 dark:bg-red-500 text-white border-2 border-red-700 dark:border-red-400' : 'bg-gray-100 dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 border-2 border-transparent'}" %> - <% else %> - <%= month %> - <% end %> - <% end %> -
- <% end %> -
-
<%= render partial: 'thread', collection: @messages, as: :message, locals: {list: @list, depth: 0} %> diff --git a/app/views/shared/_yyyymm_selector.html.erb b/app/views/shared/_yyyymm_selector.html.erb new file mode 100644 index 0000000..950d285 --- /dev/null +++ b/app/views/shared/_yyyymm_selector.html.erb @@ -0,0 +1,28 @@ +<% + selected_year = @yyyymm&.[](0, 4) + selected_month = @yyyymm&.[](4, 2) + years_with_months = @yyyymms.group_by {|yyyymm| yyyymm[0, 4] }.sort.reverse +%> + +
+ +
+ <% years_with_months.each do |year, months| %> + <%= link_to year, [@list, yyyymm: "#{year}#{months.sort.first[4, 2]}"], class: "px-3 py-1 text-sm font-medium rounded whitespace-nowrap transition-colors #{selected_year == year ? 'bg-red-600 dark:bg-red-500 text-white' : 'bg-gray-100 dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'}" %> + <% end %> +
+ + + <% if selected_year %> +
+ <% available_months = years_with_months.detect {|y, _| y == selected_year }&.last&.map {|yyyymm| yyyymm[4, 2] } || [] %> + <% ('01'..'12').each do |month| %> + <% if available_months.include?(month) %> + <%= link_to month, [@list, yyyymm: "#{selected_year}#{month}"], class: "px-2 py-1 text-xs font-medium rounded transition-colors #{selected_month == month ? 'bg-red-600 dark:bg-red-500 text-white border-2 border-red-700 dark:border-red-400' : 'bg-gray-100 dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 border-2 border-transparent'}" %> + <% else %> + <%= month %> + <% end %> + <% end %> +
+ <% end %> +
From 584504f764d8bbbc14e6ef44aa41fb54c8c7786d Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 27 Oct 2025 21:12:45 +0900 Subject: [PATCH 2/8] Tailwind CSS styling for the search result page --- app/views/messages/search.html.erb | 86 ++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 28 deletions(-) diff --git a/app/views/messages/search.html.erb b/app/views/messages/search.html.erb index e9a8089..a5f208e 100644 --- a/app/views/messages/search.html.erb +++ b/app/views/messages/search.html.erb @@ -1,36 +1,66 @@ -

<%= notice %>

+<% if notice %> +
+ <%= notice %> +
+<% end %> -

blade.ruby-lang.org

+
+

Search Messages

+

Search across all mailing list archives

+
-