Sha256: 58cedb9e1e13ef6003a06c6c7a3971c02e99934b471db3dea4848896cf19d58f

Contents?: true

Size: 915 Bytes

Versions: 16

Compression:

Stored size: 915 Bytes

Contents

module Liquid
  class UrlProtected < DmCore::LiquidTag
    include ActionView::Helpers::TagHelper 
    include ActionView::Helpers::AssetTagHelper
    include DmCore::UrlHelper
    include DmCore::ParamsHelper
    include DmCore::AccountHelper

    #------------------------------------------------------------------------------
    def render(context)
      src = file_url(@attributes["src"], account_site_assets: context_account_site_assets(context), default_folder: '', protected: true)
      return src.nil? ? '' : src
    end
  
    def self.details
      { name: self.tag_name,
        summary: 'Returns url of a protected asset',
        category: 'url',
        description: <<-END_OF_DESCRIPTION
Give the location/url of a protected asset file.

~~~
{% url_protected src: 'teachers/something.pdf' %}
~~~
END_OF_DESCRIPTION
      }
    end
  end
  
  Template.register_tag('url_protected', UrlProtected)
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dm_cms-4.2.3.10 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.9 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.8 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.7 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.6 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.5 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.4 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.3 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.2 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3.1 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.3 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.2.3 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.2.2 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.2.1 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.2 lib/dm_cms/liquid/tags/url_protected.rb
dm_cms-4.2.1.5 lib/dm_cms/liquid/tags/url_protected.rb