Implements a poster feature for the proposals dashboard
This commit is contained in:
Juan Salvador Pérez García
2018-07-31 12:50:25 +02:00
parent 06fbc8bbb4
commit 6cc1ddb9af
34 changed files with 502 additions and 115 deletions

View File

@@ -60,4 +60,11 @@ module ApplicationHelper
def kaminari_path(url)
"#{root_url.chomp("\/")}#{url}"
end
def self.asset_data_base64(path)
asset = Rails.application.assets.find_asset(path)
throw "Could not find asset '#{path}'" if asset.nil?
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "")
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}"
end
end