app/models/inputs/asset_box.rb in effective_assets-1.6.2 vs app/models/inputs/asset_box.rb in effective_assets-1.6.3
- old
+ new
@@ -68,15 +68,11 @@
end
def attachments_table_head_html
content_tag(:thead) do
content_tag(:tr) do
- [
- content_tag(:th, ''),
- content_tag(:th, ''),
- content_tag(:th, filter_bar_html, :colspan => 2)
- ].join().html_safe
+ content_tag(:th, filter_bar_html, :colspan => 4)
end
end
end
def dialog_html
@@ -104,20 +100,15 @@
}
).html_safe
end
def filter_bar_html
- "<input type='text' class='form-control filter-attachments' placeholder='Search Title'>".html_safe
+ "<input type='text' class='form-control filter-attachments' placeholder='Filter by title'>".html_safe
end
def build_values_html
- count = 0
-
- attachments.map do |attachment|
- count += 1 unless attachment.marked_for_destruction?
-
- attachment_partial =
+ attachment_partial =
case @options[:attachment_style]
when :table
'attachment_as_table'
when :list
'attachment_as_list'
@@ -127,21 +118,21 @@
'attachment_as_thumbnail'
else
raise "unknown AssetBox attachment_style: #{@options[:attachment_style]}. Valid options are :thumbnail, :list and :table"
end
- render(
- :partial => "asset_box_input/#{attachment_partial}",
- :locals => {
- :attachment => attachment,
- :attachment_actions => @options[:attachment_actions].map(&:to_s),
- :attachment_links => @options[:attachment_links],
- :hidden => (count > @options[:limit]),
- :disabled => @options[:disabled],
- :attachable_object_name => @object_name,
- }
- )
- end.join.html_safe
+ render(
+ :partial => "asset_box_input/#{attachment_partial}",
+ :collection => attachments.reject { |attachment| attachment.marked_for_destruction? },
+ :as => :attachment,
+ :locals => {
+ :attachment_actions => @options[:attachment_actions].map { |action| action.to_s },
+ :attachment_links => @options[:attachment_links],
+ :limit => @options[:limit],
+ :disabled => @options[:disabled],
+ :attachable_object_name => @object_name
+ }
+ )
end
def footer_html
"</div>".html_safe
end