Module: Lookbook::ApplicationHelper

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

Instance Method Summary collapse

Instance Method Details

#asset_path(file, version: true) ⇒ Object



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

def asset_path(file, version: true)
  path = "/lookbook-assets/#{file}".gsub("//", "/")
  version ? "#{path}?v=#{Lookbook::VERSION}" : path
end

#configObject



3
4
5
# File 'app/helpers/lookbook/application_helper.rb', line 3

def config
  Lookbook::Engine.config.lookbook
end

#feature_enabled?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

def feature_enabled?(name)
  Lookbook::Features.enabled?(name)
end

#generate_id(*args) ⇒ Object



29
30
31
# File 'app/helpers/lookbook/application_helper.rb', line 29

def generate_id(*args)
  args.map { |args| args.delete_prefix("/").tr("&?=/_-", "-") }.join("-")
end

#landing_pathObject



20
21
22
23
24
25
26
27
# File 'app/helpers/lookbook/application_helper.rb', line 20

def landing_path
  landing = Lookbook.pages.find(&:landing?) || Lookbook.pages.first
  if landing.present?
    lookbook_page_path landing.lookup_path
  else
    lookbook_home_path
  end
end

#themeObject



7
8
9
# File 'app/helpers/lookbook/application_helper.rb', line 7

def theme
  Lookbook.theme
end