From 96e4733f87ac35dd3545816952166ba6face8812 Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Fri, 7 Feb 2025 19:51:20 +0200 Subject: [PATCH] add submissions filtering by 'sent' and 'opened' statuses --- app/views/icons/_mail_opened.html.erb | 6 ++ .../_applied_filters.html.erb | 2 +- app/views/submissions_filters/status.html.erb | 2 +- lib/submissions/filter.rb | 57 ++++++++++++------- 4 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 app/views/icons/_mail_opened.html.erb diff --git a/app/views/icons/_mail_opened.html.erb b/app/views/icons/_mail_opened.html.erb new file mode 100644 index 00000000..f305c647 --- /dev/null +++ b/app/views/icons/_mail_opened.html.erb @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/views/submissions_filters/_applied_filters.html.erb b/app/views/submissions_filters/_applied_filters.html.erb index f1cdb070..44df190c 100644 --- a/app/views/submissions_filters/_applied_filters.html.erb +++ b/app/views/submissions_filters/_applied_filters.html.erb @@ -1,5 +1,5 @@ <% query_params = params.permit(:q).merge(filter_params) %> -<% if icon = { 'declined' => 'x_circle', 'expired' => 'clock_cancel', 'partially_completed' => 'clock_edit' }[params[:status]] %> +<% if icon = { 'declined' => 'x_circle', 'expired' => 'clock_cancel', 'partially_completed' => 'clock_edit', 'sent' => 'send', 'opened' => 'mail_opened' }[params[:status]] %>
<%= 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 w-full pr-1 md:max-w-[140px]' do %> <%= svg_icon(icon, class: 'w-5 h-5 shrink-0') %> diff --git a/app/views/submissions_filters/status.html.erb b/app/views/submissions_filters/status.html.erb index d614b540..7cb91b57 100644 --- a/app/views/submissions_filters/status.html.erb +++ b/app/views/submissions_filters/status.html.erb @@ -2,7 +2,7 @@
- <% ['', 'pending', 'completed', 'partially_completed', 'declined', 'expired'].each do |status| %> + <% ['', 'pending', 'completed', 'partially_completed', 'sent', 'opened', 'declined', 'expired'].each do |status| %>