Module: HackathonManagerHelper
- Defined in:
- app/helpers/hackathon_manager_helper.rb
Instance Method Summary collapse
- #active_link_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
- #asset_available?(logical_path) ⇒ Boolean
- #btn_link_to(name, path, options = {}) ⇒ Object
- #markdown(text) ⇒ Object
- #phone_link_to(phone_number) ⇒ Object
- #title(page_title) ⇒ Object
Instance Method Details
#active_link_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
29 30 31 32 33 34 |
# File 'app/helpers/hackathon_manager_helper.rb', line 29 def active_link_to(name = nil, = nil, = nil, &block) if current_page?() [:class] = [:class] + ' ' + [:active_class] end link_to(name, , , &block) end |
#asset_available?(logical_path) ⇒ Boolean
37 38 39 40 41 42 43 |
# File 'app/helpers/hackathon_manager_helper.rb', line 37 def asset_available?(logical_path) if Rails.configuration.assets.compile Rails.application.precompiled_assets.include? logical_path else Rails.application.assets_manifest.assets[logical_path].present? end end |
#btn_link_to(name, path, options = {}) ⇒ Object
8 9 10 11 |
# File 'app/helpers/hackathon_manager_helper.rb', line 8 def btn_link_to(name, path, = {}) [:class] ? [:class] += " button" : [:class] = "button" link_to(name, path, ) end |
#markdown(text) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/hackathon_manager_helper.rb', line 17 def markdown(text) markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, no_intra_emphasis: true, fenced_code_blocks: true, disable_indented_code_blocks: true, autolink: true, tables: true, underline: true, hard_wrap: true) markdown.render(text).html_safe end |
#phone_link_to(phone_number) ⇒ Object
13 14 15 |
# File 'app/helpers/hackathon_manager_helper.rb', line 13 def phone_link_to(phone_number) link_to(phone_number, "tel:#{phone_number}") end |
#title(page_title) ⇒ Object
2 3 4 5 6 |
# File 'app/helpers/hackathon_manager_helper.rb', line 2 def title(page_title) content_for(:page_title) { page_title } content_for(:title) { page_title + " - #{Rails.configuration.hackathon['name']}" } page_title end |