Sha256: 7064e90e7316d28b1c8006a60e0fc18757a94044921c862342cc49108127ab74

Contents?: true

Size: 742 Bytes

Versions: 4

Compression:

Stored size: 742 Bytes

Contents

require 'erector'

class PrettyFileInput::Component < Erector::Widget
  needs :name,
        persisted: false,
        filename: nil,
        method: nil,
        action: nil,
        additional_params: {}

  def content
    div(
      class: "pfi cf #{@filename ? 'is_uploaded' : ''}",
      'data-pfi' => {
        name: @name,
        persisted: @persisted,
        action: @action,
        method: @method,
        additionalParams: @additional_params
      }.to_json
    ) {
      div.pfi_uploaded {
        span.pfi_existing_filename @filename
        text ' '
        a.button.mini.info 'Remove', 'data-pfi-remove' => true
      }
      div.pfi_not_uploaded {
        input type: 'file'
        span.pfi_status
      }
    }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pretty_file_input-0.0.5 lib/pretty_file_input/component.rb
pretty_file_input-0.0.4 lib/pretty_file_input/component.rb
pretty_file_input-0.0.3 lib/pretty_file_input/component.rb
pretty_file_input-0.0.2 lib/pretty_file_input/component.rb