app/models/inputs/asset_box.rb in effective_assets-1.1.2 vs app/models/inputs/asset_box.rb in effective_assets-1.2.0
- old
+ new
@@ -10,14 +10,20 @@
end
def to_html
output = ''
output += header_html
- output += attachments_html
- output += dialog_html if @options[:dialog]
- output += uploader_html if @options[:uploader]
+ if @options[:uploader] == :top
+ output += uploader_html
+ output += attachments_html
+ output += dialog_html if @options[:dialog]
+ else
+ output += attachments_html
+ output += dialog_html if @options[:dialog]
+ output += uploader_html if @options[:uploader]
+ end
output += footer_html
output.html_safe
end
@@ -31,10 +37,11 @@
data-limit='#{@options[:limit]}'
data-attachable-id='#{@options[:attachable_id]}'
data-attachable-type='#{@options[:attachable_type]}'
data-attachable-object-name='#{@object_name}'
data-attachment-style='#{@options[:attachment_style]}'
+ data-attachment-add-to='#{@options[:attachment_add_to]}'
data-attachment-actions='#{@options[:attachment_actions].to_json()}'
data-aws-acl='#{@options[:aws_acl]}'
>".html_safe
end
@@ -42,14 +49,13 @@
if @options[:attachment_style] == :table
content_tag(:table, :class => 'table') do
content_tag(:thead) do
content_tag(:tr) do
[
- content_tag(:th, 'Thumbnail'),
- content_tag(:th, 'Title'.html_safe + (@options[:table_filter_bar] ? filter_bar_html : '')),
- content_tag(:th, 'Size'),
- content_tag(:th)
+ content_tag(:th, ''),
+ content_tag(:th, ''),
+ content_tag(:th, (@options[:table_filter_bar] ? filter_bar_html : ''), :colspan => 2)
].join().html_safe
end
end + content_tag(:tbody, build_values_html, :class => 'attachments')
end
elsif @options[:attachment_style] == :list
@@ -75,10 +81,11 @@
:uid => @options[:uid],
:limit => @options[:limit],
:disabled => @options[:disabled],
:file_types => @options[:file_types],
:progress_bar_partial => @options[:progress_bar_partial],
+ :drop_files => @options[:uploader_drop_files],
:aws_acl => @options[:aws_acl]
}
).html_safe
end
@@ -127,12 +134,14 @@
@object.attachments.select { |attachment| attachment.box == @options[:box] }
end
def initialize_options(method, opts)
{
- :uploader => true,
+ :uploader => true, # :top, :bottom, true or false
+ :uploader_drop_files => false,
:progress_bar_partial => 'asset_box_input/progress_bar_template',
:attachment_style => :thumbnail, # :thumbnail, :table, or :list
+ :attachment_add_to => :bottom, # :bottom or :top (of attachments div)
:attachment_actions => [:remove], # or :insert, :delete, :remove
:table_filter_bar => false,
:dialog => false,
:dialog_url => @template.effective_assets.effective_assets_path,
:disabled => false,