sportdb-admin 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Manifest.txt +37 -0
- data/README.md +1 -1
- data/app/assets/javascripts/sport_db_admin/application.js +15 -0
- data/app/assets/stylesheets/sport_db_admin/application.css.scss +141 -0
- data/app/controllers/sport_db_admin/application_controller.rb +6 -0
- data/app/controllers/sport_db_admin/countries_controller.rb +25 -0
- data/app/controllers/sport_db_admin/events_controller.rb +25 -0
- data/app/controllers/sport_db_admin/games_controller.rb +36 -0
- data/app/controllers/sport_db_admin/pages_controller.rb +13 -0
- data/app/controllers/sport_db_admin/regions_controller.rb +16 -0
- data/app/controllers/sport_db_admin/rounds_controller.rb +15 -0
- data/app/controllers/sport_db_admin/teams_controller.rb +49 -0
- data/app/helpers/sport_db_admin/application_helper.rb +50 -0
- data/app/helpers/sport_db_admin/part_helper.rb +47 -0
- data/app/helpers/sport_db_admin/routes_helper.rb +23 -0
- data/app/views/layouts/sport_db_admin/application.html.erb +36 -0
- data/app/views/sport_db_admin/countries/index.html.erb +49 -0
- data/app/views/sport_db_admin/countries/show.html.erb +107 -0
- data/app/views/sport_db_admin/events/index.html.erb +32 -0
- data/app/views/sport_db_admin/events/show.html.erb +116 -0
- data/app/views/sport_db_admin/games/_games.html.erb +47 -0
- data/app/views/sport_db_admin/games/index.html.erb +22 -0
- data/app/views/sport_db_admin/pages/about.html.erb +51 -0
- data/app/views/sport_db_admin/pages/index.html.erb +2 -0
- data/app/views/sport_db_admin/regions/index.html.erb +54 -0
- data/app/views/sport_db_admin/rounds/index.html.erb +50 -0
- data/app/views/sport_db_admin/shared/_td_game_date.html.erb +4 -0
- data/app/views/sport_db_admin/shared/_td_game_debug.html.erb +7 -0
- data/app/views/sport_db_admin/shared/_td_game_flags.html.erb +13 -0
- data/app/views/sport_db_admin/shared/_td_game_round.html.erb +9 -0
- data/app/views/sport_db_admin/shared/_td_game_score.html.erb +3 -0
- data/app/views/sport_db_admin/shared/_td_game_team1.html.erb +21 -0
- data/app/views/sport_db_admin/shared/_td_game_team2.html.erb +19 -0
- data/app/views/sport_db_admin/shared/_team_world_tree.html.erb +16 -0
- data/app/views/sport_db_admin/teams/index.html.erb +7 -0
- data/app/views/sport_db_admin/teams/index_clubs.html.erb +49 -0
- data/app/views/sport_db_admin/teams/index_national_teams.html.erb +45 -0
- data/app/views/sport_db_admin/teams/show.html.erb +50 -0
- data/config/routes.rb +68 -0
- data/lib/sportdb/admin.rb +12 -1
- data/lib/sportdb/admin/version.rb +1 -1
- metadata +58 -15
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
<!-- note: switch for past / upcoming games view -->
|
3
|
+
|
4
|
+
<% if @show_upcoming %>
|
5
|
+
<h3>Upcoming Games</h3>
|
6
|
+
<% else %>
|
7
|
+
<h3>Past Games</h3>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<%= render :partial => 'games', :locals => { :games => @games } %>
|
11
|
+
|
12
|
+
<% if @games.count > 0 %>
|
13
|
+
<p>
|
14
|
+
<% if @show_upcoming %>
|
15
|
+
<%= link_to 'Mehr Spiele »', games_path(:limit => 100) %>
|
16
|
+
<% else %>
|
17
|
+
<%= link_to 'Mehr Spiele »', past_games_path(:limit => 100) %>
|
18
|
+
<% end %>
|
19
|
+
</p>
|
20
|
+
<% else %>
|
21
|
+
<p>Keine Spiele gefunden.</p>
|
22
|
+
<% end %>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
<h2>What's <code>sport.db</code>?</h2>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
A free open sports database & schema.
|
7
|
+
<a href="https://github.com/geraldb/sport.db">More »</a>
|
8
|
+
</p>
|
9
|
+
|
10
|
+
<hr>
|
11
|
+
|
12
|
+
|
13
|
+
<table>
|
14
|
+
<tr><td style='text-align: right'><%= Badge.count %> </td><td>Badges</td></tr>
|
15
|
+
<tr><td style='text-align: right'><%= Event.count %> </td><td>Events</td></tr>
|
16
|
+
<tr><td style='text-align: right'><%= Game.count %> </td><td>Games</td></tr>
|
17
|
+
<tr><td style='text-align: right'><%= Group.count %> </td><td>Groups</td></tr>
|
18
|
+
<tr><td style='text-align: right'><%= League.count %> </td><td>Leagues</td></tr>
|
19
|
+
<tr><td style='text-align: right'><%= Round.count %> </td><td>Rounds</td></tr>
|
20
|
+
<tr><td style='text-align: right'><%= Season.count %> </td><td>Seasons</td></tr>
|
21
|
+
<tr><td style='text-align: right'><%= Team.count %> </td><td>Teams</td></tr>
|
22
|
+
|
23
|
+
<!-- todo: split in two sections, that is, world.db and sport.db -->
|
24
|
+
|
25
|
+
<tr><td style='text-align: right'><%= Country.count %> </td><td>Countries</td></tr>
|
26
|
+
<tr><td style='text-align: right'><%= Region.count %> </td><td>Regions</td></tr>
|
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>
|
30
|
+
|
31
|
+
<!-- todo: add prop count -->
|
32
|
+
|
33
|
+
<tr><td style='text-align: right'><%= LogDb::Models::Log.count %> </td><td>Logs</td></tr>
|
34
|
+
|
35
|
+
<tr><td></td><td></td></tr>
|
36
|
+
<tr><td style='text-align: right'><%= Badge.count+
|
37
|
+
City.count+
|
38
|
+
Country.count+
|
39
|
+
Event.count+
|
40
|
+
Game.count+
|
41
|
+
Group.count+
|
42
|
+
League.count+
|
43
|
+
Region.count+
|
44
|
+
Round.count+
|
45
|
+
Season.count+
|
46
|
+
Team.count+
|
47
|
+
LogDb::Models::Log.count +
|
48
|
+
WorldDB::Models::Tag.count+
|
49
|
+
WorldDB::Models::Tagging.count %></td><td>Total</td></tr>
|
50
|
+
</table>
|
51
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<h3><%= Region.count %> Regions</h3>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<% @countries.each do |country| %>
|
5
|
+
|
6
|
+
<% if country.regions.count > 0 %>
|
7
|
+
<tr>
|
8
|
+
<td class='country-key' style='vertical-align: top;'>
|
9
|
+
<%= country.key %>
|
10
|
+
</td>
|
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 ) %>
|
14
|
+
</td>
|
15
|
+
<td style='vertical-align: top;'>
|
16
|
+
(<%= country.code %>)
|
17
|
+
</td>
|
18
|
+
<td style='vertical-align: top;'>
|
19
|
+
<span class='team-count'>
|
20
|
+
(<%= country.teams.count %>)
|
21
|
+
</span>
|
22
|
+
</td>
|
23
|
+
<td>
|
24
|
+
|
25
|
+
<table>
|
26
|
+
<% country.regions.each do |region| %>
|
27
|
+
<tr>
|
28
|
+
<td>
|
29
|
+
<%= region.title %>
|
30
|
+
</td>
|
31
|
+
<td style='white-space: nowrap;'>
|
32
|
+
<span class='team-count'>
|
33
|
+
(<%= region.teams.count %>)
|
34
|
+
</span>
|
35
|
+
|
|
36
|
+
</td>
|
37
|
+
<td>
|
38
|
+
<% region.cities.each_with_index do |city,index| %>
|
39
|
+
<%= city.title %>
|
40
|
+
<span class='team-count'>
|
41
|
+
(<%= city.teams.count %>)
|
42
|
+
</span>
|
43
|
+
<% end %><!-- each city -->
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
<% end %> <!-- each region -->
|
47
|
+
</table>
|
48
|
+
|
49
|
+
</td>
|
50
|
+
</tr>
|
51
|
+
<% end %><!-- if country.regions.count > 0 -->
|
52
|
+
|
53
|
+
<% end %><!-- each country -->
|
54
|
+
</table>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<h3><%= Round.count %> Rounds</h3>
|
2
|
+
|
3
|
+
<table class='play'>
|
4
|
+
<% last_start_at = Time.local( 1999, 1, 1 )
|
5
|
+
@rounds.each do |round| %>
|
6
|
+
|
7
|
+
|
8
|
+
<% unless last_start_at.year == round.start_at.year &&
|
9
|
+
last_start_at.month == round.start_at.month &&
|
10
|
+
last_start_at.day == round.start_at.day %>
|
11
|
+
|
12
|
+
<% unless last_start_at.year == round.start_at.year %>
|
13
|
+
<tr class='round-year'>
|
14
|
+
<td colspan='2'></td>
|
15
|
+
<td colspan='9'><%= round.start_at.strftime('%Y') %></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<!-- todo: find a method for week number; do NOT use strftime; there must be something easier -->
|
20
|
+
<% unless last_start_at.strftime('%V') == round.start_at.strftime('%V') %>
|
21
|
+
<tr class='round-week'>
|
22
|
+
<td colspan='2'></td>
|
23
|
+
<td colspan='9'>Week <%= round.start_at.strftime('%V') %></td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
<tr>
|
33
|
+
<td class='round-key'><%= round.event.key %> - <%= round.pos %></td>
|
34
|
+
<td>
|
35
|
+
<%= round.start_at.strftime( '%b/%d %a') %>
|
36
|
+
</td>
|
37
|
+
<td>
|
38
|
+
<%= link_to round.event.full_title, short_event_path( round.event ) %>
|
39
|
+
</td>
|
40
|
+
<td>
|
41
|
+
<%= round.title %>
|
42
|
+
<%= "(#{round.title2})" if round.title2.present? %>
|
43
|
+
</td>
|
44
|
+
<td class='round-debug'>
|
45
|
+
<%= round.start_at %>
|
46
|
+
</td>
|
47
|
+
</tr>
|
48
|
+
<% last_start_at = round.start_at
|
49
|
+
end %><!-- rounds.each -->
|
50
|
+
</table>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
<!-- todo: add option to use full_title e.g. event.full_title
|
3
|
+
-->
|
4
|
+
|
5
|
+
<td class='game-round'>
|
6
|
+
(<%= link_to game.round.event.title, short_event_path( game.round.event ) %>
|
7
|
+
<%= "/ #{game.round.title}" %>
|
8
|
+
<%= "/ #{game.group.title}" if game.group.present? %>)
|
9
|
+
</td>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!-- paras: game
|
2
|
+
NB: v2 uses two tds (table cells)
|
3
|
+
-->
|
4
|
+
|
5
|
+
<!-- todo/fix:
|
6
|
+
check for :link options (:db|:live)
|
7
|
+
-->
|
8
|
+
|
9
|
+
|
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 ) %>
|
13
|
+
</span>
|
14
|
+
<%= "(#{game.team1.title2})" if game.team1.title2.present? %>
|
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>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!-- paras: game
|
2
|
+
NB: v2 uses two tds (table cells)
|
3
|
+
-->
|
4
|
+
|
5
|
+
<!-- todo/fix:
|
6
|
+
check for :link options (:db|:live)
|
7
|
+
-->
|
8
|
+
|
9
|
+
<td class='game-team2'>
|
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 ) %>
|
17
|
+
</span>
|
18
|
+
<%= "(#{game.team2.title2})" if game.team2.title2.present? %>
|
19
|
+
</td>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
<span>
|
3
|
+
<%= image_tag "flags/24x24/#{team.country.key}.png" %>
|
4
|
+
|
5
|
+
<% if team.city.present? %>
|
6
|
+
<%= team.city.title %> >
|
7
|
+
<% if team.city.region.present? %>
|
8
|
+
<%= team.city.region.title %> >
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
|
13
|
+
<%= link_to team.country.title, short_country_path(team.country) %>
|
14
|
+
(<%= team.country.code %>) >
|
15
|
+
<%= team.country.continent.title if team.country.continent.present? %>
|
16
|
+
</span>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
<h3><%= @teams.size %> Clubs</h3>
|
3
|
+
|
4
|
+
<p>
|
5
|
+
All
|
6
|
+
<span class='team-count'>
|
7
|
+
(<%= @teams.count %>)
|
8
|
+
</span>
|
9
|
+
<% Continent.all.each do |continent| %>
|
10
|
+
•
|
11
|
+
<%= continent.title %>
|
12
|
+
<span class='team-count'>
|
13
|
+
(<%= continent.teams.where( club: true ).count %>)
|
14
|
+
</span>
|
15
|
+
<% end %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
<p>
|
21
|
+
Sort By: <%= link_to 'Key A-Z', clubs_path(order: 'key') %> •
|
22
|
+
<%= link_to 'Title A-Z', clubs_path(order: 'title') %> •
|
23
|
+
<%= link_to 'Code A-Z', clubs_path(order: 'code') %>
|
24
|
+
</p>
|
25
|
+
|
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>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
<h3><%= @teams.size %> National Teams</h3>
|
3
|
+
|
4
|
+
<p>
|
5
|
+
All
|
6
|
+
<span class='team-count'>
|
7
|
+
(<%= @teams.count %>)
|
8
|
+
</span>
|
9
|
+
<% Continent.all.each do |continent| %>
|
10
|
+
•
|
11
|
+
<%= continent.title %>
|
12
|
+
<span class='country-count'>
|
13
|
+
(<%= continent.teams.where( club: false ).count %>)
|
14
|
+
</span>
|
15
|
+
<% end %>
|
16
|
+
</p>
|
17
|
+
|
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>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
<h3>
|
3
|
+
<%= @team.title %>
|
4
|
+
<%= "(#{@team.code})" if @team.code.present? %>
|
5
|
+
</h3>
|
6
|
+
|
7
|
+
<p>
|
8
|
+
|
9
|
+
<% if @team.national? %>
|
10
|
+
<% else %>
|
11
|
+
<%= render_team_world_tree( @team ) %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= " | #{@team.title2}" if @team.title2.present? %>
|
15
|
+
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<!-- check for badges -->
|
19
|
+
|
20
|
+
<p>
|
21
|
+
<% @team.badges.each do |badge| %>
|
22
|
+
<%= badge.title %> <%= badge.league.title %> <%= badge.season.title %><br>
|
23
|
+
<% end %>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<ul>
|
27
|
+
<% @team.events.each do |event| %>
|
28
|
+
<li><%= link_to event.full_title, short_event_path(event) %></li>
|
29
|
+
<% end %>
|
30
|
+
</ul>
|
31
|
+
|
32
|
+
|
33
|
+
<!-- todo: use different css class e.g. db?? -->
|
34
|
+
<table class='play'>
|
35
|
+
<% @team.games.each do |game| %>
|
36
|
+
<tr>
|
37
|
+
|
38
|
+
<%= render_game_date( game ) %>
|
39
|
+
|
40
|
+
<%= render_game_team1( game ) %>
|
41
|
+
<%= render_game_score( game ) %>
|
42
|
+
<%= render_game_team2( game ) %>
|
43
|
+
<%= render_game_flags( game ) %>
|
44
|
+
<%= render_game_round( game ) %>
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
</tr>
|
49
|
+
<% end %> <!-- games -->
|
50
|
+
</table>
|