Sha256: 4101d9280888b74205d35f6232ea611c62ff537cb5713fadc75fb52efb358c71
Contents?: true
Size: 686 Bytes
Versions: 12
Compression:
Stored size: 686 Bytes
Contents
class ComfortableMexicanSofa::Tag::File include ComfortableMexicanSofa::Tag def self.regex_tag_signature(identifier = nil) identifier ||= IDENTIFIER_REGEX /\{\{\s*cms:file:(#{identifier}):?(.*?)\s*\}\}/ end # Initializing Comfy::Cms::File object def file blockable.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
12 entries across 12 versions & 1 rubygems