Use the shared partial to render errors
We were using it most of the time, but in some places we still had duplicated code.
This commit is contained in:
@@ -1,19 +1,6 @@
|
||||
<%= form_for [:admin, @content_block], html: { class: "edit_page", data: { watch_changes: true } } do |f| %>
|
||||
|
||||
<% if @content_block.errors.any? %>
|
||||
|
||||
<div id="error_explanation" data-alert class="callout alert" data-closable>
|
||||
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
||||
<strong>
|
||||
<%= @content_block.errors.count %>
|
||||
<%= t("admin.site_customization.content_blocks.errors.form.error", count: @content_block.errors.count) %>
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<%= render "shared/errors", resource: @content_block %>
|
||||
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.select :name, options_for_select(valid_blocks, @selected_content_block) %>
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
<%= form_tag(admin_site_customization_update_heading_content_block_path(@content_block.id), method: "put") do %>
|
||||
<% if @content_block.errors.any? %>
|
||||
<div id="error_explanation" data-alert class="callout alert" data-closable>
|
||||
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong>
|
||||
<%= @content_block.errors.count %>
|
||||
<%= t("admin.site_customization.content_blocks.errors.form.error", count: @content_block.errors.count) %>
|
||||
</strong>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render "shared/errors", resource: @content_block %>
|
||||
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= label_tag :name %>
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
<%= render "shared/globalize_locales", resource: @page %>
|
||||
|
||||
<%= translatable_form_for [:admin, @page], html: { class: "edit_page", data: { watch_changes: true } } do |f| %>
|
||||
<% if @page.errors.any? %>
|
||||
<div id="error_explanation" data-alert class="callout alert" data-closable>
|
||||
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<%= render "shared/errors", resource: @page %>
|
||||
|
||||
<strong>
|
||||
<%= @page.errors.count %>
|
||||
<%= t("admin.site_customization.pages.errors.form.error", count: @page.errors.count) %>
|
||||
</strong>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
|
||||
Reference in New Issue
Block a user