Class: Formbuilder::ResponseFieldFile
- Inherits:
-
ResponseField
- Object
- ActiveRecord::Base
- ResponseField
- Formbuilder::ResponseFieldFile
- Defined in:
- app/models/formbuilder/response_field_file.rb
Constant Summary
Constants inherited from ResponseField
Formbuilder::ResponseField::ALLOWED_PARAMS
Instance Attribute Summary
Attributes inherited from ResponseField
#cid, #field_type, #input_field, #options_field, #serialized, #sort_as_numeric
Instance Method Summary collapse
Methods inherited from ResponseField
#audit_response, #has_length_validations?, #length_validations, #min_max_validations, #render_entry_for_table, #validate_response
Instance Method Details
#render_entry(value, opts = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/formbuilder/response_field_file.rb', line 18 def render_entry(value, opts = {}) = EntryAttachment.find(value) return unless str = "" str += """ <a href='#{attachment.upload.url}' target='_blank'> """ if .upload.send(:active_versions).include?(:thumb) str += """ <img src='#{attachment.upload.thumb.url}' /><br /> """ end str +=""" #{attachment.upload.try(:file).try(:filename).try(:gsub, /\?.*$/, '')} </a> """ str end |
#render_input(value, opts = {}) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/models/formbuilder/response_field_file.rb', line 9 def render_input(value, opts = {}) = value && EntryAttachment.find(value) """ <span class='existing-filename'>#{attachment.try(:upload).try(:file).try(:filename).try(:gsub, /\?.*$/, '')}</span> <input type='file' name='response_fields[#{self[:id]}]' /> """ end |