Module: Theme::Assets::Render

Defined in:
lib/theme/assets/render.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.setup(app) ⇒ Object



4
5
6
7
# File 'lib/theme/assets/render.rb', line 4

def self.setup app
  app.settings[:render] ||= {}
  load_engines
end

Instance Method Details

#partial(file, options = {}) ⇒ Object



23
24
25
26
27
# File 'lib/theme/assets/render.rb', line 23

def partial file, options = {}
  file.gsub! PARTIAL_REGEX, '_\1'
  path = "#{settings[:render][:views] || Theme.config.view_path}"
  Theme.load_file "#{path}/#{file}", options, self
end

#render(file, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/theme/assets/render.rb', line 14

def render file, options = {}
  path        = "#{settings[:render][:views] || Theme.config.view_path}"
  layout_path = settings[:layout_path] || Theme.config.layout_path
  layout      = "#{layout_path}/#{settings[:render][:layout] || Theme.config.layout}"
  content     = Theme.load_file "#{path}/#{file}", options, self
  options[:content] = content
  Theme.load_file layout, options, self
end

#view(file, options = {}) ⇒ Object



9
10
11
12
# File 'lib/theme/assets/render.rb', line 9

def view file, options = {}
  path = "#{settings[:render][:views] || Theme.config.view_path}"
  Theme.load_file "#{path}/#{file}", options, self
end