Before this change, two important things depend on the format of each key, where to render it in the administration panel and which kind of interface to use for each setting. Following this strategy led us to a very complex code, very difficult to maintain or modify. So, we do not want to depend on the setting key structure anymore to decide how or where to render each setting. With this commit, we get rid of the key format-based rules. Now we render each setting explicitly passing to it the type and the tab where it belongs.
64 lines
2.6 KiB
Plaintext
64 lines
2.6 KiB
Plaintext
<% provide :title do %>
|
|
<%= t("admin.header.title") %> - <%= t("admin.menu.site_customization.content_blocks") %>
|
|
<% end %>
|
|
|
|
<%= link_to t("admin.site_customization.content_blocks.index.create"), new_admin_site_customization_content_block_path, class: "button float-right" %>
|
|
|
|
<h2 class="inline-block"><%= t("admin.site_customization.content_blocks.index.title") %></h2>
|
|
|
|
<%= render Admin::Settings::TableComponent.new(setting_name: "setting") do %>
|
|
<%= render Admin::Settings::RowComponent.new("html.per_page_code_body") %>
|
|
<%= render Admin::Settings::RowComponent.new("html.per_page_code_head") %>
|
|
<% end %>
|
|
|
|
<h3><%= t("admin.site_customization.content_blocks.information") %></h3>
|
|
|
|
<p><%= t("admin.site_customization.content_blocks.about") %></p>
|
|
<p><%= t("admin.site_customization.content_blocks.html_format") %></p>
|
|
|
|
<p>
|
|
<code><%= '<li><a href="http://site1.com">Site 1</a></li>' %></code><br>
|
|
<code><%= '<li><a href="http://site2.com">Site 2</a></li>' %></code><br>
|
|
<code><%= '<li><a href="http://site3.com">Site 3</a></li>' %></code><br>
|
|
</p>
|
|
|
|
<% if @content_blocks.any? || @headings_content_blocks.any? %>
|
|
<table class="cms-page-list">
|
|
<thead>
|
|
<tr>
|
|
<th><%= t("admin.site_customization.content_blocks.content_block.name") %></th>
|
|
<th><%= t("admin.site_customization.content_blocks.content_block.body") %></th>
|
|
<th><%= t("admin.actions.actions") %></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @content_blocks.each do |content_block| %>
|
|
<tr id="<%= dom_id(content_block) %>">
|
|
<td><%= link_to "#{content_block.name} (#{content_block.locale})", edit_admin_site_customization_content_block_path(content_block) %></td>
|
|
<td><%= raw content_block.body %></td>
|
|
<td>
|
|
<%= render Admin::TableActionsComponent.new(content_block, actions: [:destroy]) %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
<% @headings_content_blocks.each do |content_block| %>
|
|
<tr id="<%= dom_id(content_block) %>">
|
|
<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(
|
|
content_block,
|
|
actions: [:destroy],
|
|
destroy_path: admin_site_customization_delete_heading_content_block_path(content_block)
|
|
) %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<div class="callout primary">
|
|
<%= t("admin.site_customization.content_blocks.no_blocks") %>
|
|
</div>
|
|
<% end %>
|