Module: HackathonManagerHelper

Defined in:
app/helpers/hackathon_manager_helper.rb

Instance Method Summary collapse

Instance Method Details



29
30
31
32
33
34
# File 'app/helpers/hackathon_manager_helper.rb', line 29

def active_link_to(name = nil, options = nil, html_options = nil, &block)
  if current_page?(options)
    html_options[:class] = html_options[:class] + ' ' + html_options[:active_class]
  end
  link_to(name, options, html_options, &block)
end

#asset_available?(logical_path) ⇒ Boolean

Returns:

  • (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


8
9
10
11
# File 'app/helpers/hackathon_manager_helper.rb', line 8

def btn_link_to(name, path, options = {})
  options[:class] ? options[:class] += " button" : options[:class] = "button"
  link_to(name, path, options)
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


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