Module: ScavengerHunt::ApplicationHelper

Includes:
CombineOptionsHelper, ComponentHelper, IdRegistryHelper, ResourcesHelper, TitleHelper, ToolbarHelper
Defined in:
lib/scavenger_hunt/app/helpers/scavenger_hunt/application_helper.rb

Instance Method Summary collapse

Methods included from ToolbarHelper

#form_toolbar, #show_toolbar, #submit_toolbar_item, #toolbar, #toolbar_item

Methods included from TitleHelper

#title_for

Methods included from ResourcesHelper

#resource_content_uri, #resource_group_list, #resource_link, #resource_link_target, #resource_status_list, #scope_search_collection

Methods included from IdRegistryHelper

#id_for, #ids

Methods included from CombineOptionsHelper

#combine_options

Methods included from ComponentHelper

#component, #component_items

Instance Method Details

#body_class(*classnames) ⇒ Object



12
13
14
15
# File 'lib/scavenger_hunt/app/helpers/scavenger_hunt/application_helper.rb', line 12

def body_class(*classnames)
  @body_class ||= []
  @body_class.push(*classnames)
end

#representation_content(representation) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/scavenger_hunt/app/helpers/scavenger_hunt/application_helper.rb', line 27

def representation_content(representation)
  case representation.content_type
  when /audio/
    (:audio, controls: true, src: representation.content_uri) {} +
      representation_text(representation)
  when /image/
    image_tag(representation.content_uri) + representation_text(representation)
  when /video/
    (:video, controls: true, src: representation.content_uri) {} +
      representation_text(representation)
  else
    representation_text(representation)
  end
end

#representation_text(representation) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/scavenger_hunt/app/helpers/scavenger_hunt/application_helper.rb', line 17

def representation_text(representation)
  return unless representation.text.present?
  case representation.content_type
  when "text/html"
    representation.text.html_safe
  else
    simple_format representation.text
  end
end