Sha256: a928790169a82239d51b8f3d8c3d97f422b87b6a7a5122ca5e0123a3a4a38026
Contents?: true
Size: 829 Bytes
Versions: 12
Compression:
Stored size: 829 Bytes
Contents
module Coprl::Presenters::WebClient::Helpers::Sinatra module Partials # Called by built in views def partial(template, *args) template = _add_underscore(template) template = _add_application_dir(template) unless template.start_with?("components/") || template.start_with?("body/") options = args.last.is_a?(Hash) ? args.pop : {} options.merge!(:layout => false) erb(:"#{template}", options) end # Called by plugins def render_partial(engine, template, options = {}, locals = {}, &block) partial(template, options) end def _add_underscore(template) template_array = template.to_s.split('/') template_array[0..-2].join('/') + "/_#{template_array[-1]}" end def _add_application_dir(template) "application/#{template}" end end end
Version data entries
12 entries across 12 versions & 1 rubygems