fix(carte): no autosave on champ carte

This commit is contained in:
Paul Chavard 2023-06-06 15:54:03 +02:00
parent ad9f072246
commit 6945b3f438
4 changed files with 23 additions and 7 deletions

View file

@ -30,7 +30,7 @@ class EditableChamp::EditableChampComponent < ApplicationComponent
end
def stimulus_controller
if !@champ.block? && @champ.fillable?
if autosave_enabled?
# This is an editable champ. Lets find what controllers it might need.
controllers = ['autosave']
@ -45,4 +45,8 @@ class EditableChamp::EditableChampComponent < ApplicationComponent
{}
end
end
def autosave_enabled?
!@champ.carte? && !@champ.block? && @champ.fillable?
end
end