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
- #entitle(object, options = {}) ⇒ Object
- #quick_set(type, *args) ⇒ Object
- #render_meta_tags ⇒ Object
- #render_title_tag ⇒ Object
Instance Method Details
#entitle(object, options = {}) ⇒ Object
5 6 7 |
# File 'lib/excalibur/view_helpers.rb', line 5 def entitle(object, = {}) @excalibur_subject = excalibur_decorate_subject(object, ) 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.(*args) end end |
#render_meta_tags ⇒ Object
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 result = '' excalibur_subject.configuration..each do |type_name, value| value.each do |type_value, contents| next if contents.nil? contents = (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_tag ⇒ Object
22 23 24 |
# File 'lib/excalibur/view_helpers.rb', line 22 def render_title_tag content_tag :title, excalibur_subject.render_title end |