Class: SimpleFormFancyUploads::ImagePreviewInput

Inherits:
SimpleForm::Inputs::FileInput
  • Object
show all
Defined in:
lib/simple_form_fancy_uploads/image_preview_input.rb

Instance Method Summary collapse

Instance Method Details

#inputObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/simple_form_fancy_uploads/image_preview_input.rb', line 3

def input
  version = input_html_options.delete(:preview_version)
  use_default_url = options.delete(:use_default_url) || false

  out = ''
  if object.send("#{attribute_name}?") || use_default_url
    out << template.image_tag(object.send(attribute_name).tap {|o| break o.send(version) if version}.send('url'))
  end
  (out << super).html_safe
end