Fix archived forms view [SCI-11417]

This commit is contained in:
Martin Artnik 2025-01-14 12:46:36 +01:00
parent c572c85eec
commit d680f28f81
5 changed files with 15 additions and 18 deletions

View file

@ -184,7 +184,7 @@ class FormsController < ApplicationController
private
def set_breadcrumbs_items
archived = params[:view_mode] || (@form&.archived? && 'archived')
archived = params[:view_mode] == 'archived' || @form&.archived?
@breadcrumbs_items = []
@breadcrumbs_items.push({ label: t('breadcrumbs.templates') })

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
module ProtocolsHelper
def templates_view_mode_archived?(type: nil, protocol: nil)
type == :archived || protocol&.archived?
end
end

View file

@ -2,8 +2,12 @@
<div class="content-header sticky-header">
<div class="title-row">
<h1>
<%= t('forms.index.head_title') %>
</h1>
<% if params[:view_mode] == 'archived' %>
<%= t('labels.archived')%>
<%= t('forms.index.head_title_archived') %>
<% else %>
<%= t('forms.index.head_title') %>
<% end %>
</div>
</div>
<div id="formsTable" class="fixed-content-body"

View file

@ -14,14 +14,14 @@
<div class="content-pane flexible protocols-index <%= @type %>">
<div class="content-header sticky-header">
<div class="title-row" data-e2e="e2e-TX-protocolTemplates-title">
<% if templates_view_mode_archived?(type: @type) %>
<h1>
<span><%= t('labels.archived')%></span>&nbsp;
<h1>
<% if params[:view_mode] == 'archived' %>
<%= t('labels.archived')%>
<%= t('protocols.index.head_title_archived') %>
</h1>
<% else %>
<h1><%= t('protocols.index.head_title') %></h1>
<% end %>
<% else %>
<%= t('protocols.index.head_title') %>
<% end %>
</h1>
</div>
</div>
<div class="protocols-container" data-e2e="e2e-CO-protocolTemplates">

View file

@ -1,5 +1,5 @@
<ul class="sidebar-branch">
<% if templates_view_mode_archived?(type: @type, protocol: @protocol) %>
<% if params[:view_mode] == 'archived' %>
<li class="sidebar-leaf">
<%= link_to protocols_path, class: "sidebar-link back-button" do %>
<%= t("protocols.index.back_to_active_protocols") %>