Class: PrettyFileInput::Component

Inherits:
Erector::Widget
  • Object
show all
Defined in:
lib/pretty_file_input/component.rb

Instance Method Summary collapse

Instance Method Details

#contentObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pretty_file_input/component.rb', line 11

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