Sha256: e5b0e824ece18ea733bed8f7bcba310285700d6721f81df69844e77b0b1a54d1
Contents?: true
Size: 1.42 KB
Versions: 16
Compression:
Stored size: 1.42 KB
Contents
# DEPRECATED - use url_media instead #------------------------------------------------------------------------------ module Liquid class UrlAsset < DmCore::LiquidTag include ActionView::Helpers::TagHelper include ActionView::Helpers::AssetTagHelper include DmCore::UrlHelper include DmCore::ParamsHelper include DmCore::AccountHelper #------------------------------------------------------------------------------ def render(context) if @attributes['version'] #--- pull from MediaFile object src = MediaFile.url_by_name(@attributes['src'], version: @attributes['version']) else #--- handle like regular url src = file_url(@attributes['src'], account_site_assets: context_account_site_assets(context), default_folder: 'media', protected: @attributes['protected'].as_boolean) end return src.nil? ? '' : src end # def self.details # { name: self.tag_name, # summary: 'Returns url of an asset', # category: 'url', # description: <<-END_OF_DESCRIPTION # Give the location/url of an asset file. It is relative to the site's media directory unless a full path/url is given. # # ~~~ # {% url_asset src: 'library/something.pdf' %} # ~~~ # END_OF_DESCRIPTION # } # end end Template.register_tag('url_asset', UrlAsset) Template.register_tag('image_path', UrlAsset) Template.register_tag('url_image', UrlAsset) end
Version data entries
16 entries across 16 versions & 1 rubygems