Module: ScavengerHunt::ApplicationHelper
Instance Method Summary
collapse
#form_toolbar, #show_toolbar, #submit_toolbar_item, #toolbar, #toolbar_item
#title_for
#resource_content_uri, #resource_group_list, #resource_link, #resource_link_target, #resource_status_list, #scope_search_collection
#id_for, #ids
#combine_options
#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/
content_tag(:audio, controls: true, src: representation.content_uri) {} +
representation_text(representation)
when /image/
image_tag(representation.content_uri) + representation_text(representation)
when /video/
content_tag(: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
|