def t_selected_item(name, index)
t(MagicNumber[name][index][0])
end
+
end
<%= form_for(@artist) do |f| %>
- <% if @artist.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@artist.errors.count, "error") %> prohibited this artist from being saved:</h2>
-
- <ul>
- <% @artist.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+ <%= render 'system/error_explanation', :obj => @artist %>
<div class="field">
<%= f.label :name %><br />
<%= form_for(@au) do |f| %>
- <% if @au.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@au.errors.count, "error") %> prohibited this author from being saved:</h2>
-
- <ul>
- <% @au.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+ <%= render 'system/error_explanation', :obj => @au %>
<div class="field">
<%= f.label :name %><br />
<%= form_for(@comic) do |f| %>
- <% if @comic.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@comic.errors.count, "error") %> prohibited this comic from being saved:</h2>
-
- <ul>
- <% @comic.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+ <%= render 'system/error_explanation', :obj => @comic %>
<div class="field">
<%= f.label :author_id %><br />
<%= form_for(@original_picture_license_group) do |f| %>
- <% if @original_picture_license_group.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@original_picture_license_group.errors.count, "error") %> prohibited this comic from being saved:</h2>
-
- <ul>
- <% @original_picture_license_group.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+ <%= render 'system/error_explanation', :obj => @original_picture_license_group %>
<table class="no-border">
<tr>
<%= form_tag( {:controller => 'panels',:action => "create"}) do %>
- <% if @panel.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@panel.errors.count, "error") %> prohibited this panel from being saved:</h2>
-
- <ul>
- <% @panel.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+ <%= render 'system/error_explanation', :obj => @panel %>
<label for="json">json data</label> <%= text_field_tag "json" %>
<%= submit_tag 'upload' -%>
<% end -%>
<%= form_for(@story) do |f| %>
- <% if @story.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@story.errors.count, "error") %> prohibited this comic from being saved:</h2>
-
- <ul>
- <% @story.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+ <%= render 'system/error_explanation', :obj => @story %>
<div class="field">
<%= f.hidden_field :comic_id %>
<%= form_for(@story) do |f| %>
- <% if @story.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@story.errors.count, "error") %> prohibited this comic from being saved:</h2>
-
- <ul>
- <% @story.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+ <%= render 'system/error_explanation', :obj => @story %>
<div class="field">
<%= f.number_field :comic_id %>
--- /dev/null
+<% if obj.errors.any? %>
+ <div id="error_explanation">
+ <h2>
+ <%=
+ if obj.errors.size == 1
+ t('activerecord.errors.template.header.one', :model => obj.class.model_name.human)
+ else
+ t('activerecord.errors.template.header.other', :model => obj.class.model_name.human, :count => obj.errors.size)
+ end
+ %>
+ </h2>
+ <ul>
+ <% obj.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+<% end %>