Sha256: 2408525450ca0163d8ab4d6d0189fdab03447428fad21d9e079071eb1a7d39bd

Contents?: true

Size: 1.55 KB

Versions: 18

Compression:

Stored size: 1.55 KB

Contents

module HackathonManagerHelper
  def title(page_title)
    content_for(:page_title) { page_title }
    content_for(:title) { page_title + " - #{Rails.configuration.hackathon['name']}" }
    page_title
  end

  def btn_link_to(name, path, options = {})
    options[:class] ? options[:class] += " button" : options[:class] = "button"
    link_to(name, path, options)
  end

  def phone_link_to(phone_number)
    link_to(phone_number, "tel:#{phone_number}")
  end

  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

  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

  # https://github.com/rails/sprockets-rails/issues/298#issuecomment-168927471
  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
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hackathon_manager-0.6.5 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.6.4 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.6.3 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.6.2 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.6.1 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.6.0 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.11 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.10 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.9 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.8 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.7 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.6 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.5 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.4 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.3 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.2 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.1 app/helpers/hackathon_manager_helper.rb
hackathon_manager-0.5.0 app/helpers/hackathon_manager_helper.rb