From fa91c6d6beba32deebfb4951efbb9688b42030e3 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 25 Aug 2026 15:12:19 +0300 Subject: [PATCH] fix mobile filters --- app/views/submissions_archived/index.html.erb | 2 +- .../_applied_filters.html.erb | 23 +++++++++++-------- .../index.html.erb | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/views/submissions_archived/index.html.erb b/app/views/submissions_archived/index.html.erb index a51b8099..a9ca204e 100644 --- a/app/views/submissions_archived/index.html.erb +++ b/app/views/submissions_archived/index.html.erb @@ -17,7 +17,7 @@
- <%= render 'submissions_filters/applied_filters', filter_params:, with_status: true %> + <%= render 'submissions_filters/applied_filters', filter_params:, with_status: true, with_default_status: true %> <%= render 'submissions_filters/filter_button', filter_params: %>
diff --git a/app/views/submissions_filters/_applied_filters.html.erb b/app/views/submissions_filters/_applied_filters.html.erb index 35323184..d3609361 100644 --- a/app/views/submissions_filters/_applied_filters.html.erb +++ b/app/views/submissions_filters/_applied_filters.html.erb @@ -3,15 +3,16 @@ <% ordered_filters = request.query_parameters.keys.filter_map { |key| filter_names.find { |name| key.start_with?(name) } }.uniq %> <% chip_order = ordered_filters.reverse.each_with_index.to_h { |name, index| [name, index + 1] } %> <% chip_order.default = ordered_filters.size + 1 %> -<% status_icon = { 'declined' => 'x_circle', 'expired' => 'clock_cancel', 'partially_completed' => 'clock_edit', 'sent' => 'send', 'opened' => 'mail_opened' }[params[:status]] %> <% status_icons = { 'all' => 'list', 'pending' => 'clock', 'completed' => 'circle_check' } %> <% current_status = status_icons.key?(params[:status].to_s) ? params[:status].to_s : 'all' %> +<% status_icon = { 'declined' => 'x_circle', 'expired' => 'clock_cancel', 'partially_completed' => 'clock_edit', 'sent' => 'send', 'opened' => 'mail_opened' }[params[:status]] %> +<% default_status_icon = status_icons[params[:status]] if status_icon.blank? && local_assigns[:with_default_status] && current_status != 'all' %> <% with_status_button = local_assigns[:with_status] && status_icon.blank? %> -<% chips_html = capture do %> - <% if status_icon %> -
+<% status_chip_html = capture do %> + <% if status_icon || default_status_icon %> +
<%= link_to submissions_filter_path('status', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> - <%= svg_icon(status_icon, class: 'w-5 h-5 shrink-0') %> + <%= svg_icon(status_icon || default_status_icon, class: 'w-5 h-5 shrink-0') %> <%= t(params[:status]) %> <% end %> <%= link_to url_for(params: request.query_parameters.except('status')), class: 'rounded-lg ml-1 shrink-0 hover:bg-base-content hover:text-white' do %> @@ -19,6 +20,8 @@ <% end %>
<% end %> +<% end %> +<% chips_html = capture do %> <% if params[:folder].present? %>
<%= link_to submissions_filter_path('folder', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> @@ -78,7 +81,8 @@
<% end %> <% end %> -<% if with_status_button && chips_html.blank? %> +<% with_status_dropdown = with_status_button && chips_html.blank? %> +<% if with_status_dropdown %> <% end %> -<% if chips_html.present? %> - - <% if with_status_button %> +<% if chips_html.present? || status_chip_html.present? %> + + <% if with_status_button && !with_status_dropdown %> <%= svg_icon(status_icons[current_status], class: 'w-5 h-5 shrink-0') %> <%= t(current_status) %> <%= svg_icon('chevron_down', class: 'w-4 h-4 shrink-0') %> <% end %> + <%= status_chip_html %> <%= chips_html %> <% end %> diff --git a/app/views/templates_archived_submissions/index.html.erb b/app/views/templates_archived_submissions/index.html.erb index 4bbf24c9..407432c0 100644 --- a/app/views/templates_archived_submissions/index.html.erb +++ b/app/views/templates_archived_submissions/index.html.erb @@ -19,7 +19,7 @@
- <%= render 'submissions_filters/applied_filters', filter_params:, with_status: true %> + <%= render 'submissions_filters/applied_filters', filter_params:, with_status: true, with_default_status: true %>