Class: ComfortableMexicanSofa::Tag::Asset
- Inherits:
-
Object
- Object
- ComfortableMexicanSofa::Tag::Asset
- Includes:
- ComfortableMexicanSofa::Tag
- Defined in:
- lib/comfortable_mexican_sofa/tags/asset.rb
Constant Summary
Constants included from ComfortableMexicanSofa::Tag
IDENTIFIER_REGEX, TOKENIZER_REGEX
Instance Attribute Summary
Attributes included from ComfortableMexicanSofa::Tag
#blockable, #identifier, #namespace, #params, #parent
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.regex_tag_signature(identifier = nil) ⇒ Object
4 5 6 7 |
# File 'lib/comfortable_mexican_sofa/tags/asset.rb', line 4 def self.regex_tag_signature(identifier = nil) identifier ||= IDENTIFIER_REGEX /\{\{\s*cms:asset:(#{identifier}):?(.*?)\s*\}\}/ end |
Instance Method Details
#content ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/comfortable_mexican_sofa/tags/asset.rb', line 9 def content return unless (layout = Comfy::Cms::Layout.find_by_identifier(identifier)) type = params[0] format = params[1] case type when 'css' out = "/cms-css/#{blockable.site.id}/#{identifier}/#{layout.cache_buster}.css" out = "<link href='#{out}' media='screen' rel='stylesheet' type='text/css' />" if format == 'html_tag' out when 'js' out = "/cms-js/#{blockable.site.id}/#{identifier}/#{layout.cache_buster}.js" out = "<script src='#{out}' type='text/javascript'></script>" if format == 'html_tag' out end end |