Class: CmsTag::Partial
- Inherits:
-
Object
show all
- Includes:
- CmsTag
- Defined in:
- lib/comfortable_mexican_sofa/cms_tag/partial.rb
Constant Summary
Constants included
from CmsTag
TOKENIZER_REGEX
Instance Attribute Summary collapse
Attributes included from CmsTag
#params, #parent, #record_id
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
3
4
5
|
# File 'lib/comfortable_mexican_sofa/cms_tag/partial.rb', line 3
def label
@label
end
|
Class Method Details
.regex_tag_signature(label = nil) ⇒ Object
7
8
9
10
|
# File 'lib/comfortable_mexican_sofa/cms_tag/partial.rb', line 7
def self.regex_tag_signature(label = nil)
label ||= /[\w\/\-]+/
/\{\{\s*cms:partial:(#{label}):?(.*?)\s*\}\}/
end
|
Instance Method Details
#content ⇒ Object
16
17
18
19
|
# File 'lib/comfortable_mexican_sofa/cms_tag/partial.rb', line 16
def content
ps = params.split(':').collect_with_index{|p, i| ":param_#{i+1} => '#{p}'"}.join(', ')
"<%= render :partial => '#{label}'#{ps.blank?? nil : ", :locals => {#{ps}}"} %>"
end
|
#regex_tag_signature ⇒ Object
12
13
14
|
# File 'lib/comfortable_mexican_sofa/cms_tag/partial.rb', line 12
def regex_tag_signature
self.class.regex_tag_signature(label)
end
|