Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix image import form partial to only display imported image if it ex…

…ists.
  • Loading branch information...
commit a10e20698d237b65770c63027b900aafef6543a9 1 parent fa0b1ab
Igal Koshevoy igal authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 app/views/site/_import_image_from_url_tags.html.haml
8 app/views/site/_import_image_from_url_tags.html.haml
View
@@ -1,5 +1,11 @@
+-# Display the form fields for adding or importing a photo, and display a photo if associated.
+-#
+-# ARGUMENTS:
+-# * form: The Rails HTML form instance.
+-# * record: The ActiveRecord model instance.
+-# * field: The String or Symbol name of the field containing the image, e.g. :logo.
= form.inputs :name => record.class.human_attribute_name(field) do
- - if image_url = record.send("#{field}_import_url") || (record.send(field).file? && record.send(field).url(:medium))
+ - if image_url = record.send("#{field}_import_url").presence || (record.send(field).file? && record.send(field).url(:medium))
%li
= image_tag image_url, :size => '220'
Please sign in to comment.
Something went wrong with that request. Please try again.