Override translations _destroy value depending of our translations managment logic

During any translatable resource edit, if you remove all translations
you will be redirected to same form with errors showing you one of
persisted but marked to destroy translations, without this patch
_destroy field value wil be true and you will no able to persist without
re-addding the same language through translation interface.
This commit is contained in:
Senén Rodero Rodríguez
2019-06-07 16:59:51 +02:00
parent 966b5b19ba
commit 907fc18ff7

View File

@@ -38,6 +38,7 @@ module TranslatableFormHelper
@template.content_tag :div, translations_options(translations_form.object, locale) do
@template.concat translations_form.hidden_field(
:_destroy,
value: !@template.enabled_locale?(translations_form.object.globalized_model, locale),
data: { locale: locale }
)