Sha256: 0acc8e774fddd355c9cd8814b4ec26c54ca0d01b461ff8116c7cadb5262db265

Contents?: true

Size: 990 Bytes

Versions: 2

Compression:

Stored size: 990 Bytes

Contents

# encoding: utf-8

module SportDbAdmin
module LinkHelper

  def link_to_country( country )
    link_to( country.title, short_country_path( country ) )
  end

  def link_to_team( team )
    link_to( team.title, short_team_path( team ) )
  end

  def link_to_event( event, opts={} )
    if (opts[:full].present? ||
        opts[:full_title].present? ||
        opts[:fulltitle].present? )
      # show league title + season title (a.k.a full_title)
      #  e.g. Primera DivisiĆ³n 2013/14
      link_to( event.full_title, short_event_path( event ))
    elsif opts[:league].present?
      # show only league (w/o season title)
      #  e.g. Primera DivisiĆ³n
      link_to( event.league.title, short_event_path( event ))
    else # season: true (default)
      # show only season (w/o league title)
      #  e.g. 2013/14 or 2014
      link_to( event.season.title, short_event_path( event ))
    end
  end



end # module LinkHelper
end # module SportDbAdmin

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sportdb-admin-0.3.0 app/helpers/sport_db_admin/link_helper.rb
sportdb-admin-0.2.0 app/helpers/sport_db_admin/link_helper.rb