module ApplicationHelper

Constants

CONFIG

Public Instance Methods

active_sidenav_item() click to toggle source
# File lib/nexmo_developer/app/helpers/application_helper.rb, line 18
def active_sidenav_item
  if params[:tutorial_name]
    url_for(controller: :tutorial, action: :index, product: params[:product], tutorial_name: params[:tutorial_name])
  else
    request.path.chomp("/#{params[:code_language]}")
  end
end
canonical_base() click to toggle source
# File lib/nexmo_developer/app/helpers/application_helper.rb, line 36
def canonical_base
  return "https://#{ENV['HEROKU_APP_NAME']}.herokuapp.com" if ENV['HEROKU_APP_NAME']

  canonical_base_from_config || request.base_url
end
canonical_base_from_config() click to toggle source
# File lib/nexmo_developer/app/helpers/application_helper.rb, line 65
def canonical_base_from_config
  CONFIG['base_url']
end
canonical_path() click to toggle source
# File lib/nexmo_developer/app/helpers/application_helper.rb, line 26
def canonical_path
  request.path.chomp("/#{params[:code_language]}")
end
canonical_url() click to toggle source
# File lib/nexmo_developer/app/helpers/application_helper.rb, line 30
def canonical_url
  return @canonical_url if @canonical_url

  canonical_path.prepend(canonical_base)
end
search_enabled?() click to toggle source
# File lib/nexmo_developer/app/helpers/application_helper.rb, line 8
def search_enabled?
  defined?(ALGOLIA_CONFIG) && ENV['ALGOLIA_SEARCH_KEY']
end
theme() click to toggle source
# File lib/nexmo_developer/app/helpers/application_helper.rb, line 12
def theme
  return unless ENV['THEME']

  "theme--#{ENV['THEME']}"
end