sportdb-admin 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,47 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module SportDbAdmin
|
4
|
+
module PartHelper
|
5
|
+
|
6
|
+
###################################
|
7
|
+
# helper for shared partials
|
8
|
+
#
|
9
|
+
# by convention all start w/ render_
|
10
|
+
|
11
|
+
|
12
|
+
def render_game_date( game, opts={} )
|
13
|
+
render :partial => 'sport_db_admin/shared/td_game_date', :locals => { :game => game }
|
14
|
+
end
|
15
|
+
|
16
|
+
def render_game_score( game, opts={} )
|
17
|
+
render :partial => 'sport_db_admin/shared/td_game_score', :locals => { :game => game }
|
18
|
+
end
|
19
|
+
|
20
|
+
def render_game_team1( game, opts={} )
|
21
|
+
render :partial => 'sport_db_admin/shared/td_game_team1', :locals => { :game => game }
|
22
|
+
end
|
23
|
+
|
24
|
+
def render_game_team2( game, opts={} )
|
25
|
+
render :partial => 'sport_db_admin/shared/td_game_team2', :locals => { :game => game }
|
26
|
+
end
|
27
|
+
|
28
|
+
def render_game_flags( game, opts={} )
|
29
|
+
render :partial => 'sport_db_admin/shared/td_game_flags', :locals => { :game => game }
|
30
|
+
end
|
31
|
+
|
32
|
+
def render_game_debug( game, opts={} )
|
33
|
+
render :partial => 'sport_db_admin/shared/td_game_debug', :locals => { :game => game }
|
34
|
+
end
|
35
|
+
|
36
|
+
def render_game_round( game, opts={} )
|
37
|
+
render :partial => 'sport_db_admin/shared/td_game_round', :locals => { :game => game }
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def render_team_world_tree( team, opts={} )
|
42
|
+
render :partial => 'sport_db_admin/shared/team_world_tree', :locals => { :team => team }
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
end # module PartHelper
|
47
|
+
end # module SportDbAdmin
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module SportDbAdmin
|
4
|
+
module RoutesHelper
|
5
|
+
|
6
|
+
##############################
|
7
|
+
## routes for shortcuts
|
8
|
+
|
9
|
+
def short_country_path( country )
|
10
|
+
short_country_worker_path( country.key )
|
11
|
+
end
|
12
|
+
|
13
|
+
def short_team_path( team )
|
14
|
+
short_team_worker_path( team.key )
|
15
|
+
end
|
16
|
+
|
17
|
+
def short_event_path( event )
|
18
|
+
key = event.key.tr('/', '_')
|
19
|
+
short_event_worker_path( key )
|
20
|
+
end
|
21
|
+
|
22
|
+
end # module RoutesHelper
|
23
|
+
end # module SportDbAdmin
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
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" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= link_to 'Events', events_path() %> •
|
13
|
+
<%= link_to 'Clubs', clubs_path() %> •
|
14
|
+
<%= link_to 'National Teams', national_teams_path() %> •
|
15
|
+
<%= link_to 'Countries & Cities', countries_path() %> •
|
16
|
+
<%= link_to 'Regions', regions_path() %> •
|
17
|
+
<%= link_to 'Rounds', rounds_path() %> •
|
18
|
+
<%= link_to 'Past Games', past_games_path() %> •
|
19
|
+
<%= link_to 'Upcoming Games', games_path() %> •
|
20
|
+
<%= link_to 'About', about_path() %> .::.
|
21
|
+
|
22
|
+
<!-- fix: use named url_helper for /api -->
|
23
|
+
<%= link_to "Web Service / HTTP JSON API", '/api' %>
|
24
|
+
<!-- todo: add some more links -->
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<div class='content'>
|
28
|
+
<%= yield %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class='version'>
|
32
|
+
<%= powered_by %>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
</body>
|
36
|
+
</html>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
<h3><%= @countries.count %> Countries / <%= City.count %> Cities</h3>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
All
|
7
|
+
<span class='country-count'>
|
8
|
+
(<%= @countries.count %>)
|
9
|
+
</span>
|
10
|
+
<% Continent.all.each do |continent| %>
|
11
|
+
•
|
12
|
+
<%= continent.title %>
|
13
|
+
<span class='country-count'>
|
14
|
+
(<%= continent.countries.count %>)
|
15
|
+
</span>
|
16
|
+
<% end %>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
|
20
|
+
<table>
|
21
|
+
<% @countries.each do |country| %>
|
22
|
+
<tr>
|
23
|
+
<td>
|
24
|
+
<%= country.continent.title if country.continent.present? %>
|
25
|
+
</td>
|
26
|
+
<td class='country-key'>
|
27
|
+
<%= country.key %>
|
28
|
+
</td>
|
29
|
+
<td style='white-space: nowrap;'>
|
30
|
+
<%= image_tag "flags/24x24/#{country.key}.png" %>
|
31
|
+
<%= link_to country.title, short_country_path( country ) %>
|
32
|
+
</td>
|
33
|
+
<td>
|
34
|
+
(<%= country.code %>)
|
35
|
+
</td>
|
36
|
+
<td>
|
37
|
+
<span class='city-count'>
|
38
|
+
(<%= country.cities.count %>)
|
39
|
+
</span>
|
40
|
+
</td>
|
41
|
+
<td>
|
42
|
+
<% country.cities.each do |city| %>
|
43
|
+
<%= city.title %>
|
44
|
+
<span class='team-count'>(<%= city.teams.count %>)</span>
|
45
|
+
<% end %> <!-- each city -->
|
46
|
+
</td>
|
47
|
+
</tr>
|
48
|
+
<% end %><!-- each country -->
|
49
|
+
</table>
|
@@ -0,0 +1,107 @@
|
|
1
|
+
|
2
|
+
<h3>
|
3
|
+
<%= image_tag "flags/24x24/#{@country.key}.png" %>
|
4
|
+
<%= @country.title %>
|
5
|
+
(<%= @country.code %>)
|
6
|
+
</h3>
|
7
|
+
|
8
|
+
|
9
|
+
<h4><%= @country.leagues.count %> Leagues</h4>
|
10
|
+
|
11
|
+
<table>
|
12
|
+
<% @country.leagues.each do |league| %>
|
13
|
+
<tr>
|
14
|
+
<td class='league-key'><%= league.key %></td>
|
15
|
+
<td><%= league.title %></td>
|
16
|
+
<td>
|
17
|
+
<span class='event-count'>
|
18
|
+
(<%= league.events.count %>)
|
19
|
+
</span>
|
20
|
+
</td>
|
21
|
+
<td>
|
22
|
+
<% league.events.each_with_index do |event,index| %>
|
23
|
+
<%= '•' if index > 0 %>
|
24
|
+
<%= link_to event.season.title, short_event_path(event) %>
|
25
|
+
<% end %>
|
26
|
+
</td>
|
27
|
+
</tr>
|
28
|
+
<% end %>
|
29
|
+
</table>
|
30
|
+
|
31
|
+
|
32
|
+
<h4><%= @country.teams.count %> Teams</h4>
|
33
|
+
|
34
|
+
|
35
|
+
<table>
|
36
|
+
<% @country.teams.each do |team| %>
|
37
|
+
<tr>
|
38
|
+
<td class='team-key'><%= team.key %></td>
|
39
|
+
<td>
|
40
|
+
<%= link_to team.title, short_team_path( team ) %>
|
41
|
+
<%= " | #{team.synonyms.split('|').join(' | ')}" if team.synonyms.present? %>
|
42
|
+
</td>
|
43
|
+
<td>
|
44
|
+
<%= "(#{team.code})" if team.code.present? %>
|
45
|
+
</td>
|
46
|
+
<td>
|
47
|
+
<%= team.title2 if team.title2.present? %>
|
48
|
+
</td>
|
49
|
+
</tr>
|
50
|
+
<% end %><!-- teams.each -->
|
51
|
+
</table>
|
52
|
+
|
53
|
+
|
54
|
+
<h4><%= @country.regions.count %> Regions</h4>
|
55
|
+
|
56
|
+
<table>
|
57
|
+
<% @country.regions.each do |region| %>
|
58
|
+
<tr>
|
59
|
+
<td class='region-key'>
|
60
|
+
<%= region.key %>
|
61
|
+
</td>
|
62
|
+
<td>
|
63
|
+
<%= region.title %>
|
64
|
+
</td>
|
65
|
+
<td>
|
66
|
+
<span class='city-count'>
|
67
|
+
(<%= region.cities.count %>)
|
68
|
+
</span>
|
69
|
+
</td>
|
70
|
+
<td>
|
71
|
+
<% region.cities.each_with_index do |city,index| %>
|
72
|
+
<%= '•' if index > 0 %>
|
73
|
+
<%= city.title %>
|
74
|
+
<% end %><!-- each city -->
|
75
|
+
</td>
|
76
|
+
</tr>
|
77
|
+
<% end %> <!-- each region -->
|
78
|
+
</table>
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<h4><%= @country.cities.count %> Cities</h4>
|
85
|
+
|
86
|
+
<table>
|
87
|
+
<% @country.cities.each do |city| %>
|
88
|
+
<tr>
|
89
|
+
<td class='city-key'>
|
90
|
+
<%= city.key %>
|
91
|
+
</td>
|
92
|
+
<td>
|
93
|
+
<%= city.title %>
|
94
|
+
<%= " | #{city.synonyms.split('|').join(' | ')}" if city.synonyms.present? %>
|
95
|
+
</td>
|
96
|
+
<td>
|
97
|
+
<span class='team-count'>(<%= city.teams.count %>)</span>
|
98
|
+
</td>
|
99
|
+
<td>
|
100
|
+
<% city.teams.each_with_index do |team,index| %>
|
101
|
+
<%= '•' if index > 0 %>
|
102
|
+
<%= link_to team.title, short_team_path(team) %>
|
103
|
+
<% end %><!-- each team -->
|
104
|
+
</td>
|
105
|
+
</tr>
|
106
|
+
<% end %> <!-- each city -->
|
107
|
+
</table>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<h3><%= Event.count %> Events</h3>
|
2
|
+
|
3
|
+
|
4
|
+
<table>
|
5
|
+
<% League.all.each do |league| %>
|
6
|
+
<% if league.events.count > 0 %>
|
7
|
+
<tr>
|
8
|
+
<td class='league-key'><%= league.key %></td>
|
9
|
+
<td><%= league.title %></td>
|
10
|
+
<td>
|
11
|
+
<span class='event-count'>
|
12
|
+
(<%= league.events.count %>)
|
13
|
+
</span>
|
14
|
+
</td>
|
15
|
+
<td>
|
16
|
+
<% league.events.each_with_index do |event,index| %>
|
17
|
+
<%= '•' if index > 0 %>
|
18
|
+
<%= link_to event.season.title, short_event_path(event) %>
|
19
|
+
<% end %>
|
20
|
+
</td>
|
21
|
+
<td style='white-space: nowrap;'>
|
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) %>
|
25
|
+
(<%= league.country.code %>)
|
26
|
+
<% end %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<% end %><!-- if league.events.count > 0 -->
|
30
|
+
<% end %><!-- each league -->
|
31
|
+
</table>
|
32
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
|
2
|
+
<h3><%= @event.full_title %></h3>
|
3
|
+
|
4
|
+
|
5
|
+
<h4><%= @event.teams.count %> Teams</h4>
|
6
|
+
|
7
|
+
<table>
|
8
|
+
<% @event.teams.each do |team| %>
|
9
|
+
|
10
|
+
<% if team.national? %>
|
11
|
+
<tr>
|
12
|
+
<td>
|
13
|
+
<%= image_tag "flags/32x32/#{team.country.key}.png" %>
|
14
|
+
<%= link_to team.title, short_team_path( team ) %>
|
15
|
+
<%= "(#{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>
|
26
|
+
<td>
|
27
|
+
<%= team.title2 if team.title2.present? %>
|
28
|
+
</td>
|
29
|
+
<td>
|
30
|
+
<%= render_team_world_tree( team ) %>
|
31
|
+
</td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
<% end %><!-- teams.each -->
|
35
|
+
</table>
|
36
|
+
|
37
|
+
<% if @event.groups.count > 0 %>
|
38
|
+
<h4><%= @event.groups.count %> Groups</h4>
|
39
|
+
|
40
|
+
<p>
|
41
|
+
<% @event.groups.each_with_index do |group,i| %>
|
42
|
+
<% if i > 0 %>
|
43
|
+
•
|
44
|
+
<% end %>
|
45
|
+
<%= group.title %>
|
46
|
+
<% end %>
|
47
|
+
</p>
|
48
|
+
|
49
|
+
<table>
|
50
|
+
<% @event.groups.each do |group| %>
|
51
|
+
<tr>
|
52
|
+
<td>
|
53
|
+
<%= group.title %> |
|
54
|
+
</td>
|
55
|
+
<% group.teams.each do |team| %>
|
56
|
+
|
57
|
+
<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 ) %>
|
62
|
+
</td>
|
63
|
+
<% end %>
|
64
|
+
</tr>
|
65
|
+
<% end %>
|
66
|
+
</table>
|
67
|
+
|
68
|
+
<% end %> <!-- if event.groups.count > 0 -->
|
69
|
+
|
70
|
+
<!-- add games count -- how? -->
|
71
|
+
<h4><%= @event.games.count %> Games</h4>
|
72
|
+
|
73
|
+
<p>
|
74
|
+
<!-- todo: add anchors for intra page links -->
|
75
|
+
<% @event.rounds.each_with_index do |round,i| %>
|
76
|
+
<% if i > 0 %>
|
77
|
+
•
|
78
|
+
<% end %>
|
79
|
+
<%= round.title %>
|
80
|
+
<% end %>
|
81
|
+
</p>
|
82
|
+
|
83
|
+
|
84
|
+
<!-- todo: use different css class e.g. db?? -->
|
85
|
+
<table class='play'>
|
86
|
+
|
87
|
+
<% @event.rounds.each do |round| %>
|
88
|
+
<tr class='game-round'>
|
89
|
+
<td colspan='6' class='game-round-title'>
|
90
|
+
<%= round.title %>
|
91
|
+
<%= "/ #{round.title2}" if round.title2.present? %>
|
92
|
+
</td>
|
93
|
+
</tr>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<% round.games.each do |game| %>
|
98
|
+
<tr>
|
99
|
+
|
100
|
+
<%= render_game_date( game ) %>
|
101
|
+
<%= render_game_team1( game ) %>
|
102
|
+
<%= render_game_score( game ) %>
|
103
|
+
<%= render_game_team2( game ) %>
|
104
|
+
|
105
|
+
<td>
|
106
|
+
<!-- todo: move to partial -->
|
107
|
+
<%= "(#{game.group.title})" if game.group.present? %>
|
108
|
+
</td>
|
109
|
+
|
110
|
+
<%= render_game_flags( game ) %>
|
111
|
+
|
112
|
+
</tr>
|
113
|
+
<% end %> <!-- games -->
|
114
|
+
<% end %> <!-- rounds -->
|
115
|
+
|
116
|
+
</table>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
<table class='play'>
|
3
|
+
<% last_play_at = Time.local( 1999, 1, 1 )
|
4
|
+
games.each do |game| %>
|
5
|
+
|
6
|
+
<% unless last_play_at.year == game.play_at.year &&
|
7
|
+
last_play_at.month == game.play_at.month &&
|
8
|
+
last_play_at.day == game.play_at.day %>
|
9
|
+
|
10
|
+
<% unless last_play_at.year == game.play_at.year %>
|
11
|
+
<tr class='game-year'>
|
12
|
+
<td colspan='2'></td>
|
13
|
+
<td colspan='7'> <%= game.play_at.strftime('%Y') %></td>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<!-- todo: find a method for week number; do NOT use strftime; there must be something easier -->
|
18
|
+
<% unless last_play_at.strftime('%V') == game.play_at.strftime('%V') %>
|
19
|
+
<tr class='game-week'>
|
20
|
+
<td colspan='2'></td>
|
21
|
+
<td colspan='7'>Week <%= game.play_at.strftime('%V') %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<tr class='game-day'>
|
26
|
+
<td></td>
|
27
|
+
<td colspan='8'><%= game.play_at.strftime('%A, %d. %B') %></td>
|
28
|
+
</tr>
|
29
|
+
|
30
|
+
<% end %>
|
31
|
+
|
32
|
+
|
33
|
+
<tr>
|
34
|
+
<td class='game-hour'>
|
35
|
+
<%= game.play_at.strftime('%H:%M') %>
|
36
|
+
</td>
|
37
|
+
|
38
|
+
<%= render_game_team1( game ) %>
|
39
|
+
<%= render_game_score( game ) %>
|
40
|
+
<%= render_game_team2( game ) %>
|
41
|
+
<%= render_game_flags( game ) %>
|
42
|
+
<%= render_game_round( game ) %>
|
43
|
+
|
44
|
+
</tr>
|
45
|
+
<% last_play_at = game.play_at
|
46
|
+
end %><!-- each game -->
|
47
|
+
</table>
|