Class: Decidim::AttachmentUploader

Inherits:
ApplicationUploader show all
Defined in:
decidim-core/app/uploaders/decidim/attachment_uploader.rb

Overview

This class deals with uploading attachments to a participatory space.

Instance Attribute Summary

Attributes inherited from ApplicationUploader

#content_type_denylist, #model, #mounted_as

Instance Method Summary collapse

Methods inherited from ApplicationUploader

#attached?, #initialize, #path, #remote_url=, set_variants, #store_dir, #url, #variant, #variant_path, #variant_url, variants

Constructor Details

This class inherits a constructor from Decidim::ApplicationUploader

Instance Method Details

#content_type_allowlistObject



26
27
28
29
30
31
32
33
# File 'decidim-core/app/uploaders/decidim/attachment_uploader.rb', line 26

def content_type_allowlist
  case upload_context
  when :admin
    Decidim.organization_settings(model).upload_allowed_content_types_admin
  else
    Decidim.organization_settings(model).upload_allowed_content_types
  end
end

#extension_allowlistObject



17
18
19
20
21
22
23
24
# File 'decidim-core/app/uploaders/decidim/attachment_uploader.rb', line 17

def extension_allowlist
  case upload_context
  when :admin
    Decidim.organization_settings(model).upload_allowed_file_extensions_admin
  else
    Decidim.organization_settings(model).upload_allowed_file_extensions
  end
end

#max_image_height_or_widthObject



35
36
37
# File 'decidim-core/app/uploaders/decidim/attachment_uploader.rb', line 35

def max_image_height_or_width
  8000
end

#validable_dimensionsObject



6
7
8
# File 'decidim-core/app/uploaders/decidim/attachment_uploader.rb', line 6

def validable_dimensions
  true
end