Add mandatory fields to assets

This commit is contained in:
Christophe Vilayphiou 2012-05-17 16:40:09 +08:00
parent 4467bc5e48
commit 29c54e6480
3 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
/*message*/ /*message*/
.error{ .error{
color:red; color: #B94A48;
} }
.notice, .message{ .notice, .message{

View File

@ -10,7 +10,7 @@ class Asset
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
validates_presence_of :filename, :data validates_presence_of :filename, :data, :asset_category_id
belongs_to :asset_category belongs_to :asset_category
belongs_to :assetable, polymorphic: true belongs_to :assetable, polymorphic: true

View File

@ -9,7 +9,7 @@
</div> </div>
<div class="modal-body form-horizontal"> <div class="modal-body form-horizontal">
<div class="control-group"> <div class="control-group">
<label for="title" class="control-label"><%= t 'admin.title' %></label> <label for="title" class="control-label error"><%= t 'admin.title' %></label>
<div class="controls"> <div class="controls">
<%= f.fields_for :i18n_variable, (@asset.new_record? ? @asset.build_i18n_variable : @asset.i18n_variable) do |f| %> <%= f.fields_for :i18n_variable, (@asset.new_record? ? @asset.build_i18n_variable : @asset.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
@ -23,8 +23,8 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group error">
<label class="control-label"><%= f.label :category, t('admin.category') %></label> <%= f.label :category, t('admin.category'), :class => "control-label" %>
<div class="controls"> <div class="controls">
<%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-large" %> <%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-large" %>
</div> </div>
@ -41,7 +41,7 @@
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label"><%= f.label :data, t('admin.data') %></label> <%= f.label :data, t('admin.data'), :class => "control-label" %>
<div class="controls"> <div class="controls">
<%= f.file_field :data, :class => 'upload' %> <%= f.file_field :data, :class => 'upload' %>
</div> </div>