Module: SportDbAdmin::ApplicationHelper

Defined in:
app/helpers/sport_db_admin/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#fmt_date_with_week(date) ⇒ Object

todo/fix: move to format helper



39
40
41
42
43
44
45
46
# File 'app/helpers/sport_db_admin/application_helper.rb', line 39

def fmt_date_with_week( date )
  if date.nil?
    '-'
  else
    ##  e.g. 2012 (Week 22) // Oct/21 Fri
    date.strftime( "%Y (Week %V) // %b/%d %a" )
  end
end

#game_team1_style_class(game) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'app/helpers/sport_db_admin/application_helper.rb', line 4

def game_team1_style_class( game )
  ## fix: move to game model in game.rb
  buf = ''
  buf << game.team1_style_class
  buf << ' game-knockout ' if game.knockout?
  ### fix: loser - add method for checking winner/loser on ko pairs using (1st leg/2nd leg totals)
  buf << ' game-team-loser '  if game.complete? && (game.score1 < game.score2)
  buf
end

#game_team2_style_class(game) ⇒ Object



14
15
16
17
18
19
20
21
# File 'app/helpers/sport_db_admin/application_helper.rb', line 14

def game_team2_style_class( game )
  ## fix: move to game model in game.rb
  buf = ''
  buf << game.team2_style_class
  buf << ' game-knockout ' if game.knockout?
  buf << ' game-team-loser '  if game.complete? && (game.score1 > game.score2)
  buf
end

#powered_byObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/helpers/sport_db_admin/application_helper.rb', line 23

def powered_by
  ## todo/fix: use version from wettpool module
   :div do
    link_to( 'Questions? Comments?', 'http://groups.google.com/group/opensport' ) + " | " +
    link_to( "world.db/#{WorldDB::VERSION}", 'https://github.com/geraldb/world.db' )  + ', ' +
    link_to( "sport.db/#{SportDB::VERSION}", 'https://github.com/geraldb/sport.db' )  + ', ' +
    link_to( 'sport.db.admin/1', 'https://github.com/geraldb/sport.db.admin' ) + ' - ' + 
    ( :span, "Ruby/#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM}) on") + ' ' +
    ( :span, "Rails/#{Rails.version} (#{Rails.env})" ) + " | " + 
    link_to( 'Icon Drawer Flags', 'http://www.icondrawer.com' )
    ## content_tag( :span, "#{request.headers['SERVER_SOFTWARE'] || request.headers['SERVER']}" )
  end
end