Module: WelltreatStoreFramework::HamlRenderer::Paths

Extended by:
ActiveSupport::Concern
Included in:
Context
Defined in:
lib/welltreat_store_framework/haml_renderer/paths.rb

Instance Method Summary collapse

Instance Method Details

#asset_path(*_paths) ⇒ Object



6
7
8
# File 'lib/welltreat_store_framework/haml_renderer/paths.rb', line 6

def asset_path(*_paths)
  UrlJoin.new('/assets').join(_paths)
end

#image_path(_path) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/welltreat_store_framework/haml_renderer/paths.rb', line 10

def image_path(_path)
  if _path.to_s.match(/^\//)
    _path
  elsif sprockets_enabled?
    asset_path _path
  else
    asset_path 'images', _path
  end
end

#javascript_path(_path) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/welltreat_store_framework/haml_renderer/paths.rb', line 33

def javascript_path(_path)
  _path = _path.to_s
  _path << '.js' unless _path.to_s.match(/\.js$/)

  if _path.to_s.match(/^\//)
    _path
  elsif sprockets_enabled?
    asset_path _path
  else
    asset_path 'javascripts', _path
  end
end

#sprockets_enabled?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/welltreat_store_framework/haml_renderer/paths.rb', line 46

def sprockets_enabled?
  WelltreatStoreFramework::Core.configuration.sprockets_enabled
end

#stylesheet_path(_path) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/welltreat_store_framework/haml_renderer/paths.rb', line 20

def stylesheet_path(_path)
  _path = _path.to_s
  _path << '.css' unless _path.to_s.match(/\.css$/)

  if _path.to_s.match(/^\//)
    _path
  elsif sprockets_enabled?
    asset_path _path
  else
    asset_path 'stylesheets', _path
  end
end