From 6314987e69269aaeb5bd6bfccd7f2fe79c84fb5d Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Wed, 1 Jul 2026 18:23:57 +0300 Subject: [PATCH] make possible to unarchive completed submission --- app/views/shared/_navbar.html.erb | 9 +++--- app/views/submissions/show.html.erb | 45 +++++++++++++++++++---------- spec/system/submission_spec.rb | 25 ++++++++++++++++ 3 files changed, 59 insertions(+), 20 deletions(-) create mode 100644 spec/system/submission_spec.rb diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb index c647dc27..aee10e59 100644 --- a/app/views/shared/_navbar.html.erb +++ b/app/views/shared/_navbar.html.erb @@ -71,10 +71,11 @@ <% end %> <% end %>
  • - <%= button_to destroy_user_session_path, method: :delete, data: { turbo: false }, class: 'flex items-center' do %> - <%= svg_icon('logout', class: 'w-5 h-5 flex-shrink-0 stroke-2 mr-2 inline') %> - <%= t('sign_out') %> - <% end %> + + <%= button_to '', destroy_user_session_path, method: :delete, data: { turbo: false }, form: { id: 'destroy_user_session_form' }, form_class: 'hidden' %>
  • diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb index c0fcab7e..add9b01f 100644 --- a/app/views/submissions/show.html.erb +++ b/app/views/submissions/show.html.erb @@ -16,7 +16,7 @@
    <% is_all_completed = @submission.submitters.to_a.all?(&:completed_at?) %> - <% if signed_in? && can?(:create, @submission) && @submission.archived_at? && !is_all_completed %> + <% if signed_in? && can?(:destroy, @submission) && @submission.archived_at? && !is_all_completed %> <%= button_to button_title(title: t('unarchive'), disabled_with: t('unarchive')[0..-2], icon: svg_icon('rotate', class: 'w-6 h-6')), submission_unarchive_index_path(@submission), class: 'btn btn-primary btn-ghost text-base hidden md:flex' %> <% end %> <% if @submission.audit_trail.present? %> @@ -37,9 +37,12 @@ <% end %> <% end %> <% if @submission.submitters.to_a.any?(&:completed_at?) %> + <% show_combined_download = is_all_completed && !is_combined_enabled %> + <% show_unarchive = signed_in? && can?(:destroy, @submission) && @submission.archived_at? && is_all_completed %> + <% show_download_dropdown = show_combined_download || show_unarchive %> <% if is_all_completed || !is_combined_enabled %>
    - + <%= svg_icon('download', class: 'w-6 h-6') %> @@ -49,26 +52,36 @@ - <% if is_all_completed && !is_combined_enabled %> -