fix(sva): dont render sva badge component if procedure is not sva
This commit is contained in:
parent
786bc64d85
commit
93b0af50cc
3 changed files with 8 additions and 4 deletions
|
@ -2,15 +2,19 @@
|
||||||
|
|
||||||
class Instructeurs::SVASVRDecisionBadgeComponent < ApplicationComponent
|
class Instructeurs::SVASVRDecisionBadgeComponent < ApplicationComponent
|
||||||
attr_reader :object
|
attr_reader :object
|
||||||
|
attr_reader :procedure
|
||||||
attr_reader :with_label
|
attr_reader :with_label
|
||||||
|
|
||||||
def initialize(projection_or_dossier:, decision:, with_label: false)
|
def initialize(projection_or_dossier:, procedure:, with_label: false)
|
||||||
@object = projection_or_dossier
|
@object = projection_or_dossier
|
||||||
@decision = decision.to_sym
|
@procedure = procedure
|
||||||
|
@decision = procedure.sva_svr_configuration.decision.to_sym
|
||||||
@with_label = with_label
|
@with_label = with_label
|
||||||
end
|
end
|
||||||
|
|
||||||
def render?
|
def render?
|
||||||
|
return false unless procedure.sva_svr_enabled?
|
||||||
|
|
||||||
[:en_construction, :en_instruction].include? object.state.to_sym
|
[:en_construction, :en_instruction].include? object.state.to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
= status_badge(dossier.state)
|
= status_badge(dossier.state)
|
||||||
= pending_correction_badge(:for_instructeur) if dossier.pending_correction?
|
= pending_correction_badge(:for_instructeur) if dossier.pending_correction?
|
||||||
= render Instructeurs::SVASVRDecisionBadgeComponent.new(projection_or_dossier: dossier, decision: dossier.procedure.sva_svr_configuration.decision, with_label: true)
|
= render Instructeurs::SVASVRDecisionBadgeComponent.new(projection_or_dossier: dossier, procedure: dossier.procedure, with_label: true)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
- if @procedure.sva_svr_enabled?
|
- if @procedure.sva_svr_enabled?
|
||||||
%td
|
%td
|
||||||
%span.cell-link
|
%span.cell-link
|
||||||
= link_to_if p.hidden_by_administration_at.blank?, render(Instructeurs::SVASVRDecisionBadgeComponent.new(projection_or_dossier: p, decision: @procedure.sva_svr_configuration.decision), path)
|
= link_to_if p.hidden_by_administration_at.blank?, render(Instructeurs::SVASVRDecisionBadgeComponent.new(projection_or_dossier: p, procedure: @procedure), path)
|
||||||
|
|
||||||
%td.action-col.follow-col
|
%td.action-col.follow-col
|
||||||
%ul.inline.fr-btns-group.fr-btns-group--sm.fr-btns-group--inline.fr-btns-group--icon-right
|
%ul.inline.fr-btns-group.fr-btns-group--sm.fr-btns-group--inline.fr-btns-group--icon-right
|
||||||
|
|
Loading…
Add table
Reference in a new issue