/
application_helper.rb
62 lines (53 loc) · 1.8 KB
/
application_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module Integral
# Base Frontend Helper
module ApplicationHelper
include Integral::SupportHelper
include Integral::SocialHelper
include Integral::BlogHelper
include Integral::GalleryHelper
# @return [String] Javascript snippet containing LD-JSON
def render_json_ld
content_tag 'script', type: 'application/ld+json' do
yield.to_json.html_safe
end
end
def render_block_list(block_list)
Rails.cache.fetch block_list do
::BlockEditor::BlockListRenderer.render(block_list.content)
end
end
def render_blocks(content)
::BlockEditor::BlockListRenderer.render(content)
end
# @param [Integral::List] list the list to render
# @param [Hash] opts the options to render list
# @option opts [String] :html_classes the html classes for the list
# @option opts [String] :data_attributes the html data attributes for the list
# @option opts [Hash] :item_renderer_opts the hash of options for list items
#
# @return [String] HTML generated by rendering list
def render_list(list, opts = {})
opts.reverse_merge!(
renderer: Integral::ListRenderer
)
opts[:renderer].render(list, opts).html_safe
end
# @return [Integal::List] main menu list as defined in settings area
def main_menu_list
id = Integral::Settings.send('main_menu_list_id')
@main_menu_list ||= Integral::List.find_by_id(id)
end
def render_breadcrumbs?
true
end
# Frontend Google Tag Manager Snippet
# @return [String] GTM Container if ID has been supplied
def google_tag_manager(type = :script)
GoogleTagManager.render(Settings.google_tag_manager_id, type)
end
# @return [String] Configurable Website title
def site_title
Settings.website_title
end
end
end