Sha256: 3747bbc3ddd4e404f0535422589c00be339240eb5b783d17d1a7e216acf0df91
Contents?: true
Size: 669 Bytes
Versions: 24
Compression:
Stored size: 669 Bytes
Contents
class ComfortableMexicanSofa::Tag::File include ComfortableMexicanSofa::Tag def self.regex_tag_signature(identifier = nil) identifier ||= /[\w\-\.]+/ /\{\{\s*cms:file:(#{identifier}):?(.*?)\s*\}\}/ end # Initializing Cms::File object def file page.site.files.detect{|f| f.file_file_name == self.identifier.to_s} end def content return unless file format = params[0] text = params[1] || identifier case format when 'link' "<a href='#{file.file.url}' target='_blank'>#{text}</a>" when 'image' "<img src='#{file.file.url}' alt='#{text}' />" else file.file.url end end end
Version data entries
24 entries across 24 versions & 1 rubygems