Sha256: 5f7a4a1c19e539e29b345b2a7d5a6876dea85dbe7a7d285dd5b17f6aad231f77

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

module Bookends
  module ApplicationHelper
    def relative_search_path
      '/search'
    end

    def search_disabled?
      false
    end

    def header_search_input
      tag 'input',
        type: 'text',
        spellcheck: 'false',
        autocomplete: 'off',
        name: 'q',
        title: 'search'
    end

    def logged_in?
      !!cookies[:heroku_session]
    end

    def glostick_user_name
      glostick_user['full_name']
    end

    def glostick_user_email
      glostick_user['email']
    end

    def glostick_user_id
      glostick_user['id']
    end

    def signup_link(title, options = {})
      url = "https://signup.heroku.com"
      data = { trackable: { category: "Sign Up Links", action: "Clicked", label: "#{options[:referral] || options[:branded_signup]}" } }

      url += "/#{options[:branded_signup]}" if options[:branded_signup]

      if options[:campaign_id]
        url = url + "?c=" + options[:campaign_id]
      elsif options[:referral]
        url = url + "/" + options[:referral]
      end

      link_to title, url, class: options[:class], data: data
    end

    def hero_class
      #to be overriden by consumers, optionally
    end

    private

    def glostick_user
      @glostick_user ||= Bookends::GlostickUserExtractor.new(cookies, session_cookie_secret).user
    end

    def session_cookie_secret
      ENV['SESSION_COOKIE_SECRET_PRIMARY'] || ENV['SESSION_COOKIE_SECRET_SECONDARY']
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bookends-8.0.8 app/helpers/bookends/application_helper.rb
bookends-8.0.7 app/helpers/bookends/application_helper.rb
bookends-8.0.6 app/helpers/bookends/application_helper.rb
bookends-8.0.5 app/helpers/bookends/application_helper.rb