Skip to content

Commit

Permalink
no longer require a url for an image
Browse files Browse the repository at this point in the history
  • Loading branch information
jswanner committed Jun 29, 2011
1 parent 1df8ee1 commit d58dddc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions app/models/image_rotator_image.rb
Expand Up @@ -5,8 +5,6 @@ class ImageRotatorImage < ActiveRecord::Base
belongs_to :image_rotator
belongs_to :image

validates :url, :presence => true

acts_as_indexed :fields => [:url]
acts_as_list

Expand Down
6 changes: 5 additions & 1 deletion app/views/admin/image_rotators/edit.html.erb
Expand Up @@ -29,7 +29,11 @@
<pre style="overflow-x: auto;"><code>
&lt;div class="image-rotator" style="height:<%= @image_rotator.height %>;width:<%= @image_rotator.width %>;"&gt;
<% @image_rotator.images.each do |image| %>
&lt;a href="<%= image.url %>"&gt;&lt;img src="<%= image.image.url %>" alt="<%= image.image.title %>" title="<%= image.caption %>" /&gt;&lt;/a&gt;
<% if image.url.present? %>
&lt;a href="<%= image.url %>"&gt;&lt;img src="<%= image.image.url %>" alt="<%= image.image.title %>" title="<%= image.caption %>" /&gt;&lt;/a&gt;
<% else %>
&lt;img src="<%= image.image.url %>" alt="<%= image.image.title %>" title="<%= image.caption %>" /&gt;
<% end %>
<% end %>
&lt;/div&gt;
</code></pre>
Expand Down

0 comments on commit d58dddc

Please sign in to comment.