15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/decidim/term_customizer/admin/translations_destroys_controller.rb', line 15
def destroy
enforce_permission_to :destroy, :translations, translation_set: set
Admin::DestroyTranslations.call(@form) do
on(:ok) do
flash[:notice] = I18n.t("translations_destroys.destroy.success", scope: "decidim.term_customizer.admin")
redirect_to translation_set_translations_path(set)
end
on(:invalid) do
if @form.translations.count < 1
flash[:alert] = I18n.t("translations_destroys.destroy.error", scope: "decidim.term_customizer.admin")
redirect_to translation_set_translations_path(set)
else
flash.now[:alert] = I18n.t("translations_destroys.destroy.error", scope: "decidim.term_customizer.admin")
render action: "new"
end
end
end
end
|