module ApplicationHelper


  def enable_olark
    @olark_enabled = true if Rails.application.config.olark_enabled
  end

  # Returns the full title on a per-page basis.
  def full_title(page_title)
    base_title = "JamKazam"
    if page_title.empty?
      base_title
    else
      "#{base_title} | #{page_title}"
    end
  end

  def meta_description(description)
    if description
      description
    else
      'JamKazam'
    end
  end

  def self.base_uri(request)
    (request.ssl? ? "https://" : "http://") + request.host_with_port
  end

  def self.spa_base_uri(request)
    Rails.application.config.spa_origin_url
  end

  def bugsnag?
    Rails.application.config.bugsnag_notify_release_stages.include? Rails.env
  end

end
