From 88cd3f8b1433f55802afd6e0d878a2040f2483cd Mon Sep 17 00:00:00 2001 From: Sergio Cambra Date: Mon, 16 Dec 2024 18:11:33 +0100 Subject: [PATCH] fix rubocop offenses --- .../_list_inline_adapter.html.erb | 17 ++++++++++++++--- .../_popup_adapter.html.erb | 13 ++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/views/active_scaffold_overrides/_list_inline_adapter.html.erb b/app/views/active_scaffold_overrides/_list_inline_adapter.html.erb index 604d3b6b91..84d7322179 100644 --- a/app/views/active_scaffold_overrides/_list_inline_adapter.html.erb +++ b/app/views/active_scaffold_overrides/_list_inline_adapter.html.erb @@ -1,12 +1,23 @@ <%# nested_id, allows us to remove a nested scaffold programmatically %> - + <% if successful? %>
<%= "#{nested? ? nested.name : id_from_controller(params[:controller])}-view" %> view"> - <%= link_to(as_(:close), '', :class => 'inline-adapter-close as_cancel', :remote => true, :title => as_(:close)) -%> + <%= link_to(as_(:close), '', class: 'inline-adapter-close as_cancel', remote: true, title: as_(:close)) -%> <%= payload -%>
<% end %> - <%= javascript_tag("setTimeout(function() { var action_link = ActiveScaffold.ActionLink.get('#{element_row_id(:action => :nested)}'); if (action_link) { action_link.update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');#{' action_link.close(); ActiveScaffold.scroll_to(action_link.scaffold(), ActiveScaffold.config.scroll_on_close == "checkInViewport");' unless successful?} } }, 10);") %> + <%= javascript_tag do %> + setTimeout(function() { + var action_link = ActiveScaffold.ActionLink.get('<%= nested_id %>'); + if (action_link) { + action_link.update_flash_messages('<%= escape_javascript(render('messages').strip) %>'); + <% unless successful? %> + action_link.close(); + ActiveScaffold.scroll_to(action_link.scaffold(), ActiveScaffold.config.scroll_on_close == "checkInViewport"); + <% end %> + } + }, 10); + <% end %> diff --git a/app/views/active_scaffold_overrides/_popup_adapter.html.erb b/app/views/active_scaffold_overrides/_popup_adapter.html.erb index 308cafde28..8b918a44ea 100644 --- a/app/views/active_scaffold_overrides/_popup_adapter.html.erb +++ b/app/views/active_scaffold_overrides/_popup_adapter.html.erb @@ -5,5 +5,16 @@ <%= payload -%> <% end %> - <%= javascript_tag("setTimeout(function() { var action_link = ActiveScaffold.ActionLink.get('#{nested_id}'); if (action_link) { action_link.update_flash_messages('#{escape_javascript(render('messages').strip)}');#{' action_link.close(); ActiveScaffold.scroll_to(action_link.scaffold(), ActiveScaffold.config.scroll_on_close == "checkInViewport");' unless successful?} } }, 10);") %> + <%= javascript_tag do %> + setTimeout(function() { + var action_link = ActiveScaffold.ActionLink.get('<%= nested_id %>'); + if (action_link) { + action_link.update_flash_messages('<%= escape_javascript(render('messages').strip) %>'); + <% unless successful? %> + action_link.close(); + ActiveScaffold.scroll_to(action_link.scaffold(), ActiveScaffold.config.scroll_on_close == "checkInViewport"); + <% end %> + } + }, 10); + <% end %>