Sha256: a57c4f21bef936bb991881f0e962153d4c44311bedcbab062a810e30fa1f8e43
Contents?: true
Size: 1.62 KB
Versions: 7
Compression:
Stored size: 1.62 KB
Contents
ruby: require_locals ['f'], local_assigns item ||= f.object file_name ||= :file the_file = item.send(file_name) label ||= file_name.to_s.titleize helper_text ||= "" required ||= false languages = f.object.class.try(:fae_fields).try(:[], file_name).try(:[], :languages) language ||= nil - if languages.present? - languages.each do |lang| = render 'fae/application/file_uploader', f: f, item: item, file_name: "#{file_name}_#{lang}".to_sym, label: "#{label} (#{lang.to_s})", helper_text: helper_text, required: required, language: lang - else - wrapper_html = language.present? ? { data: { language: language } } : {} = f.simple_fields_for file_name, defaults: { wrapper_html: wrapper_html } do |i| .input.field = content_tag :label, class: ('required' if required) do - if required abbr title="required" * = label.html_safe - if helper_text.present? h6.helper_text = helper_text - if the_file.asset.present? .asset-actions.-files a.asset-title href=the_file.asset.url target="_blank" = the_file.asset.file.filename = link_to '', fae.delete_file_path(the_file.id), class: 'asset-delete js-asset-delete', remote: true, method: :delete, data: { confirm: t('fae.delete_confirmation') } .asset-inputs style="#{'display: none;' unless the_file.asset.blank?}" = i.input :asset, as: :file, label: false, input_html: { data: { limit: Fae.max_file_upload_size, exceeded: t('fae.exceeded_upload_limit') } } = i.input :asset_cache, as: :hidden = i.hidden_field :required, value: required
Version data entries
7 entries across 7 versions & 2 rubygems