Class: SimpleFormExtension::Inputs::ImageInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Includes:
Translations
Defined in:
lib/simple_form_extension/inputs/image_input.rb

Instance Method Summary collapse

Methods included from Translations

#_translate

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/simple_form_extension/inputs/image_input.rb', line 6

def input(wrapper_options = nil)
  input_html_options[:class] << "image-upload"

  "<div class=\"fileinput fileinput-new\" data-provides=\"fileinput\">
    <div class=\"\">
      <div class=\"btn btn-default btn-file\" type=\"button\">
        <span class=\"fileinput-new\">#{ _translate('image.select') }</span>
        <span class=\"fileinput-exists\">#{ _translate('image.change') }</span>
        #{@builder.file_field(attribute_name, input_html_options)}
      </div>
      <button class=\"btn btn-danger fileinput-exists\" data-dismiss=\"fileinput\" type=\"button\"><i class=\"fa fa-times\"></i></button>
    </div>
    <div class=\"fileinput-preview thumbnail\">
      #{ image_tag }
    </div>
  </div>".html_safe
end