Sha256: 08fa99555c81a83c0d372a9e8337415f307353f400054ffd43ea1a86e1628ac7
Contents?: true
Size: 778 Bytes
Versions: 1
Compression:
Stored size: 778 Bytes
Contents
module Poirot module AssetHelper def template_include_tag(*sources) sources.collect do |source| template = File.open(_poirot_resolve_partial_path(source), "rb") content_tag :script, template.read.html_safe, :type => "text/mustache", :id => "#{source.parameterize.dasherize}-template" end.join("\n").html_safe end def _poirot_resolve_partial_path(source) if source.to_s =~ /^\// # absolute path to a different view folder segments = source.to_s.split('/') partial_name = "_#{segments.pop}.html.mustache" segments << partial_name Rails.root.join('app/views', *segments) else Rails.root.join('app/views', controller_name, "_#{source}.html.mustache") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
poirot-0.0.3 | lib/poirot/asset_helper.rb |