From f77f53b46efbac047ca82be03c0980016d907346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= Date: Fri, 28 Feb 2025 11:35:58 +0100 Subject: [PATCH] fix block edit --- .../admin/communication/blocks/edit.html.erb | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/admin/communication/blocks/edit.html.erb b/app/views/admin/communication/blocks/edit.html.erb index eb0a39bdd..2dc6ba4d8 100644 --- a/app/views/admin/communication/blocks/edit.html.erb +++ b/app/views/admin/communication/blocks/edit.html.erb @@ -11,7 +11,7 @@
<%= t 'loading' %>
- <%= simple_form_for [:admin, @block], + <%= simple_form_for [:admin, @block], remote: true, html: { id: 'block-form' } do |f| %> <%= f.error_notification %> @@ -26,20 +26,20 @@ input_html: { data: { translatable: true } } %> <%= render "admin/communication/blocks/templates/#{@block.template_kind}/edit", f: f, block: @block %> - +
- <% - if @block.title.present? + <% + if @block.title.present? slug = @block.slug about_l10n = @block.about about = about_l10n.about @@ -48,7 +48,7 @@ <%= osuny_label t('admin.communication.blocks.advanced.anchor') %>
#<%= slug %>
<% - if about.is_direct_object? + if about.try(:is_direct_object?) website = about.website hugo = about_l10n.hugo(website) %> @@ -266,9 +266,9 @@ window.addEventListener('load', function(){ setTimeout(function() { app.mount('#app'); - + $("#block-form").on("ajax:success", function(e) { - let blockIdentifier = "<%= @block.id %>", + let blockIdentifier = "<%= @block.id %>", blockPath = "<%= admin_communication_block_path(@block) %>"; parent.window.osuny.contentEditor.offcanvas.onBlockSave(blockIdentifier, blockPath); });