Class: CMS::ViewTags
- Inherits:
-
Object
- Object
- CMS::ViewTags
- Includes:
- ActionView::Helpers::AssetTagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::UrlHelper, ApplicationHelper, Helper, Singleton
- Defined in:
- lib/cms/view_tags.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#controller ⇒ Object
Returns the value of attribute controller.
Instance Method Summary collapse
Methods included from Helper
#cms_content_parse, #cms_file, #cms_image, #cms_page_area, #cms_page_area_edit_link, #markdown, #render_cms_page_area_content
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
2 3 4 |
# File 'lib/cms/view_tags.rb', line 2 def context @context end |
#controller ⇒ Object
Returns the value of attribute controller.
2 3 4 |
# File 'lib/cms/view_tags.rb', line 2 def controller @controller end |
Instance Method Details
#parse(content, opts = {}) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/cms/view_tags.rb', line 18 def parse content, opts = {} setup(opts) # content.gsub(/\xA0/u, ' ') content.gsub(/\{\{image [^}}]+\}\}/) do |tag| str, name, size = tag.match(/\{\{image (\w+) (\w+)\}\}/).to_a cms_image(name, size) end.html_safe end |
#setup(opts) ⇒ Object
14 15 16 |
# File 'lib/cms/view_tags.rb', line 14 def setup opts @context = @controller = opts[:context] end |