Module: Bookends::ApplicationHelper
- Defined in:
- app/helpers/bookends/application_helper.rb
Instance Method Summary collapse
- #glostick_user_email ⇒ Object
- #glostick_user_id ⇒ Object
- #glostick_user_name ⇒ Object
- #header_search_input ⇒ Object
- #hero_class ⇒ Object
- #logged_in? ⇒ Boolean
- #relative_search_path ⇒ Object
- #search_disabled? ⇒ Boolean
-
#signup_link(title, ga_label: nil, **options) ⇒ Object
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).
Instance Method Details
#glostick_user_email ⇒ Object
28 29 30 |
# File 'app/helpers/bookends/application_helper.rb', line 28 def glostick_user_email glostick_user['email'] end |
#glostick_user_id ⇒ Object
32 33 34 |
# File 'app/helpers/bookends/application_helper.rb', line 32 def glostick_user_id glostick_user['id'] end |
#glostick_user_name ⇒ Object
24 25 26 |
# File 'app/helpers/bookends/application_helper.rb', line 24 def glostick_user_name glostick_user['full_name'] end |
#header_search_input ⇒ Object
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_class ⇒ Object
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
20 21 22 |
# File 'app/helpers/bookends/application_helper.rb', line 20 def logged_in? !![:heroku_session] end |
#relative_search_path ⇒ Object
3 4 5 |
# File 'app/helpers/bookends/application_helper.rb', line 3 def relative_search_path '/search' end |
#search_disabled? ⇒ Boolean
7 8 9 |
# File 'app/helpers/bookends/application_helper.rb', line 7 def search_disabled? false end |
#signup_link(title, ga_label: nil, **options) ⇒ Object
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 signup_link(title, ga_label: nil, **) url = 'https://signup.heroku.com' url += "/#{options[:signup_path]}" if [:signup_path] if [:redirect_url] params = { 'redirect-url' => [:redirect_url] } url << "?#{params.to_query}" end data = { trackable: { category: 'Sign Up Links', action: 'Clicked', label: ga_label } } link_to title, url, class: [:class], data: data end |