Sha256: d6bbdeed031b274ff725b5fd9f599130ae0b0b2280677c975ea2e68d42eb62c2

Contents?: true

Size: 485 Bytes

Versions: 3

Compression:

Stored size: 485 Bytes

Contents

class PrettyFileInputInput < SimpleForm::Inputs::Base
  def input(wrapper_options)
    @builder.multipart = true
    PrettyFileInput::Component.new(
      name: tag_name,
      persisted: object.try(:persisted?),
      filename: object.try(:send, attribute_name).try(:file).try(:filename)
    ).to_html
  end

  # Not sure why this is so goddamn hard to retrieve
  def tag_name
    ActionView::Helpers::Tags::Base.new(object_name, attribute_name, nil).
      send(:tag_name)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pretty_file_input-0.0.5 app/inputs/pretty_file_input_input.rb
pretty_file_input-0.0.4 app/inputs/pretty_file_input_input.rb
pretty_file_input-0.0.3 app/inputs/pretty_file_input_input.rb