Sha256: 306e427154215b7988cc2830b1251e972fd2eff94ed01c4315630cde7303b380
Contents?: true
Size: 937 Bytes
Versions: 7
Compression:
Stored size: 937 Bytes
Contents
module Stache module AssetHelper # template_include_tag("widgets/basic_text_api_data") # template_include_tag("shared/test_thing") def template_include_tag(*sources) options = sources.extract_options! sources.collect do |source| template_finder = lambda do |partial| if ActionPack::VERSION::MAJOR == 3 && ActionPack::VERSION::MINOR < 2 lookup_context.find(source, [], partial) else # Rails 3.2 and higher lookup_context.find(source, [], partial, [], { formats: [:html] }) end end template = template_finder.call(true) rescue template_finder.call(false) template_id = source.split("/").last options = options.reverse_merge(:type => "text/html", :id => "#{template_id.dasherize.underscore}_template") content_tag(:script, template.source.html_safe, options) end.join("\n").html_safe end end end
Version data entries
7 entries across 7 versions & 1 rubygems