Sha256: e7d90d6725e9ad340f7d76a33122c59f5cd4a48feb5385061ff43e622539a03f

Contents?: true

Size: 715 Bytes

Versions: 39

Compression:

Stored size: 715 Bytes

Contents

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

  def self.regex_tag_signature(label = nil)
    label ||= /[\w\-]+/
    /\{\{\s*cms:asset:(#{label}):?(.*?)\s*\}\}/
  end

  def content
    return unless (layout = Cms::Layout.find_by_slug(label))
    type    = params[0]
    format  = params[1]
    
    case type
    when 'css'
      out = "/cms-css/#{page.site.id}/#{label}.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}/#{label}.js"
      out = "<script src='#{out}' type='text/javascript'></script>" if format == 'html_tag'
      out
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.5.11 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.10 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.9 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.8 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.7 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.6 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.5 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.4 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.3 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.2 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.1 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.5.0 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.4.22 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.4.21 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.4.20 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.4.19 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.4.18 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.4.17 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.4.16 lib/comfortable_mexican_sofa/tags/asset.rb
comfortable_mexican_sofa-1.4.15 lib/comfortable_mexican_sofa/tags/asset.rb