Skip to content

Commit

Permalink
use partial to reduce duplicated code displaying list messages
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Dec 9, 2024
1 parent 768246f commit 0a53b84
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
9 changes: 1 addition & 8 deletions app/views/active_scaffold_overrides/_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
<tbody>
<tr>
<td class="messages-container">
<p class="error-message message server-error" style="display:none;">
<%= as_(:internal_error).html_safe %>
<span class="error-500"><%= as_(:error_500).html_safe %></span>
<a href="#" class="close" title="<%= as_(:close).html_safe %>"><%= as_(:close).html_safe %></a>
</p>
<div id="<%= active_scaffold_messages_id -%>" class="action-messages">
<%= render 'messages' %>
</div>
<%= render 'list_messages_content' %>
</td>
</tr>
</tbody>
Expand Down
11 changes: 1 addition & 10 deletions app/views/active_scaffold_overrides/_list_messages.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@
<tbody class="messages">
<tr class="record even-record">
<td colspan="<%= column_count -%>" class="messages-container">
<% unless active_scaffold_config.list.messages_above_header %>
<p class="error-message message server-error" style="display:none;">
<%= as_(:internal_error).html_safe %>
<span class="error-500"><%= as_(:error_500).html_safe %></span>
<a href="#" class="close" title="<%= as_(:close).html_safe %>"><%= as_(:close).html_safe %></a>
</p>
<div id="<%= active_scaffold_messages_id -%>" class="action-messages">
<%= render 'messages' %>
</div>
<% end %>
<%= render 'list_messages_content' unless active_scaffold_config.list.messages_above_header %>
<%= content_tag :div, class: 'filtered-message',
style: ('display:none;' unless @filtered),
data: ({search: search_params || ''} if active_scaffold_config.store_user_settings && respond_to?(:search_params)) do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<p class="error-message message server-error" style="display:none;">
<%= as_(:internal_error).html_safe %>
<span class="error-500"><%= as_(:error_500).html_safe %></span>
<a href="#" class="close" title="<%= as_(:close).html_safe %>"><%= as_(:close).html_safe %></a>
</p>
<div id="<%= active_scaffold_messages_id -%>" class="action-messages">
<%= render 'messages' %>
</div>

0 comments on commit 0a53b84

Please sign in to comment.