fix archived export
This commit is contained in:
@@ -5,10 +5,11 @@ class SubmissionsExportController < ApplicationController
|
|||||||
load_and_authorize_resource :submission, through: :template, parent: false, only: :index
|
load_and_authorize_resource :submission, through: :template, parent: false, only: :index
|
||||||
|
|
||||||
def index
|
def index
|
||||||
submissions = @submissions.active
|
submissions = params[:archived] == 'true' ? @submissions.archived : @submissions.active
|
||||||
.preload(submitters: { documents_attachments: :blob,
|
|
||||||
attachments_attachments: :blob })
|
submissions = submissions.preload(submitters: { documents_attachments: :blob,
|
||||||
.order(id: :asc)
|
attachments_attachments: :blob })
|
||||||
|
.order(id: :asc)
|
||||||
|
|
||||||
submissions = Submissions.search(current_user, submissions, params[:q], search_values: true)
|
submissions = Submissions.search(current_user, submissions, params[:q], search_values: true)
|
||||||
submissions = Submissions::Filter.call(submissions, current_user, params)
|
submissions = Submissions::Filter.call(submissions, current_user, params)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<% filter_params = params.permit(:q, *Submissions::Filter::ALLOWED_PARAMS) %>
|
<% filter_params = params.permit(:q, :archived, *Submissions::Filter::ALLOWED_PARAMS) %>
|
||||||
<%= render 'shared/turbo_modal', title: t('export'), close_after_submit: false do %>
|
<%= render 'shared/turbo_modal', title: t('export'), close_after_submit: false do %>
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<%= button_to template_submissions_export_index_path(@template), params: { format: :xlsx, **filter_params }, method: :get, data: { turbo_frame: :_top } do %>
|
<%= button_to template_submissions_export_index_path(@template), params: { format: :xlsx, **filter_params }, method: :get, data: { turbo_frame: :_top } do %>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<% if with_filters %>
|
<% if with_filters %>
|
||||||
<%= render 'shared/search_input' %>
|
<%= render 'shared/search_input' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to new_template_submissions_export_path(@template), class: 'btn btn-ghost text-base', data: { turbo_frame: 'modal' } do %>
|
<%= link_to new_template_submissions_export_path(@template, archived: true), class: 'btn btn-ghost text-base', data: { turbo_frame: 'modal' } do %>
|
||||||
<%= svg_icon('download', class: 'w-6 h-6 stroke-2') %>
|
<%= svg_icon('download', class: 'w-6 h-6 stroke-2') %>
|
||||||
<span><%= t('export') %></span>
|
<span><%= t('export') %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user