Add name attribute to heading content blocks

This way we can simplify the code and don't have to rely on `.try`
statements which are confusing and so we don't allow them in the
`Rails/SafeNavigation` Rubocop rule.
This commit is contained in:
Javi Martín
2020-09-30 22:10:59 +02:00
parent 2d37a0396b
commit 0911b89d16
5 changed files with 18 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
<% provide :title do %>
<%= t("admin.header.title") %> - <%= t("admin.menu.site_customization.content_blocks") %> - <%= @content_block.try(:name) || @content_block.heading.try(:name) %> (<%= @content_block.locale %>)
<%= t("admin.header.title") %> - <%= t("admin.menu.site_customization.content_blocks") %> - <%= @content_block.name %> (<%= @content_block.locale %>)
<% end %>
<%= back_link_to admin_site_customization_content_blocks_path %>

View File

@@ -43,7 +43,7 @@
<% end %>
<% @headings_content_blocks.each do |content_block| %>
<tr id="<%= dom_id(content_block) %>">
<td><%= link_to "#{content_block.heading.name} (#{content_block.locale})", admin_site_customization_edit_heading_content_block_path(content_block) %></td>
<td><%= link_to "#{content_block.name} (#{content_block.locale})", admin_site_customization_edit_heading_content_block_path(content_block) %></td>
<td><%= raw content_block.body %></td>
<td>
<%= render Admin::TableActionsComponent.new(