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_newsletter_signup_widget?, #display_popular_posts_widget?, #display_recent_posts_widget?, #display_share_widget?, #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, #twitter_share_url, #twitter_url, #youtube_url

Methods included from SupportHelper

#anchor_to, #display_media_query_indicator?, #method_missing, #render_flashes, #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



50
51
52
# File 'app/helpers/integral/application_helper.rb', line 50

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



39
40
41
42
# File 'app/helpers/integral/application_helper.rb', line 39

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

#render_breadcrumbs?Boolean

Returns:

  • (Boolean)


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

def render_breadcrumbs?
  true
end

#render_content(content) ⇒ String

Returns Processed HTML. Any Integral Widgets placeholders replaced with content.

Parameters:

  • content (String)

    HTML, most likely generated from the WYSIWYG editor

Returns:

  • (String)

    Processed HTML. Any Integral Widgets placeholders replaced with content.



19
20
21
# File 'app/helpers/integral/application_helper.rb', line 19

def render_content(content)
  Integral::ContentRenderer.render(content)
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



30
31
32
33
34
35
36
# File 'app/helpers/integral/application_helper.rb', line 30

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



55
56
57
# File 'app/helpers/integral/application_helper.rb', line 55

def site_title
  Settings.website_title
end