Module: Alchemy::Admin::AttachmentsHelper

Includes:
BaseHelper, Filetypes
Defined in:
app/helpers/alchemy/admin/attachments_helper.rb

Constant Summary

Constants included from Filetypes

Filetypes::ARCHIVE_FILE_TYPES, Filetypes::AUDIO_FILE_TYPES, Filetypes::EXCEL_FILE_TYPES, Filetypes::IMAGE_FILE_TYPES, Filetypes::POWERPOINT_FILE_TYPES, Filetypes::TEXT_FILE_TYPES, Filetypes::VCARD_FILE_TYPES, Filetypes::VIDEO_FILE_TYPES, Filetypes::WORD_FILE_TYPES

Instance Method Summary collapse

Methods included from BaseHelper

#alchemy_body_class, #alchemy_datepicker, #button_with_confirm, #clipboard_select_tag_options, #current_alchemy_user_name, #delete_button, #hint_with_tooltip, #js_filter_field, #link_to_confirm_dialog, #link_to_dialog, #link_url_regexp, #page_layout_missing_warning, #render_alchemy_title, #render_hint_for, #sites_for_select, #toolbar_button, #translations_for_select

Methods included from NavigationHelper

#alchemy_main_navigation_entry, #entry_active?, #main_navigation_css_classes, #navigate_module, #sorted_alchemy_modules, #url_for_module, #url_for_module_sub_navigation

Methods included from BaseHelper

#page_or_find, #render_icon, #render_message, #shorten, #warning

Instance Method Details

#attachment_preview_size(attachment) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/alchemy/admin/attachments_helper.rb', line 13

def attachment_preview_size(attachment)
  case attachment.file_mime_type
  when *IMAGE_FILE_TYPES then "600x475"
  when *AUDIO_FILE_TYPES then "600x190"
  when *VIDEO_FILE_TYPES then "600x485"
  when "application/pdf" then "600x600"
  else
    "600x145"
  end
end

#mime_to_human(mime) ⇒ Object



9
10
11
# File 'app/helpers/alchemy/admin/attachments_helper.rb', line 9

def mime_to_human(mime)
  Alchemy.t(mime, scope: "mime_types", default: Alchemy.t(:document))
end