chore(attestation): card link to v2 if exist
This commit is contained in:
parent
151b3f83ed
commit
ffd8c5617a
3 changed files with 16 additions and 2 deletions
|
@ -5,6 +5,14 @@ class Procedure::Card::AttestationComponent < ApplicationComponent
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def edit_attestation_path
|
||||||
|
if @procedure.attestation_templates_v2.any? || @procedure.feature_enabled?(:attestation_v2)
|
||||||
|
helpers.edit_admin_procedure_attestation_template_v2_path(@procedure)
|
||||||
|
else
|
||||||
|
helpers.edit_admin_procedure_attestation_template_path(@procedure)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def error_messages
|
def error_messages
|
||||||
@procedure.errors.messages_for(:attestation_template).to_sentence
|
@procedure.errors.messages_for(:attestation_template).to_sentence
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.fr-col-6.fr-col-md-4.fr-col-lg-3
|
.fr-col-6.fr-col-md-4.fr-col-lg-3
|
||||||
= link_to edit_admin_procedure_attestation_template_path(@procedure), class: 'fr-tile fr-enlarge-link' do
|
= link_to edit_attestation_path, class: 'fr-tile fr-enlarge-link' do
|
||||||
.fr-tile__body.flex.column.align-center.justify-between
|
.fr-tile__body.flex.column.align-center.justify-between
|
||||||
- if @procedure.attestation_template&.activated?
|
- if @procedure.attestation_template&.activated?
|
||||||
%div
|
%div
|
||||||
|
|
|
@ -14,8 +14,14 @@ describe 'As an administrateur, I want to manage the procedure’s attestation',
|
||||||
before { login_as(administrateur.user, scope: :user) }
|
before { login_as(administrateur.user, scope: :user) }
|
||||||
|
|
||||||
def find_attestation_card(with_nested_selector: nil)
|
def find_attestation_card(with_nested_selector: nil)
|
||||||
|
attestation_path = if procedure.attestation_template&.version == 2 || procedure.feature_enabled?(:attestation_v2)
|
||||||
|
edit_admin_procedure_attestation_template_v2_path(procedure)
|
||||||
|
else
|
||||||
|
edit_admin_procedure_attestation_template_path(procedure)
|
||||||
|
end
|
||||||
|
|
||||||
full_selector = [
|
full_selector = [
|
||||||
"a[href=\"#{edit_admin_procedure_attestation_template_path(procedure)}\"]",
|
"a[href=\"#{attestation_path}\"]",
|
||||||
with_nested_selector
|
with_nested_selector
|
||||||
].compact.join(" ")
|
].compact.join(" ")
|
||||||
page.find(full_selector)
|
page.find(full_selector)
|
||||||
|
|
Loading…
Reference in a new issue