Module: Integral::ApplicationHelper

Includes:
BlogHelper, GalleryHelper, SocialHelper, SupportHelper
Defined in:
app/helpers/integral/application_helper.rb

Overview

Base Frontend Helper

Instance Method Summary collapse

Methods included from GalleryHelper

#render_gallery, #render_thumb_gallery

Methods included from BlogHelper

#display_most_read_posts_widget?, #display_newsletter_signup_widget?, #display_popular_posts_widget?, #display_post_categories_widget?, #display_recent_posts_widget?, #display_share_widget?, #display_similar_posts_widget?, #featured_categories, #most_read_posts, #render_post_as_json_ld, #render_posts_as_json_ld

Methods included from SocialHelper

#facebook_share_url, #facebook_url, #github_url, #instagram_url, #linkedin_share_url, #linkedin_url, #mail_share_url, #twitter_share_url, #twitter_url, #youtube_url

Methods included from SupportHelper

#anchor_to, #display_media_query_indicator?, #icon, #method_missing, #respond_to?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Integral::SupportHelper

Instance Method Details

#google_tag_manager(type = :script) ⇒ String

Frontend Google Tag Manager Snippet

Returns:

  • (String)

    GTM Container if ID has been supplied



53
54
55
# File 'app/helpers/integral/application_helper.rb', line 53

def google_tag_manager(type = :script)
  GoogleTagManager.render(Settings.google_tag_manager_id, type)
end

Returns main menu list as defined in settings area.

Returns:

  • (Integal::List)

    main menu list as defined in settings area



42
43
44
45
# File 'app/helpers/integral/application_helper.rb', line 42

def main_menu_list
  id = Integral::Settings.send('main_menu_list_id')
  @main_menu_list ||= Integral::List.find_by_id(id)
end

#render_block_list(block_list) ⇒ Object



16
17
18
19
20
# File 'app/helpers/integral/application_helper.rb', line 16

def render_block_list(block_list)
  Rails.cache.fetch block_list do
    ::BlockEditor::BlockListRenderer.render(block_list.content)
  end
end

#render_blocks(content) ⇒ Object



22
23
24
# File 'app/helpers/integral/application_helper.rb', line 22

def render_blocks(content)
  ::BlockEditor::BlockListRenderer.render(content)
end

#render_breadcrumbs?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'app/helpers/integral/application_helper.rb', line 47

def render_breadcrumbs?
  true
end

#render_json_ldString

Returns Javascript snippet containing LD-JSON.

Returns:

  • (String)

    Javascript snippet containing LD-JSON



10
11
12
13
14
# File 'app/helpers/integral/application_helper.rb', line 10

def render_json_ld
   'script', type: 'application/ld+json' do
    yield.to_json.html_safe
  end
end

#render_list(list, opts = {}) ⇒ String

Returns HTML generated by rendering list.

Parameters:

  • list (Integral::List)

    the list to render

  • opts (Hash) (defaults to: {})

    the options to render list

Options Hash (opts):

  • :html_classes (String)

    the html classes for the list

  • :data_attributes (String)

    the html data attributes for the list

  • :item_renderer_opts (Hash)

    the hash of options for list items

Returns:

  • (String)

    HTML generated by rendering list



33
34
35
36
37
38
39
# File 'app/helpers/integral/application_helper.rb', line 33

def render_list(list, opts = {})
  opts.reverse_merge!(
    renderer: Integral::ListRenderer
  )

  opts[:renderer].render(list, opts).html_safe
end

#site_titleString

Returns Configurable Website title.

Returns:

  • (String)

    Configurable Website title



58
59
60
# File 'app/helpers/integral/application_helper.rb', line 58

def site_title
  Settings.website_title
end