Class: DeletableAttachmentInput

Inherits:
SimpleForm::Inputs::FileInput
  • Object
show all
Defined in:
app/inputs/deletable_attachment_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'app/inputs/deletable_attachment_input.rb', line 2

def input(wrapper_options)
  merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
  out = ''
  out << @builder.file_field(attribute_name, merged_input_options)
  if object.send("#{attribute_name}?")
    out << @builder.input("delete_#{attribute_name}", as: :boolean, label: "Remove?", wrapper_html: { class: 'deletable_attachment_input' })
  end
  out.html_safe
end