Sha256: e803c1c8761b849f41ff43bc44bcbdad3081997a0d5cc54f594c43ad776c44eb
Contents?: true
Size: 1.51 KB
Versions: 3
Compression:
Stored size: 1.51 KB
Contents
<% # model_name # attribute_name # value # options preview = options.delete(:preview) || false hide_files = options.delete(:hide_files) || false prefix = "#{model_name}[#{attribute_name}_attributes]" file_attrs = { id: "#{model_name}_#{attribute_name}_file", data: { :"model-name" => model_name, :"attr-name" => attribute_name, :"file-upload" => file_upload.bulk_redis_files_path } }.tap do |a| a[:"data-autosubmit"] = true if options.delete(:autosubmit) end -%> <div class="file_upload <%= attribute_name %>"> <% if value && value.persisted? %> <%= hidden_field_tag("#{prefix}[id]", value.id) %> <% end %> <%= hidden_field_tag("#{prefix}[_destroy]", 1) %> <div class="inputs <%= 'hide' if hide_files %>"> <% if value %> <label> <% if value.persisted? %> <%= check_box_tag("#{prefix}[_destroy]", 0, checked: true) %> <% elsif value.key %> <%= hidden_field_tag("#{prefix}[key]", value.key) %> <%= check_box_tag("#{prefix}[_destroy]", 0, checked: true) %> <% elsif value.copy_from %> <%= check_box_tag("#{prefix}][copy_from]", file.copy_from, checked: true) %> <% end %> <%= value.name %> (<%= file_size value %>)kB </label> <% end %> </div> <% if preview %><p class="preview"><%= image_tag(value.url) if value && value.url %></p><% end %> <div class="errors"></div> <div class="hide"> <%= file_field_tag "redis_files[][data]", file_attrs %> </div> <%= yield %> </div>
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
file_upload-0.0.3 | app/views/file_upload/tags/_single.html.erb |
file_upload-0.0.2 | app/views/file_upload/tags/_single.html.erb |
file_upload-0.0.1 | app/views/file_upload/tags/_single.html.erb |