Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

move db to sport.db.admin-market

  • Loading branch information...
commit 0fdcf6510350d17eef1f15d978518d40217fdf91 1 parent 896d33c
@geraldb geraldb authored
View
8 app/controllers/db/base_controller.rb
@@ -1,8 +0,0 @@
-
-class Db::BaseController < ApplicationController
-
- layout 'db'
-
- ## todo: add require_admin etc.
-
-end
View
15 app/controllers/db/events_controller.rb
@@ -1,15 +0,0 @@
-# encoding: utf-8
-
-class Db::EventsController < Db::BaseController
-
- # GET /events
- def index
- @events = Event.all
- end
-
- # GET /events/1
- def show
- @event = Event.find( params[:id] )
- end
-
-end # class EventsController
View
22 app/controllers/db/games_controller.rb
@@ -1,22 +0,0 @@
-class Db::GamesController < Db::BaseController
-
- # GET /games
- def index
- # find next upcoming games
- limit = params[:limit] || '50'
-
- @games = Game.where( 'play_at > ?', Time.now ).order( 'play_at').limit(limit)
- @show_upcoming = true
- end
-
- # GET /games/past
- def past
- limit = params[:limit] || '50'
-
- @games = Game.where( 'play_at < ?', Time.now ).order( 'play_at desc').limit(limit)
- @show_upcoming = false
-
- render :action => 'index'
- end
-
-end # class GamesController
View
13 app/controllers/db/teams_controller.rb
@@ -1,13 +0,0 @@
-class Db::TeamsController < Db::BaseController
-
- # GET /teams
- def index
- @teams = Team.all
- end
-
- # GET /teams/1
- def show
- @team = Team.find(params[:id])
- end
-
-end # class TeamsController
View
4 app/helpers/application_helper.rb
@@ -6,7 +6,9 @@ def powered_by
## todo/fix: use version from wettpool module
content_tag :div do
link_to( 'Sportbook/1', 'https://github.com/geraldb/sportbook' ) + ', ' +
- link_to( "sport.db/#{SportDB::VERSION}", 'https://github.com/geraldb/sport.db' ) + ' - ' +
+ link_to( "sport.db/#{SportDB::VERSION}", 'https://github.com/geraldb/sport.db' ) + ', ' +
+ link_to( "sport.db-market/#{SportDB::Market::VERSION}", 'https://github.com/geraldb/sport.db-market' ) + ', ' +
+ link_to( "world.db/#{WorldDB::VERSION}", 'https://github.com/geraldb/world.db' ) + ' - ' +
content_tag( :span, "Ruby/#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM}) on") + ' ' +
content_tag( :span, "Rails/#{Rails.version} (#{Rails.env})" )
## content_tag( :span, "#{request.headers['SERVER_SOFTWARE'] || request.headers['SERVER']}" )
View
15 app/models/game.rb
@@ -35,6 +35,9 @@ module SportDB::Models
class Game
+ has_many :tips
+
+
after_save :log_action
def job_running!
@@ -49,18 +52,6 @@ def job_running?
(@job_running ||= false) == true
end
-
- def over? # game over?
- play_at <= Time.now
- end
-
- def knockout?
- knockout == true
- end
-
- def complete?
- score1.present? && score2.present?
- end
def score_str
if score5.present? && score6.present? # im Elfmeterschiessen i.E.?
View
2  app/models/tip.rb
@@ -27,7 +27,7 @@ class Tip < ActiveRecord::Base
belongs_to :user
belongs_to :pool
- belongs_to :game
+ belongs_to :game, :class_name => 'SportDB::Models::Game'
before_save :calc_toto12x
after_save :log_action
View
12 app/views/db/events/index.html.erb
@@ -1,12 +0,0 @@
-<h3><%= Event.count %> Veranstaltungen</h3>
-
-<table>
-<% @events.each do |event| %>
- <tr>
- <td colspan='2'><%= link_to event.title, db_event_path( event ) %>
- </td>
- </tr>
-<% end %><!-- events.each -->
-</table>
-
-
View
45 app/views/db/events/show.html.erb
@@ -1,45 +0,0 @@
-
-<h3><%= @event.title %></h3>
-
-
-<p>
-<!-- todo: add anchors for intra page links -->
-<% @event.rounds.each_with_index do |round,i| %>
- <% if i > 0 %>
- &bull;
- <% end %>
- <%= round.title %>
-<% end %>
-</p>
-
-
-<!-- todo: use different css class e.g. db?? -->
-<table class='play' cellspacing=0>
-
-<% @event.rounds.each do |round| %>
-<tr class='game-round'>
- <td colspan='7' class='game-round-title'>
- <%= round.title %>
- <%= "/ #{round.title2}" if round.title2.present? %>
- </td>
-</tr>
-
-
-
- <% round.games.each do |game| %>
- <tr>
-
-<%= render_game_date( game ) %>
-<%= render_game_team1_v2( game, :link => :db ) %>
-<%= render_game_score( game ) %>
-<%= render_game_team2_v2( game, :link => :db ) %>
-
-<td>
- <%= render_game_quotes( game ) %>
-</td>
-
- </tr>
- <% end %> <!-- games -->
-<% end %> <!-- rounds -->
-
-</table>
View
37 app/views/db/games/_games.html.erb
@@ -1,37 +0,0 @@
-
-<table>
-<% last_play_at = Time.local( 1999, 1, 1 )
- games.each do |game| %>
-
- <% unless last_play_at.year == game.play_at.year &&
- last_play_at.month == game.play_at.month &&
- last_play_at.day == game.play_at.day %>
-
- <tr style='background-color: silver;'>
- <td colspan='10'><%= game.play_at.strftime('%A, %d. %B %Y') %></td>
- </tr>
-
- <% end %>
-
-
- <tr style='vertical-align: middle;'>
- <td>
- <%= game.play_at.strftime('%H:%M') %>
- </td>
-
- <%= render_game_team1_v2( game, :link => :db ) %>
- <%= render_game_score( game ) %>
- <%= render_game_team2_v2( game, :link => :db ) %>
-
- <td>
- (<%= link_to game.round.event.title, db_event_path( game.round.event ) %> / <%= game.round.title %>)
- </td>
-
- <td>
- <%= render_game_quotes( game ) %>
- </td>
-
- </tr>
-<% last_play_at = game.play_at
- end %><!-- each game -->
-</table>
View
22 app/views/db/games/index.html.erb
@@ -1,22 +0,0 @@
-
-<!-- note: switch for past / upcoming games view -->
-
-<% if @show_upcoming %>
-<h3>Upcoming Games</h3>
-<% else %>
-<h3>Past Games</h3>
-<% end %>
-
-<%= render :partial => 'games', :locals => { :games => @games } %>
-
-<% if @games.count > 0 %>
-<p>
- <% if @show_upcoming %>
- <%= link_to 'Mehr Spiele »', db_games_path(:limit => 100) %>
- <% else %>
- <%= link_to 'Mehr Spiele »', past_db_games_path(:limit => 100) %>
- <% end %>
-</p>
-<% else %>
-<p>Keine Spiele gefunden.</p>
-<% end %>
View
17 app/views/db/teams/index.html.erb
@@ -1,17 +0,0 @@
-<h3><%= Team.count %> Teams</h3>
-
-<table>
- <% @teams.each do |team| %>
- <tr>
- <td>
- <%= image_tag( team.img ) if team.img.present? %>
- </td>
- <td>
- <%= link_to team.title, db_team_path( team ) %>
- </td>
- <td>
- <%= "(#{team.title2})" if team.title2.present? %>
- </td>
- </tr>
- <% end %><!-- teams.each -->
-</table>
View
51 app/views/db/teams/show.html.erb
@@ -1,51 +0,0 @@
-
-<h3>
- <%= image_tag( @team.img ) if @team.img.present? %>
- <%= @team.title %>
-</h3>
-<p>
- <%= "#{@team.title2}" if @team.title2.present? %>
-</p>
-
-
-<!-- todo: use different css class e.g. db?? -->
-<table class='play'>
-<% @team.games.each do |game| %>
-<tr>
-
-<td class='game-date'>
- <%= game.play_at_str %>
-</td>
-
-<td>
- <%= game.round.title %> - <%= link_to game.round.event.title, db_event_path(game.round.event) %>
-<td>
-
-<td class='game-team1'>
- <span class='<%= game.team1_style_class %>'>
- <%= link_to game.team1.title, db_team_path(game.team1) %>
- </span>
- <%= "(#{game.team1.title2})" if game.team1.title2.present? %>
-</td>
-<td>
- <%= image_tag( game.team1.img ) if game.team1.img.present? %>
-</td>
-
-<td class='game-score'>
- ( <%= game.score_str %> )
-</td>
-
-<td>
- <%= image_tag( game.team2.img ) if game.team2.img.present? %>
-</td>
-<td class='game-team2'>
- <span class='<%= game.team2_style_class %>'>
- <%= link_to game.team2.title, db_team_path(game.team2) %>
- </span>
- <%= "(#{game.team2.title2})" if game.team2.title2.present? %>
-</td>
-
-
-</tr>
-<% end %> <!-- games -->
-</table>
View
63 app/views/layouts/db.html.erb
@@ -1,63 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <%= render :partial => 'layouts/header' %>
-</head>
-<body>
-
-
-<div class='navbar db'>
-<table width='100%' cellspacing=0>
- <tr>
- <!-- left -->
- <td>
- <span class='logo'><%= link_to '[Logo]', pools_path() %></span>
- <span> - DB - </span>
- &nbsp;&nbsp;&nbsp;
- <% if content_for? :breadcrumb %>
- <span class='breadcrumb-inline'>
- <%= yield :breadcrumb %>
- </span>
- <% end %>
- </td>
- <!-- right -->
- <td style='text-align: right;'>
- <% if signed_in? %>
- Willkommen, <%= current_user.name %>!
-
- &nbsp;
- <span class='signout'>
- <%= link_to 'Abmelden', signout_path %>
- </span>
- <% else %>
- <span class='signin'>
- <%= link_to 'Anmelden', signin_path %>
- </span>
- <% end %>
- </td>
- </tr>
-</table>
-</div>
-
-
- <p>
- <%= link_to 'Events', db_events_path() %> &bull;
- <%= link_to 'Teams', db_teams_path() %> &bull;
- <%= link_to 'Past Games', past_db_games_path() %> &bull;
- <%= link_to 'Upcoming Games', db_games_path() %>
- <!-- todo: add some more links -->
- </p>
-
-<div class='content' style='padding: 0px 20px 0px 20px;'>
-
- <%= render :partial => 'layouts/flash', :locals => { :flash => flash } %>
-
- <%= yield %>
-
-</div>
-
-<%= render :partial => 'layouts/debug' %>
-<%= render :partial => 'layouts/version' %>
-
-</body>
-</html>
View
2  config/locales/de.yml
@@ -1,7 +1,7 @@
de:
signin: "Anmelden"
signout: "Abmelden"
- upcoming_games: "Nächsten Spiele"
+ upcoming_games: "Nächste Spiele"
past_games: "Vergangene Spiele"
more_games: "Mehr Spiele"
welcome: "Willkommen"
View
13 config/routes.rb
@@ -66,19 +66,6 @@
end
##############################
- ## routes for db
-
- match 'db', :to => 'db/games#index'
-
- namespace :db do
- resources :events
- resources :teams
- resources :games do
- get 'past', :on => :collection
- end
- end
-
- ##############################
## routes for setup via module (setup not in url -- todo/fix??)
match 'setup', :to => 'setup/teams#index'
View
5 db/migrate/001_create_db.rb
@@ -39,13 +39,14 @@ def up
t.boolean :fix, :null => false, :default => true
t.string :type # NOTE: Rails System Attribute Required for Single-Table Inheritance (STI)
-
t.boolean :calc, :null => false, :default => false
end
change_table :games do |t|
+ t.boolean :locked, :null => false, :default => false
+
t.string :type # NOTE: Rails System Attribute Required for Single-Table Inheritance (STI)
- t.boolean :calc, :null => false, :default => false
+ t.boolean :calc, :null => false, :default => false
end
Please sign in to comment.
Something went wrong with that request. Please try again.