sportdb-admin 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +5 -0
  3. data/app/helpers/sport_db_admin/api_helper.rb +24 -0
  4. data/app/helpers/sport_db_admin/application_helper.rb +4 -34
  5. data/app/helpers/sport_db_admin/format_helper.rb +17 -0
  6. data/app/helpers/sport_db_admin/image_helper.rb +21 -0
  7. data/app/helpers/sport_db_admin/link_helper.rb +35 -0
  8. data/app/helpers/sport_db_admin/part_helper.rb +8 -8
  9. data/app/helpers/sport_db_admin/routes_helper.rb +1 -1
  10. data/app/views/layouts/sport_db_admin/sport_db_admin.html.erb +10 -6
  11. data/app/views/sport_db_admin/countries/index.html.erb +2 -2
  12. data/app/views/sport_db_admin/countries/show.html.erb +5 -3
  13. data/app/views/sport_db_admin/events/index.html.erb +3 -3
  14. data/app/views/sport_db_admin/events/show.html.erb +6 -18
  15. data/app/views/sport_db_admin/games/index.html.erb +3 -3
  16. data/app/views/sport_db_admin/pages/about.html.erb +4 -4
  17. data/app/views/sport_db_admin/regions/index.html.erb +2 -2
  18. data/app/views/sport_db_admin/rounds/index.html.erb +1 -1
  19. data/app/views/sport_db_admin/shared/_td_game_round.html.erb +1 -1
  20. data/app/views/sport_db_admin/shared/_td_game_team1.html.erb +4 -8
  21. data/app/views/sport_db_admin/shared/_td_game_team2.html.erb +4 -6
  22. data/app/views/sport_db_admin/shared/_team_world_tree.html.erb +4 -4
  23. data/app/views/sport_db_admin/teams/_teams.html.erb +26 -0
  24. data/app/views/sport_db_admin/teams/index.html.erb +2 -3
  25. data/app/views/sport_db_admin/teams/index_clubs.html.erb +1 -23
  26. data/app/views/sport_db_admin/teams/index_national_teams.html.erb +1 -27
  27. data/app/views/sport_db_admin/teams/show.html.erb +2 -5
  28. data/config/routes.rb +12 -11
  29. data/lib/sportdb/admin/version.rb +1 -1
  30. metadata +7 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b66d7b2733c697b323947a2de008d14efa899d98
4
- data.tar.gz: 6536dd17977c3285c733d9af24bf09ea673e3b63
3
+ metadata.gz: 107d4c3b52b32eeafa4c5eb8b6ae0a87b569d695
4
+ data.tar.gz: 58808e627b6b960fefb59d177b292f651f6bc9ef
5
5
  SHA512:
6
- metadata.gz: 971b1ccc04db6c7207aa249fd8b323043b44bbf1acb85305bb93e894fc9a412cd9137e90404429af288a545d32dcb689af261199a420cd3561f35020c3b5bce6
7
- data.tar.gz: a00f111c96acba4b34a9e77e98af6dab19cef72a3322f6e4ab2be721fb59bf69ce78caf53e20f6395f17583a0543057ed2c7d9821817595023726dcd4e3c490f
6
+ metadata.gz: ca4277156b7ae5114acd97c1a38d868a7eb9bb4e2f04ca9a530faaea1d741f9f2981ba3afd84da3cdd5556cd7a960e94ce821d8334e51c260a77daa48b5ae733
7
+ data.tar.gz: b67a1cffa010f98a757f0c7bf9a2d5c03deabc90b3c59d2b5224a17def7588373453ea88c6713c9399efb5510bf59877984383c975534a16fb4f7b1ef0c2511b
@@ -12,7 +12,11 @@ app/controllers/sport_db_admin/regions_controller.rb
12
12
  app/controllers/sport_db_admin/rounds_controller.rb
13
13
  app/controllers/sport_db_admin/sport_db_admin_controller.rb
14
14
  app/controllers/sport_db_admin/teams_controller.rb
15
+ app/helpers/sport_db_admin/api_helper.rb
15
16
  app/helpers/sport_db_admin/application_helper.rb
17
+ app/helpers/sport_db_admin/format_helper.rb
18
+ app/helpers/sport_db_admin/image_helper.rb
19
+ app/helpers/sport_db_admin/link_helper.rb
16
20
  app/helpers/sport_db_admin/part_helper.rb
17
21
  app/helpers/sport_db_admin/routes_helper.rb
18
22
  app/views/layouts/sport_db_admin/sport_db_admin.html.erb
@@ -34,6 +38,7 @@ app/views/sport_db_admin/shared/_td_game_score.html.erb
34
38
  app/views/sport_db_admin/shared/_td_game_team1.html.erb
35
39
  app/views/sport_db_admin/shared/_td_game_team2.html.erb
36
40
  app/views/sport_db_admin/shared/_team_world_tree.html.erb
41
+ app/views/sport_db_admin/teams/_teams.html.erb
37
42
  app/views/sport_db_admin/teams/index.html.erb
38
43
  app/views/sport_db_admin/teams/index_clubs.html.erb
39
44
  app/views/sport_db_admin/teams/index_national_teams.html.erb
@@ -0,0 +1,24 @@
1
+ module SportDbAdmin
2
+ module ApiHelper
3
+
4
+ def sportdb_api_defined?
5
+ defined?( SportDb::Service::Server ) == 'constant'
6
+ end
7
+
8
+ def sportdb_api?
9
+ # shorter alias (remove long version??? why? why not?)
10
+ sportdb_api_defined?
11
+ end
12
+
13
+
14
+ ##############################
15
+ # routes for api
16
+
17
+ def api_path
18
+ '/api/v1'
19
+ end
20
+
21
+
22
+ end # module ApiHelper
23
+ end # module SportDbAdmin
24
+
@@ -1,32 +1,14 @@
1
1
  module SportDbAdmin
2
2
  module ApplicationHelper
3
3
 
4
- def game_team1_style_class( game )
5
- ## fix: move to game model in game.rb
6
- buf = ''
7
- buf << game.team1_style_class
8
- buf << ' game-knockout ' if game.knockout?
9
- ### fix: loser - add method for checking winner/loser on ko pairs using (1st leg/2nd leg totals)
10
- buf << ' game-team-loser ' if game.complete? && (game.score1 < game.score2)
11
- buf
12
- end
13
-
14
- def game_team2_style_class( game )
15
- ## fix: move to game model in game.rb
16
- buf = ''
17
- buf << game.team2_style_class
18
- buf << ' game-knockout ' if game.knockout?
19
- buf << ' game-team-loser ' if game.complete? && (game.score1 > game.score2)
20
- buf
21
- end
22
4
 
23
5
  def powered_by
24
6
  ## todo/fix: use version from wettpool module
25
7
  content_tag :div do
26
8
  link_to( 'Questions? Comments?', 'http://groups.google.com/group/opensport' ) + " | " +
27
- link_to( "world.db/#{WorldDB::VERSION}", 'https://github.com/geraldb/world.db' ) + ', ' +
28
- link_to( "sport.db/#{SportDB::VERSION}", 'https://github.com/geraldb/sport.db' ) + ', ' +
29
- link_to( 'sport.db.admin/1', 'https://github.com/geraldb/sport.db.admin' ) + ' - ' +
9
+ link_to( "world.db/#{WorldDb::VERSION}", 'https://github.com/geraldb/world.db' ) + ', ' +
10
+ link_to( "sport.db/#{SportDb::VERSION}", 'https://github.com/geraldb/sport.db' ) + ', ' +
11
+ link_to( "sport.db.admin/#{SportDbAdmin::VERSION}", 'https://github.com/geraldb/sport.db.admin' ) + ' - ' +
30
12
  content_tag( :span, "Ruby/#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM}) on") + ' ' +
31
13
  content_tag( :span, "Rails/#{Rails.version} (#{Rails.env})" ) + " | " +
32
14
  link_to( 'Icon Drawer Flags', 'http://www.icondrawer.com' )
@@ -34,17 +16,5 @@ module ApplicationHelper
34
16
  end
35
17
  end
36
18
 
37
- ### todo/fix: move to format helper
38
-
39
- def fmt_date_with_week( date )
40
- if date.nil?
41
- '-'
42
- else
43
- ## e.g. 2012 (Week 22) // Oct/21 Fri
44
- date.strftime( "%Y (Week %V) // %b/%d %a" )
45
- end
46
- end
47
-
48
-
49
19
  end # module ApplicationHelper
50
- end # module SportDbAdmin
20
+ end # module SportDbAdmin
@@ -0,0 +1,17 @@
1
+ module SportDbAdmin
2
+ module FormatHelper
3
+
4
+
5
+ def fmt_date_with_week( date )
6
+ if date.nil?
7
+ '-'
8
+ else
9
+ ## e.g. 2012 (Week 22) // Oct/21 Fri
10
+ date.strftime( "%Y (Week %V) // %b/%d %a" )
11
+ end
12
+ end
13
+
14
+
15
+
16
+ end # module FormatHelper
17
+ end # module SportDbAdmin
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDbAdmin
4
+ module ImageHelper
5
+
6
+ def logo_for_team( team )
7
+ # 1) check if logo exists
8
+ if Rails.application.assets.find_asset( "logos/24x24/#{team.key}.png" ).present?
9
+ image_tag( "logos/24x24/#{team.key}.png" )
10
+ else
11
+ '' # return empty string (e.g. nothing)
12
+ end
13
+ end
14
+
15
+ def flag_for_country( country )
16
+ image_tag( "flags/24x24/#{country.key}.png" )
17
+ end
18
+
19
+
20
+ end # module ImageHelper
21
+ end # module SportDbAdmin
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDbAdmin
4
+ module LinkHelper
5
+
6
+ def link_to_country( country )
7
+ link_to( country.title, short_country_path( country ) )
8
+ end
9
+
10
+ def link_to_team( team )
11
+ link_to( team.title, short_team_path( team ) )
12
+ end
13
+
14
+ def link_to_event( event, opts={} )
15
+ if (opts[:full].present? ||
16
+ opts[:full_title].present? ||
17
+ opts[:fulltitle].present? )
18
+ # show league title + season title (a.k.a full_title)
19
+ # e.g. Primera División 2013/14
20
+ link_to( event.full_title, short_event_path( event ))
21
+ elsif opts[:league].present?
22
+ # show only league (w/o season title)
23
+ # e.g. Primera División
24
+ link_to( event.league.title, short_event_path( event ))
25
+ else # season: true (default)
26
+ # show only season (w/o league title)
27
+ # e.g. 2013/14 or 2014
28
+ link_to( event.season.title, short_event_path( event ))
29
+ end
30
+ end
31
+
32
+
33
+
34
+ end # module LinkHelper
35
+ end # module SportDbAdmin
@@ -10,36 +10,36 @@ module PartHelper
10
10
 
11
11
 
12
12
  def render_game_date( game, opts={} )
13
- render :partial => 'sport_db_admin/shared/td_game_date', :locals => { :game => game }
13
+ render partial: 'sport_db_admin/shared/td_game_date', locals: { game: game }
14
14
  end
15
15
 
16
16
  def render_game_score( game, opts={} )
17
- render :partial => 'sport_db_admin/shared/td_game_score', :locals => { :game => game }
17
+ render partial: 'sport_db_admin/shared/td_game_score', locals: { game: game }
18
18
  end
19
19
 
20
20
  def render_game_team1( game, opts={} )
21
- render :partial => 'sport_db_admin/shared/td_game_team1', :locals => { :game => game }
21
+ render partial: 'sport_db_admin/shared/td_game_team1', locals: { game: game }
22
22
  end
23
23
 
24
24
  def render_game_team2( game, opts={} )
25
- render :partial => 'sport_db_admin/shared/td_game_team2', :locals => { :game => game }
25
+ render partial: 'sport_db_admin/shared/td_game_team2', locals: { game: game }
26
26
  end
27
27
 
28
28
  def render_game_flags( game, opts={} )
29
- render :partial => 'sport_db_admin/shared/td_game_flags', :locals => { :game => game }
29
+ render partial: 'sport_db_admin/shared/td_game_flags', locals: { game: game }
30
30
  end
31
31
 
32
32
  def render_game_debug( game, opts={} )
33
- render :partial => 'sport_db_admin/shared/td_game_debug', :locals => { :game => game }
33
+ render partial: 'sport_db_admin/shared/td_game_debug', locals: { game: game }
34
34
  end
35
35
 
36
36
  def render_game_round( game, opts={} )
37
- render :partial => 'sport_db_admin/shared/td_game_round', :locals => { :game => game }
37
+ render partial: 'sport_db_admin/shared/td_game_round', locals: { game: game }
38
38
  end
39
39
 
40
40
 
41
41
  def render_team_world_tree( team, opts={} )
42
- render :partial => 'sport_db_admin/shared/team_world_tree', :locals => { :team => team }
42
+ render partial: 'sport_db_admin/shared/team_world_tree', locals: { team: team }
43
43
  end
44
44
 
45
45
 
@@ -4,7 +4,7 @@ module SportDbAdmin
4
4
  module RoutesHelper
5
5
 
6
6
  ##############################
7
- ## routes for shortcuts
7
+ # routes for shortcuts
8
8
 
9
9
  def short_country_path( country )
10
10
  short_country_worker_path( country.key )
@@ -2,8 +2,8 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>sport.db Web Admin</title>
5
- <%= stylesheet_link_tag "sport_db_admin/application", :media => "all" %>
6
- <%= javascript_include_tag "sport_db_admin/application" %>
5
+ <%= stylesheet_link_tag 'sport_db_admin/application', :media => 'all' %>
6
+ <%= javascript_include_tag 'sport_db_admin/application' %>
7
7
  <%= csrf_meta_tags %>
8
8
  </head>
9
9
  <body>
@@ -17,11 +17,15 @@
17
17
  <%= link_to 'Rounds', rounds_path() %> &bull;
18
18
  <%= link_to 'Past Games', past_games_path() %> &bull;
19
19
  <%= link_to 'Upcoming Games', games_path() %> &bull;
20
- <%= link_to 'About', about_path() %> .::.
21
-
22
- <!-- fix: use named url_helper for /api -->
23
- <%= link_to "Web Service / HTTP JSON API", '/api' %>
20
+ <%= link_to 'About', about_path() %>
24
21
  <!-- todo: add some more links -->
22
+
23
+ <% if sportdb_api_defined? %>
24
+ .::.
25
+
26
+ <!-- fix/check: does it work for nested routes /e.g. db/api/v1 or /api/v1 ?? -->
27
+ <%= link_to 'Web Service / HTTP JSON API', api_path() %>
28
+ <% end %>
25
29
  </p>
26
30
 
27
31
  <div class='content'>
@@ -27,8 +27,8 @@
27
27
  <%= country.key %>
28
28
  </td>
29
29
  <td style='white-space: nowrap;'>
30
- <%= image_tag "flags/24x24/#{country.key}.png" %>
31
- <%= link_to country.title, short_country_path( country ) %>
30
+ <%= flag_for_country( country ) %>
31
+ <%= link_to_country( country ) %>
32
32
  </td>
33
33
  <td>
34
34
  (<%= country.code %>)
@@ -1,6 +1,6 @@
1
1
 
2
2
  <h3>
3
- <%= image_tag "flags/24x24/#{@country.key}.png" %>
3
+ <%= flag_for_country( @country ) %>
4
4
  <%= @country.title %>
5
5
  (<%= @country.code %>)
6
6
  </h3>
@@ -37,7 +37,8 @@
37
37
  <tr>
38
38
  <td class='team-key'><%= team.key %></td>
39
39
  <td>
40
- <%= link_to team.title, short_team_path( team ) %>
40
+ <%= logo_for_team( team ) %>
41
+ <%= link_to_team( team ) %>
41
42
  <%= " | #{team.synonyms.split('|').join(' | ')}" if team.synonyms.present? %>
42
43
  </td>
43
44
  <td>
@@ -99,7 +100,8 @@
99
100
  <td>
100
101
  <% city.teams.each_with_index do |team,index| %>
101
102
  <%= '•' if index > 0 %>
102
- <%= link_to team.title, short_team_path(team) %>
103
+ <%= logo_for_team( team ) %>
104
+ <%= link_to_team( team ) %>
103
105
  <% end %><!-- each team -->
104
106
  </td>
105
107
  </tr>
@@ -15,13 +15,13 @@
15
15
  <td>
16
16
  <% league.events.each_with_index do |event,index| %>
17
17
  <%= '•' if index > 0 %>
18
- <%= link_to event.season.title, short_event_path(event) %>
18
+ <%= link_to_event( event ) %>
19
19
  <% end %>
20
20
  </td>
21
21
  <td style='white-space: nowrap;'>
22
22
  <% if league.country.present? %>
23
- <%= image_tag "flags/24x24/#{league.country.key}.png" %>
24
- <%= link_to league.country.title, short_country_path(league.country) %>
23
+ <%= flag_for_country( league.country) %>
24
+ <%= link_to_country( league.country ) %>
25
25
  (<%= league.country.code %>)
26
26
  <% end %>
27
27
  </td>
@@ -7,22 +7,12 @@
7
7
  <table>
8
8
  <% @event.teams.each do |team| %>
9
9
 
10
- <% if team.national? %>
11
10
  <tr>
12
11
  <td>
13
- <%= image_tag "flags/32x32/#{team.country.key}.png" %>
14
- <%= link_to team.title, short_team_path( team ) %>
12
+ <%= logo_for_team( team ) %>
13
+ <%= link_to_team( team ) %>
15
14
  <%= "(#{team.code})" if team.code.present? %>
16
- >
17
- <%= team.country.continent.title if team.country.continent.present? %>
18
- </td>
19
- </tr>
20
- <% else %><!-- club -->
21
- <tr>
22
- <td>
23
- <%= link_to team.title, short_team_path( team ) %>
24
- <%= "(#{team.code})" if team.code.present? %>
25
- </td>
15
+
26
16
  <td>
27
17
  <%= team.title2 if team.title2.present? %>
28
18
  </td>
@@ -30,10 +20,10 @@
30
20
  <%= render_team_world_tree( team ) %>
31
21
  </td>
32
22
  </tr>
33
- <% end %>
34
23
  <% end %><!-- teams.each -->
35
24
  </table>
36
25
 
26
+
37
27
  <% if @event.groups.count > 0 %>
38
28
  <h4><%= @event.groups.count %> Groups</h4>
39
29
 
@@ -55,10 +45,8 @@
55
45
  <% group.teams.each do |team| %>
56
46
 
57
47
  <td>
58
- <% if team.national? %>
59
- <%= image_tag "flags/32x32/#{team.country.key}.png" %>
60
- <% end %>
61
- <%= link_to team.title, short_team_path( team ) %>
48
+ <%= logo_for_team( team ) %>
49
+ <%= link_to_team( team ) %>
62
50
  </td>
63
51
  <% end %>
64
52
  </tr>
@@ -7,14 +7,14 @@
7
7
  <h3>Past Games</h3>
8
8
  <% end %>
9
9
 
10
- <%= render :partial => 'games', :locals => { :games => @games } %>
10
+ <%= render partial: 'games', locals: { :games => @games } %>
11
11
 
12
12
  <% if @games.count > 0 %>
13
13
  <p>
14
14
  <% if @show_upcoming %>
15
- <%= link_to 'Mehr Spiele »', games_path(:limit => 100) %>
15
+ <%= link_to 'Mehr Spiele »', games_path( limit: 100 ) %>
16
16
  <% else %>
17
- <%= link_to 'Mehr Spiele »', past_games_path(:limit => 100) %>
17
+ <%= link_to 'Mehr Spiele »', past_games_path( limit: 100 ) %>
18
18
  <% end %>
19
19
  </p>
20
20
  <% else %>
@@ -25,8 +25,8 @@ A free open sports database &amp; schema.
25
25
  <tr><td style='text-align: right'><%= Country.count %> </td><td>Countries</td></tr>
26
26
  <tr><td style='text-align: right'><%= Region.count %> </td><td>Regions</td></tr>
27
27
  <tr><td style='text-align: right'><%= City.count %> </td><td>Cities</td></tr>
28
- <tr><td style='text-align: right'><%= WorldDB::Models::Tag.count %> </td><td>Tags</td></tr>
29
- <tr><td style='text-align: right'><%= WorldDB::Models::Tagging.count %> </td><td>Taggings</td></tr>
28
+ <tr><td style='text-align: right'><%= WorldDb::Models::Tag.count %> </td><td>Tags</td></tr>
29
+ <tr><td style='text-align: right'><%= WorldDb::Models::Tagging.count %> </td><td>Taggings</td></tr>
30
30
 
31
31
  <!-- todo: add prop count -->
32
32
 
@@ -45,7 +45,7 @@ A free open sports database &amp; schema.
45
45
  Season.count+
46
46
  Team.count+
47
47
  LogDb::Models::Log.count +
48
- WorldDB::Models::Tag.count+
49
- WorldDB::Models::Tagging.count %></td><td>Total</td></tr>
48
+ WorldDb::Models::Tag.count+
49
+ WorldDb::Models::Tagging.count %></td><td>Total</td></tr>
50
50
  </table>
51
51
 
@@ -9,8 +9,8 @@
9
9
  <%= country.key %>
10
10
  </td>
11
11
  <td style='white-space: nowrap; vertical-align: top;'>
12
- <%= image_tag "flags/24x24/#{country.key}.png" %>
13
- <%= link_to country.title, short_country_path( country ) %>
12
+ <%= flag_for_country( country ) %>
13
+ <%= link_to_country( country ) %>
14
14
  </td>
15
15
  <td style='vertical-align: top;'>
16
16
  (<%= country.code %>)
@@ -35,7 +35,7 @@
35
35
  <%= round.start_at.strftime( '%b/%d %a') %>
36
36
  </td>
37
37
  <td>
38
- <%= link_to round.event.full_title, short_event_path( round.event ) %>
38
+ <%= link_to_event( round.event, full_title: true ) %>
39
39
  </td>
40
40
  <td>
41
41
  <%= round.title %>
@@ -3,7 +3,7 @@
3
3
  -->
4
4
 
5
5
  <td class='game-round'>
6
- (<%= link_to game.round.event.title, short_event_path( game.round.event ) %>
6
+ (<%= link_to_event( game.round.event, league: true ) %>
7
7
  <%= "/ #{game.round.title}" %>
8
8
  <%= "/ #{game.group.title}" if game.group.present? %>)
9
9
  </td>
@@ -8,14 +8,10 @@
8
8
 
9
9
 
10
10
  <td class='game-team1' style='text-align: right;'>
11
- <span class='<%= game_team1_style_class( game ) %>'>
12
- <%= link_to game.team1.title, short_team_path( game.team1 ) %>
11
+ <span class='<%= game.team1_style_class %>'>
12
+ <%= link_to_team( game.team1 ) %>
13
13
  </span>
14
14
  <%= "(#{game.team1.title2})" if game.team1.title2.present? %>
15
15
 
16
- <!-- todo: move code to model ?? -->
17
- <% if game.team1.national? %>
18
- <%= image_tag "flags/32x32/#{game.team1.country.key}.png" %>
19
- <% end %>
20
-
21
- </td>
16
+ <%= logo_for_team( game.team1 ) %>
17
+ </td>
@@ -8,12 +8,10 @@
8
8
 
9
9
  <td class='game-team2'>
10
10
  <!-- todo: move code to model ?? -->
11
- <% if game.team2.national? %>
12
- <%= image_tag "flags/32x32/#{game.team2.country.key}.png" %>
13
- <% end %>
14
-
15
- <span class='<%= game_team2_style_class( game ) %>'>
16
- <%= link_to game.team2.title, short_team_path( game.team2 ) %>
11
+ <%= logo_for_team( game.team2 ) %>
12
+
13
+ <span class='<%= game.team2_style_class %>'>
14
+ <%= link_to_team( game.team2 ) %>
17
15
  </span>
18
16
  <%= "(#{game.team2.title2})" if game.team2.title2.present? %>
19
17
  </td>
@@ -1,7 +1,7 @@
1
1
 
2
2
  <span>
3
- <%= image_tag "flags/24x24/#{team.country.key}.png" %>
4
-
3
+ <%= flag_for_country( team.country ) %>
4
+
5
5
  <% if team.city.present? %>
6
6
  <%= team.city.title %> >
7
7
  <% if team.city.region.present? %>
@@ -9,8 +9,8 @@
9
9
  <% end %>
10
10
  <% end %>
11
11
 
12
-
13
- <%= link_to team.country.title, short_country_path(team.country) %>
12
+
13
+ <%= link_to_country( team.country ) %>
14
14
  (<%= team.country.code %>) >
15
15
  <%= team.country.continent.title if team.country.continent.present? %>
16
16
  </span>
@@ -0,0 +1,26 @@
1
+ <table>
2
+ <% teams.each do |team| %>
3
+ <tr>
4
+ <td class='team-key'><%= team.key %></td>
5
+ <td>
6
+ <%= logo_for_team( team ) %>
7
+ </td>
8
+ <td>
9
+ <%= link_to team.title, short_team_path( team ) %>
10
+ <%= " | #{team.synonyms.split('|').join(' | ')}" if team.synonyms.present? %>
11
+ </td>
12
+ <td>
13
+ <%= "(#{team.code})" if team.code.present? %>
14
+ </td>
15
+ <td>
16
+ <%= team.title2 if team.title2.present? %>
17
+ </td>
18
+
19
+ <td class='team-key'><%= team.country.key %>
20
+ </td>
21
+ <td style='white-space: nowrap;'>
22
+ <%= render_team_world_tree( team ) %>
23
+ <td>
24
+ </tr>
25
+ <% end %><!-- teams.each -->
26
+ </table>
@@ -1,7 +1,6 @@
1
1
 
2
- <h3><%= Team.count %> Teams</h3>
3
-
4
- <p>nb: no longer used; split into two views (national teams n clubs)
2
+ <p>
3
+ note: no longer used; split into two views (national teams n clubs)
5
4
  - club view is default
6
5
  </p>
7
6
 
@@ -24,26 +24,4 @@
24
24
  </p>
25
25
 
26
26
 
27
- <table>
28
- <% @teams.each do |team| %>
29
- <tr>
30
- <td class='team-key'><%= team.key %></td>
31
- <td>
32
- <%= link_to team.title, short_team_path( team ) %>
33
- <%= " | #{team.synonyms.split('|').join(' | ')}" if team.synonyms.present? %>
34
- </td>
35
- <td>
36
- <%= "(#{team.code})" if team.code.present? %>
37
- </td>
38
- <td>
39
- <%= team.title2 if team.title2.present? %>
40
- </td>
41
-
42
- <td class='team-key'><%= team.country.key %>
43
- </td>
44
- <td style='white-space: nowrap;'>
45
- <%= render_team_world_tree( team ) %>
46
- <td>
47
- </tr>
48
- <% end %><!-- teams.each -->
49
- </table>
27
+ <%= render partial: 'teams', locals: { teams: @teams } %>
@@ -16,30 +16,4 @@
16
16
  </p>
17
17
 
18
18
 
19
- <table>
20
- <% @teams.each do |team| %>
21
- <tr>
22
- <td class='team-key'><%= team.key %></td>
23
- <td>
24
- <%= link_to team.title, short_team_path( team ) %>
25
- </td>
26
- <td>
27
- <%= "(#{team.code})" if team.code.present? %>
28
- </td>
29
- <td>
30
- <%= team.title2 if team.title2.present? %>
31
- </td>
32
-
33
- <td class='team-key'><%= team.country.key %>
34
- </td>
35
- <td>
36
- <%= image_tag "flags/24x24/#{team.country.key}.png" %>
37
- <%= link_to team.country.title, short_country_path(team.country) %>
38
- (<%= team.country.code %>)
39
- >
40
- <%= team.country.continent.title if team.country.continent.present? %>
41
- <td>
42
-
43
- </tr>
44
- <% end %><!-- teams.each -->
45
- </table>
19
+ <%= render partial: 'teams', locals: { teams: @teams } %>
@@ -6,10 +6,7 @@
6
6
 
7
7
  <p>
8
8
 
9
- <% if @team.national? %>
10
- <% else %>
11
- <%= render_team_world_tree( @team ) %>
12
- <% end %>
9
+ <%= render_team_world_tree( @team ) %>
13
10
 
14
11
  <%= " | #{@team.title2}" if @team.title2.present? %>
15
12
 
@@ -25,7 +22,7 @@
25
22
 
26
23
  <ul>
27
24
  <% @team.events.each do |event| %>
28
- <li><%= link_to event.full_title, short_event_path(event) %></li>
25
+ <li><%= link_to_event( event, full_title: true ) %></li>
29
26
  <% end %>
30
27
  </ul>
31
28
 
@@ -1,15 +1,15 @@
1
1
 
2
- puts "[boot] routes.rb - before SportDbAdmin::Engine.routes.draw"
2
+ puts '[boot] routes.rb - before SportDbAdmin::Engine.routes.draw'
3
3
 
4
4
  SportDbAdmin::Engine.routes.draw do
5
5
 
6
- puts "[boot] routes.rb - enter SportDbAdmin::Engine.routes.draw"
6
+ puts '[boot] routes.rb - enter SportDbAdmin::Engine.routes.draw'
7
7
 
8
- match 'about', :to => 'pages#about'
8
+ get 'about', :to => 'pages#about'
9
9
 
10
10
 
11
- match 'clubs', :to => 'teams#index_clubs', :as => 'clubs'
12
- match 'national_teams', :to => 'teams#index_national_teams', :as => 'national_teams'
11
+ get 'clubs', :to => 'teams#index_clubs', :as => 'clubs'
12
+ get 'national_teams', :to => 'teams#index_national_teams', :as => 'national_teams'
13
13
 
14
14
  resources :countries
15
15
  resources :regions
@@ -45,24 +45,25 @@ SportDbAdmin::Engine.routes.draw do
45
45
  # shortcut -- 3+ letters (w/ digits w/ dots) - assume shortcut for event
46
46
  #
47
47
  # NB: for now -> must end with .2012 or .2012_13 etc.
48
- match '/:key', :to => 'events#shortcut', :as => :short_event_worker, :key => /.+\.[0-9_]+/
48
+ get '/:key', :to => 'events#shortcut', :as => :short_event_worker, :key => /.+\.[0-9_]+/
49
49
 
50
50
  ####
51
51
  # shortcut -- 3+ lower case letters (w/o digits) - assume shortcut for team
52
52
  # nb: do NOT use team keys like az with only two lower case letters; always use at least three minimum
53
- match '/:key', :to => 'teams#shortcut', :as => :short_team_worker, :key => /[a-z]{3,}/
53
+ # todo: allow numbers in key too
54
+ get '/:key', :to => 'teams#shortcut', :as => :short_team_worker, :key => /[a-z]{3,}/
54
55
 
55
56
 
56
57
  ####
57
58
  # shortcut -- 2 lower case letters - assume shortcut for country
58
- match '/:key', :to => 'countries#shortcut', :as => :short_country_worker, :key => /[a-z]{2}/
59
-
59
+ get '/:key', :to => 'countries#shortcut', :as => :short_country_worker, :key => /[a-z]{2}/
60
+
60
61
 
61
62
 
62
63
  root :to => 'games#index'
63
64
 
64
- puts "[boot] routes.rb - leave SportDbAdmin::Engine.routes.draw"
65
+ puts '[boot] routes.rb - leave SportDbAdmin::Engine.routes.draw'
65
66
 
66
67
  end
67
68
 
68
- puts "[boot] routes.rb - after SportDbAdmin::Engine.routes.draw"
69
+ puts '[boot] routes.rb - after SportDbAdmin::Engine.routes.draw'
@@ -1,4 +1,4 @@
1
1
 
2
2
  module SportDbAdmin
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-17 00:00:00.000000000 Z
11
+ date: 2013-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -61,7 +61,11 @@ files:
61
61
  - app/controllers/sport_db_admin/rounds_controller.rb
62
62
  - app/controllers/sport_db_admin/sport_db_admin_controller.rb
63
63
  - app/controllers/sport_db_admin/teams_controller.rb
64
+ - app/helpers/sport_db_admin/api_helper.rb
64
65
  - app/helpers/sport_db_admin/application_helper.rb
66
+ - app/helpers/sport_db_admin/format_helper.rb
67
+ - app/helpers/sport_db_admin/image_helper.rb
68
+ - app/helpers/sport_db_admin/link_helper.rb
65
69
  - app/helpers/sport_db_admin/part_helper.rb
66
70
  - app/helpers/sport_db_admin/routes_helper.rb
67
71
  - app/views/layouts/sport_db_admin/sport_db_admin.html.erb
@@ -83,6 +87,7 @@ files:
83
87
  - app/views/sport_db_admin/shared/_td_game_team1.html.erb
84
88
  - app/views/sport_db_admin/shared/_td_game_team2.html.erb
85
89
  - app/views/sport_db_admin/shared/_team_world_tree.html.erb
90
+ - app/views/sport_db_admin/teams/_teams.html.erb
86
91
  - app/views/sport_db_admin/teams/index.html.erb
87
92
  - app/views/sport_db_admin/teams/index_clubs.html.erb
88
93
  - app/views/sport_db_admin/teams/index_national_teams.html.erb