Sha256: b69076c9196f637d16daed93c5ef5e4a8e2ad6dcda31585a0f2d0e942f19009a

Contents?: true

Size: 758 Bytes

Versions: 25

Compression:

Stored size: 758 Bytes

Contents

class ComfortableMexicanSofa::Tag::Asset
  include ComfortableMexicanSofa::Tag

  def self.regex_tag_signature(identifier = nil)
    identifier ||= IDENTIFIER_REGEX
    /\{\{\s*cms:asset:(#{identifier}):?(.*?)\s*\}\}/
  end

  def content
    return unless (layout = Cms::Layout.find_by_identifier(identifier))
    type    = params[0]
    format  = params[1]
    
    case type
    when 'css'
      out = "/cms-css/#{page.site.id}/#{identifier}.css"
      out = "<link href='#{out}' media='screen' rel='stylesheet' type='text/css' />" if format == 'html_tag'
      out
    when 'js'
      out = "/cms-js/#{page.site.id}/#{identifier}.js"
      out = "<script src='#{out}' type='text/javascript'></script>" if format == 'html_tag'
      out
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.6.31 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.11.2 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.11.1 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.11.0 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.10.3 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.10.2 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.10.1 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.10.0 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.9.3 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.9.2 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.8.5 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.9.1 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.9.0 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.8.4 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.8.3 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.8.2 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.8.1 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.8.0 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.6.30 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.7.3 lib/comfortable_mexican_sofa/tags/asset.rb