Module: Bookends::ApplicationHelper

Defined in:
app/helpers/bookends/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#glostick_user_emailObject



28
29
30
# File 'app/helpers/bookends/application_helper.rb', line 28

def glostick_user_email
  glostick_user['email']
end

#glostick_user_idObject



32
33
34
# File 'app/helpers/bookends/application_helper.rb', line 32

def glostick_user_id
  glostick_user['id']
end

#glostick_user_nameObject



24
25
26
# File 'app/helpers/bookends/application_helper.rb', line 24

def glostick_user_name
  glostick_user['full_name']
end

#header_search_inputObject



11
12
13
14
15
16
17
18
# File 'app/helpers/bookends/application_helper.rb', line 11

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

#hero_classObject



53
54
55
# File 'app/helpers/bookends/application_helper.rb', line 53

def hero_class
  #to be overriden by consumers, optionally
end

#logged_in?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/helpers/bookends/application_helper.rb', line 20

def logged_in?
  !!cookies[:heroku_session]
end

#relative_search_pathObject



3
4
5
# File 'app/helpers/bookends/application_helper.rb', line 3

def relative_search_path
  '/search'
end

#search_disabled?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/helpers/bookends/application_helper.rb', line 7

def search_disabled?
  false
end

Available options:

  • class: classes to be set in the class HTML attribute

  • redirect_url: will be inserted as a redirect-url param in the signup URL

  • signup_path: will be appended to the signup URL (e.g: signup_path “ruby” will generate a link to signup.h.c/ruby)



40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/helpers/bookends/application_helper.rb', line 40

def (title, ga_label: nil, **options)
  url = 'https://signup.heroku.com'
  url += "/#{options[:signup_path]}" if options[:signup_path]

  if options[:redirect_url]
    params = { 'redirect-url' => options[:redirect_url] }
    url << "?#{params.to_query}"
  end

  data = { trackable: { category: 'Sign Up Links', action: 'Clicked', label: ga_label } }
  link_to title, url, class: options[:class], data: data
end