diff --git a/app/models/banner.rb b/app/models/banner.rb index 1583c95..69d9733 100644 --- a/app/models/banner.rb +++ b/app/models/banner.rb @@ -6,7 +6,7 @@ class Banner field :ad_fx, type: String field :height, type: Integer - field :speed, type: Integer + field :speed, type: Integer, default: 500 field :title, type: String field :timeout, type: Integer, default: 5 field :width, type: Integer @@ -16,7 +16,6 @@ class Banner validates_uniqueness_of :title validates :title, :length => { :minimum => 2 } - validates :height, :speed, :timeout, :width, :presence => true FX_TYPES = %w(fade scrollHorz scrollVert tileSlide tileBlind) diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index c1d7eab..b13b345 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -7,6 +7,7 @@ <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <%= javascript_include_tag "lib/module-area" %> + <%= javascript_include_tag "validator" %> <% end %> <%#= f.error_messages %> @@ -38,7 +39,7 @@ <%= t(:select_image) %> <%= t(:change) %> - <%= f.file_field :file %> + <%= f.file_field :file, :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"}%> <%= t(:cancel) %>