Permalink
Browse files

hmm last time seems not all changes where commited because didn't add…

… them
  • Loading branch information...
1 parent cd74897 commit 5d340d4750c3e89f923e0dabeda056ac6829750e @joshy committed Jun 22, 2011
Showing with 14 additions and 10 deletions.
  1. +9 −7 Store.rb
  2. +3 −2 views/games.haml
  3. +2 −1 views/layout.haml
View
@@ -6,8 +6,7 @@ class Store
def initialize
@db = Sequel.connect 'jdbc:postgresql://127.0.0.1:5432/ts_league',
:user=> 'joshy', :password =>'joshy'
- ##init_database
- @players = @db[:players]
+ init_database
end
def save(games)
@@ -25,12 +24,15 @@ def games
end
def init_database
- @db.create_table :players do
- primary_key :id
- String :short_name
- Integer :games_won
- Integer :games_played
+ if (!@db.table_exists?(:players))
+ @db.create_table :players do
+ primary_key :id
+ String :short_name
+ Integer :games_won
+ Integer :games_played
+ end
end
+ @players = @db[:players]
end
end
View
@@ -1,17 +1,18 @@
%html
%body
- %div{:id => "input_form", :class => "grid_8"}
+ %div{:id => "game_form", :class => "grid_8"}
%form{ :action => "/game", :method => "post" }
%label{:for => "player"} Player
%input{:type => "text", :name => "player", :class => "text", :size => 3}
%label{:for => "won"} Games won
%input{:type => "text", :name => "won", :class => "text", :size => 2}
%label{:for => "played"} Games played
%input{:type => "text", :name => "played", :class => "text", :size => 2}
+ %input{:type => "submit", :value => "Save", :class => "button", :onclick => "hideEnterGame()"}
%div{:class => 'grid_12'}
%table{:id => 'games'}
%tr
- %th{:colspan => "4", :class => "right"}
+ %th{:colspan => "4", :class => "right", :onclick => "showEnterGame()"}
%a(title="Enter game") Enter game
%tr
%th{:scope => 'col'} Player
View
@@ -5,9 +5,10 @@
%link(rel = "stylesheet" href="css/grid.css")
%body
%script{:type => "text/javascript", :src => "js/jquery-1.6.1.js"}
+ %script{:type => "text/javascript", :src => "js/default.js"}
:javascript
$(document).ready(function() {
- $('#input_form').hide();
+ $('#game_form').hide();
});
#content{:class => 'container container_12'}
=yield

0 comments on commit 5d340d4

Please sign in to comment.