Class: ComfortableMexicanSofa::Tag::Partial

Inherits:
Object
  • Object
show all
Includes:
ComfortableMexicanSofa::Tag
Defined in:
lib/comfortable_mexican_sofa/tags/partial.rb

Constant Summary

Constants included from ComfortableMexicanSofa::Tag

TOKENIZER_REGEX

Instance Attribute Summary

Attributes included from ComfortableMexicanSofa::Tag

#label, #page, #params, #parent

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.regex_tag_signature(label = nil) ⇒ Object



4
5
6
7
# File 'lib/comfortable_mexican_sofa/tags/partial.rb', line 4

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

Instance Method Details

#contentObject



9
10
11
12
# File 'lib/comfortable_mexican_sofa/tags/partial.rb', line 9

def content
  ps = params.split(':').collect_with_index{|p, i| ":param_#{i+1} => '#{p}'"}.join(', ')
  "<%= render :partial => '#{label}'#{ps.blank?? nil : ", :locals => {#{ps}}"} %>"
end