Module: Bhf::ApplicationHelper

Defined in:
app/helpers/bhf/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#asset_exist?(path) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
44
# File 'app/helpers/bhf/application_helper.rb', line 38

def asset_exist?(path)
  if Rails.configuration.assets.compile
    Rails.application.precompiled_assets.include? path
  else
    Rails.application.assets_manifest.assets[path].present?
  end
end

#delete_t(platform) ⇒ Object



20
21
22
# File 'app/helpers/bhf/application_helper.rb', line 20

def delete_t(platform)
  t("bhf.helpers.entry.models.#{platform.model_name}.delete", platform_title: platform.title_singular.titleize, default: t('bhf.helpers.entry.delete')).html_safe
end

#duplicate_t(platform) ⇒ Object



12
13
14
# File 'app/helpers/bhf/application_helper.rb', line 12

def duplicate_t(platform)
  t("bhf.helpers.entry.models.#{platform.model_name}.duplicate", platform_title: platform.title_singular.titleize, default: t('bhf.helpers.entry.duplicate')).html_safe
end

#edit_t(platform) ⇒ Object



16
17
18
# File 'app/helpers/bhf/application_helper.rb', line 16

def edit_t(platform)
  t("bhf.helpers.entry.models.#{platform.model_name}.edit", platform_title: platform.title_singular.titleize, default: t('bhf.helpers.entry.edit')).html_safe
end

#find_smallest_size_url_for_file(file) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'app/helpers/bhf/application_helper.rb', line 24

def find_smallest_size_url_for_file(file)
  if file.exists?(:thumb)
    file.url(:thumb)
  elsif file.exists?(:medium)
    file.url(:medium)
  else
    file.url
  end
end

#new_t(platform) ⇒ Object



8
9
10
# File 'app/helpers/bhf/application_helper.rb', line 8

def new_t(platform)
  t("bhf.helpers.entry.models.#{platform.model_name}.new", platform_title: platform.title_singular.titleize, default: t('bhf.helpers.entry.new')).html_safe
end

#show_t(platform) ⇒ Object



4
5
6
# File 'app/helpers/bhf/application_helper.rb', line 4

def show_t(platform)
  t("bhf.helpers.entry.models.#{platform.model_name}.show", platform_title: platform.title_singular.titleize, default: t('bhf.helpers.entry.show')).html_safe
end

#type_is_image?(type) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/helpers/bhf/application_helper.rb', line 34

def type_is_image?(type)
  Bhf.configuration.paperclip_image_types.include?(type)
end