From 8259ebdb6cce659540ceb8df826225ed6bd501c3 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sat, 12 Sep 2026 22:49:12 +0300 Subject: [PATCH] archived nav --- app/controllers/templates_controller.rb | 6 +++- app/javascript/template_builder/builder.vue | 1 + app/views/templates/_template.html.erb | 2 +- app/views/templates/_title.html.erb | 9 ++++-- app/views/templates/show.html.erb | 4 ++- .../index.html.erb | 28 +++++++++++-------- .../templates_form_preview/show.html.erb | 2 +- app/views/templates_preview/show.html.erb | 3 +- config/locales/i18n.yml | 7 +++++ 9 files changed, 42 insertions(+), 20 deletions(-) diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index e8ff9ff4e..e6c2e224c 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -83,7 +83,11 @@ class TemplatesController < ApplicationController I18n.t('template_has_been_archived') end - redirect_back(fallback_location: root_path, notice:) + if @template.destroyed? && turbo_native_app? + redirect_to templates_archived_index_path, notice: + else + redirect_back(fallback_location: root_path, notice:) + end end private diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index f091289b6..553a6d0b4 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -285,6 +285,7 @@ > - +
<% if template.template_accesses.present? %> <%= svg_icon('lock', class: 'w-6 h-6 inline -translate-y-[4px]') %> diff --git a/app/views/templates/_title.html.erb b/app/views/templates/_title.html.erb index a57fa68f5..7f3f80339 100644 --- a/app/views/templates/_title.html.erb +++ b/app/views/templates/_title.html.erb @@ -107,7 +107,7 @@ <% end %> <% if template.archived_at? || (!can?(:update, template) && can?(:read, template)) %> - + <% end %> <% if local_assigns[:with_export] %> @@ -117,11 +117,14 @@ <% end %> <% if can?(:destroy, template) %> <% if template.archived_at? %> - + <%= button_to '', template_restore_index_path(template) %> + + <%= button_to '', template_path(template), method: :delete, params: { permanently: true }, data: { turbo_confirm: t('template_deletion_is_irreversible_and_will_permanently_remove_all_associated_signed_documents_with_it_are_you_sure_') } %> + <% else %> - + <%= button_to '', template_path(template), method: :delete %> <% end %> diff --git a/app/views/templates/show.html.erb b/app/views/templates/show.html.erb index 24cb06b93..c83ce8ebe 100644 --- a/app/views/templates/show.html.erb +++ b/app/views/templates/show.html.erb @@ -133,7 +133,9 @@ <% view_archived_html = capture do %> <% if (can?(:manage, :countless) || @template.submissions.where.not(archived_at: nil).exists?) && !@template.archived_at? %>
- <%= t('view_archived') %> + + <%= t('view_archived') %> +
<% end %> <% end %> diff --git a/app/views/templates_archived_submissions/index.html.erb b/app/views/templates_archived_submissions/index.html.erb index 271f0bf35..a3c504f17 100644 --- a/app/views/templates_archived_submissions/index.html.erb +++ b/app/views/templates_archived_submissions/index.html.erb @@ -1,8 +1,8 @@ -<% content_for(:native_title, @template.name) if turbo_native_app? %> +<% content_for(:native_title, t('archived')) if turbo_native_app? %> <% filter_params = params.permit(Submissions::Filter::ALLOWED_PARAMS).compact_blank %> <% with_filters = @pagy.pages > 1 || params[:q].present? || filter_params.present? %> -<%= render 'templates/title', template: @template %> <% unless turbo_native_app? %> + <%= render 'templates/title', template: @template %>
<%= link_to template_path(@template), class: 'flex items-center mb-1 md:mb-0' do %> <%= svg_icon('chevron_left', class: 'w-5 h-5') %> @@ -10,11 +10,13 @@ <% end %>
<% end %> -
+
-
-

<%= t('submissions') %> <%= t('archived') %>

-
+ <% unless turbo_native_app? %> +
+

<%= t('submissions') %> <%= t('archived') %>

+
+ <% end %>
<% if with_filters %> <%= render 'shared/search_input' %> @@ -23,12 +25,14 @@
<%= render 'submissions_filters/applied_filters', filter_params:, with_status: true, with_default_status: true %> - + <% unless turbo_native_app? %> + + <% end %> <%= render 'submissions_filters/filter_button', filter_params: %>
diff --git a/app/views/templates_form_preview/show.html.erb b/app/views/templates_form_preview/show.html.erb index 47f1086ee..e0d968c8d 100644 --- a/app/views/templates_form_preview/show.html.erb +++ b/app/views/templates_form_preview/show.html.erb @@ -2,7 +2,7 @@ <% content_for(:native_title, @template.name) %> <% if @template.submitters.size > 1 %> <% @template.submitters.each do |submitter| %> - + <% end %> diff --git a/app/views/templates_preview/show.html.erb b/app/views/templates_preview/show.html.erb index 799254710..f17eccf87 100644 --- a/app/views/templates_preview/show.html.erb +++ b/app/views/templates_preview/show.html.erb @@ -1 +1,2 @@ - +<% content_for(:native_title, @template.name) if turbo_native_app? %> + diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index 69f294d2d..7c5fc4427 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -774,6 +774,7 @@ en: &en submitter_cannot_be_updated: Submitter cannot be updated. at_least_one_field_must_be_filled: At least one field must be filled. archived_users: Archived Users + archived_submissions: Archived Submissions embedding_users: Embedding Users view_embedding_users: View Embedding Users key: Key @@ -1911,6 +1912,7 @@ es: &es submitter_cannot_be_updated: No se puede editar el destinatario. at_least_one_field_must_be_filled: Al menos un campo debe estar completo. archived_users: Usuarios Archivados + archived_submissions: Envíos Archivados embedding_users: Usuarios integrados view_embedding_users: Ver usuarios integrados key: Clave @@ -3055,6 +3057,7 @@ it: &it submitter_cannot_be_updated: Non è possibile modificare il destinatario. at_least_one_field_must_be_filled: Almeno un campo deve essere compilato. archived_users: Utenti Archiviati + archived_submissions: Invii Archiviati embedding_users: Utenti integrati view_embedding_users: Vedi utenti integrati key: Chiave @@ -4185,6 +4188,7 @@ fr: &fr submitter_cannot_be_updated: Impossible de modifier le destinataire. at_least_one_field_must_be_filled: Au moins un champ doit être rempli. archived_users: Utilisateurs archivés + archived_submissions: Soumissions archivées embedding_users: Utilisateurs intégrés view_embedding_users: Voir les utilisateurs intégrés key: Clé @@ -5325,6 +5329,7 @@ pt: &pt submitter_cannot_be_updated: Não é possível editar o destinatário. at_least_one_field_must_be_filled: Pelo menos um campo deve ser preenchido. archived_users: Usuários Arquivados + archived_submissions: Submissões Arquivadas embedding_users: Usuários integrados view_embedding_users: Ver usuários integrados key: Chave @@ -6468,6 +6473,7 @@ de: &de submitter_cannot_be_updated: Der Empfänger kann nicht bearbeitet werden. at_least_one_field_must_be_filled: Mindestens ein Feld muss ausgefüllt werden. archived_users: Archivierte Benutzer + archived_submissions: Archivierte Einreichungen embedding_users: Integrationsbenutzer view_embedding_users: Integrationsbenutzer anzeigen key: Schlüssel @@ -8139,6 +8145,7 @@ nl: &nl submitter_cannot_be_updated: Ontvanger kan niet worden bewerkt. at_least_one_field_must_be_filled: Er moet minstens één veld worden ingevuld. archived_users: Gearchiveerde gebruikers + archived_submissions: Gearchiveerde inzendingen embedding_users: Integratiegebruikers view_embedding_users: Integratiegebruikers bekijken key: Sleutel