Class: Johnhenry::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/johnhenry/application_controller.rb

Direct Known Subclasses

HomeController, PaymentsController

Constant Summary collapse

DEFAULT_TITLE =
'Example Title'
DEFAULT_DESCRIPTION =
'This is the example description and should be overridden.'

Instance Method Summary collapse

Instance Method Details

#admin_idsObject



36
37
38
# File 'app/controllers/johnhenry/application_controller.rb', line 36

def admin_ids
  [1]
end

#set_meta_tag_defaultsObject



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
# File 'app/controllers/johnhenry/application_controller.rb', line 9

def set_meta_tag_defaults
  {
    title: DEFAULT_TITLE,
    description: DEFAULT_DESCRIPTION,
    language: 'english',
    viewport: 'width=device-width, initial-scale=1, maximum-scale=1',
    robots: 'index, follow',
    og: {
      title: DEFAULT_TITLE,
      description: DEFAULT_DESCRIPTION,
      image: 'http://placekitten.com/400/400',
      type: 'website' }
  }.tap do |meta_tags|
    # Set as ENV variables FB_ADMINS and FB_APP_ID
    %w(fb:admins fb:app_id).each do |fb_key|
      env_key = fb_key.upcase.sub(':', '_')
      if ENV[env_key].present?
        meta_tags[fb_key] = ENV[env_key]
      end
    end

    if defined?(set_meta)
      set_meta meta_tags
    end
  end
end