Class: Formily::MultipleFileInput

Inherits:
Input
  • Object
show all
Defined in:
app/models/formily/multiple_file_input.rb

Instance Method Summary collapse

Methods inherited from Input

#conditioned_tag, #get_default_value, #partial_path, #render_attributes, #render_attributes_hash, #to_html

Instance Method Details

#editor_typeObject



4
5
6
# File 'app/models/formily/multiple_file_input.rb', line 4

def editor_type
  'multi file'
end

#get_value_from_submit(submit) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/models/formily/multiple_file_input.rb', line 8

def get_value_from_submit(submit)
  value = submit.input_values.find_by(input_id: self.id) rescue nil

  if value
    value.attach.map{|f| [f.file.url, f.id, f.file_file_name, (f.file_file_name.match(/([^.]+)\z/)[0] rescue '?')]}
  else
    []
  end
end