class Schoolkeep::Views::Layout
Constants
- BODY_CLASSES
- LAYOUTS
Attributes
asset_host[RW]
body[R]
Public Class Methods
asset_cache()
click to toggle source
# File lib/schoolkeep/views/layout.rb, line 13 def asset_cache @asset_cache ||= AssetCache.new(asset_host) end
new(template)
click to toggle source
# File lib/schoolkeep/views/layout.rb, line 30 def initialize(template) @template = template @school = Fixture.globals[:current_school] @preview_banner = Fixture.globals[:preview_banner] end
Public Instance Methods
asset_url(path)
click to toggle source
# File lib/schoolkeep/views/layout.rb, line 40 def asset_url(path) self.class.asset_cache[path] end
body_classes()
click to toggle source
# File lib/schoolkeep/views/layout.rb, line 36 def body_classes BODY_CLASSES[@template.name] end
current_school()
click to toggle source
# File lib/schoolkeep/views/layout.rb, line 44 def current_school @school end
render(variables: {})
click to toggle source
# File lib/schoolkeep/views/layout.rb, line 57 def render(variables: {}) @body = @template.render(variables: variables) layout_path = File.join(GEM_ROOT, "config/#{LAYOUTS[@template.name]}.html.erb") layout= File.read(layout_path) set_context_variables_for_layout ERB.new(layout).result(binding) end
render_skt(partial_name, variables: {})
click to toggle source
# File lib/schoolkeep/views/layout.rb, line 52 def render_skt(partial_name, variables: {}) name = "#{partial_name}.html.sktl" Template.new(name).render(variables: variables) end
Private Instance Methods
set_context_variables_for_layout()
click to toggle source
# File lib/schoolkeep/views/layout.rb, line 67 def set_context_variables_for_layout @display_search_form = @template.name == "my_content.html.sktl" end