Module: Excalibur::ViewHelpers

Defined in:
lib/excalibur/view_helpers.rb

Overview

the ViewHelpers module contains the methods to access Excalibur from the view. Most commonly placed in the view templates and the application Layout

Instance Method Summary collapse

Instance Method Details

#entitle(object, options = {}) ⇒ Object



5
6
7
# File 'lib/excalibur/view_helpers.rb', line 5

def entitle(object, options = {})
  @excalibur_subject = excalibur_decorate_subject(object, options)
end

#quick_set(type, *args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/excalibur/view_helpers.rb', line 9

def quick_set(type, *args)
  case type
  when :title, :description
    section = args.shift
    excalibur_subject.configuration.send(type).send(
        "update_#{section}",
        *args
    )
  when :meta_tag
    excalibur_subject.configuration.set_meta_tag(*args)
  end
end

#render_meta_tagsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/excalibur/view_helpers.rb', line 26

def render_meta_tags
  result = ''

  excalibur_subject.configuration.meta_tags.each do |type_name, value|
    value.each do |type_value, contents|
      next if contents.nil?
      contents = render_meta_content(contents)
      contents = [contents] unless contents.is_a?(Array)

      contents.each do |content|
        result << tag(
            :meta,
            type_name => type_value,
            content: content
        ) unless content.nil?
      end
    end
  end

  result.html_safe
end

#render_title_tagObject



22
23
24
# File 'lib/excalibur/view_helpers.rb', line 22

def render_title_tag
   :title, excalibur_subject.render_title
end