Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="simple_form-field">
- <% if !@product.valid? && !@product.id || @product.photo_errors? || !@product.photo.file? %>
- <%= f.file_field(:photo) %>
- <% [:photo_file_size, :photo_file_name, :photo_content_type].each do |attr| %>
- <% if !@product.errors[attr].blank? %>
- <div class="field_error"><%= @product.errors[attr][0] %></div>
- <% end %>
- <% end %>
- <% else %>
- <div class="simple_form-field-photo">
- <p class="hidden"><%= f.file_field :photo, :id => 'product_image' %></p>
- <p id="product_image_text">
- <%= image_tag(@product.photo.url(:medium), :alt => @product.name) %><br>
- </p>
- <p><%= link_to_function("Change", "add_field('product_image', '', 'Cancel changes', this)") %></p>
- </div>
- <% end %>
- </div>
Add Comment
Please, Sign In to add comment