app/helpers/active_admin/views_helper.rb in activeadmin-dropzone-0.0.2 vs app/helpers/active_admin/views_helper.rb in activeadmin-dropzone-0.1.0
- old
+ new
@@ -1,18 +1,11 @@
module ActiveAdmin::ViewsHelper
def render_mock_dropzone_files(dropzone_objects)
- dropzone_objects.map do |dropzone_object|
- {
- id: dropzone_object.id,
- name: dropzone_object.send(dropzone_object.class.dropzone_field(:title)),
- size: dropzone_object.send(dropzone_object.class.dropzone_field(:file_size)),
- url: dropzone_object.send(dropzone_object.class.dropzone_field(:url))
- }
- end.map do |hash|
- hash.map{ |(k, v)| "#{ k }: '#{ v }'" }.join(',')
- end.map do |string|
- "{#{ string }}"
- end.join(', ').html_safe
+ unless dropzone_objects.empty?
+ dropzone_objects.map do |dropzone_object|
+ "{ id: #{ dropzone_object.id }, name: '#{ dropzone_object.send dropzone_object.class.dropzone_title_field }', size: #{ dropzone_object.send dropzone_object.class.dropzone_file_size_field }, url: '#{ dropzone_object.send dropzone_object.class.dropzone_url_field }' }"
+ end.join(', ').html_safe
+ end
end
end
\ No newline at end of file