Sha256: 62e47d585fb8cf23810871bb36354fdeb8c7f6348f672765382a0842560d78e8
Contents?: true
Size: 1.52 KB
Versions: 20
Compression:
Stored size: 1.52 KB
Contents
module Smithy module Liquid module Rendering private def render_smithy_page if smithy_current_user output = @page.render(liquid_context) else output = Rails.cache.fetch("#{@page.cache_key}-render_smithy_page") do @page.render(liquid_context) end end render :text => output, :layout => false end def render_as_smithy_page(template_name) output = Smithy::Template.templates.find_by_name(template_name).liquid_template.render(liquid_context) render :text => output, :layout => false end def liquid_context ::Liquid::Context.new({}, smithy_default_assigns, smithy_default_registers, !Rails.env.production?) end def smithy_default_assigns { 'page' => @page, 'current_page' => self.params[:path], 'params' => self.params, 'path' => request.path, 'fullpath' => request.fullpath, 'url' => request.url, 'now' => Time.now.utc, 'today' => Date.today, 'site' => Smithy::Site.instance } end def smithy_default_registers(controller=nil) controller = self.controller if self.respond_to?(:controller) controller ||= self { :controller => controller, :page => @page, :site => Smithy::Site.instance } end end end end
Version data entries
20 entries across 20 versions & 1 rubygems