Module: Palapala::AssetsHelper

Defined in:
lib/palapala/asset_helper.rb

Instance Method Summary collapse

Instance Method Details

#palapala_pdf_base64_asset(path) ⇒ Object



60
61
62
63
64
# File 'lib/palapala/asset_helper.rb', line 60

def palapala_pdf_base64_asset(path)
  return nil unless (asset = AssetFinder.find(path))

  "data:#{asset.content_type};base64,#{Base64.encode64(asset.content).gsub(/\s+/, "")}"
end

#palapala_pdf_inline_javascript(path) ⇒ Object



56
57
58
# File 'lib/palapala/asset_helper.rb', line 56

def palapala_pdf_inline_javascript(path)
  (asset = AssetFinder.find(path)) ? "<script>#{asset.content}</script>".html_safe : nil
end

#palapala_pdf_inline_stylesheet(path) ⇒ Object



52
53
54
# File 'lib/palapala/asset_helper.rb', line 52

def palapala_pdf_inline_stylesheet(path)
  (asset = AssetFinder.find(path)) ? "<style>#{asset.content}</style>".html_safe : nil
end