Permalink
Browse files

some polish

  • Loading branch information...
1 parent 453809c commit 8b72a37ef126cd72658a4f730ceb507dd5a14f0f @geraldb geraldb committed Mar 6, 2012
Showing with 1,598 additions and 1 deletion.
  1. +38 −0 Gemfile
  2. +111 −0 Gemfile.lock
  3. +7 −0 Rakefile
  4. BIN app/assets/images/rails.png
  5. +15 −0 app/assets/javascripts/application.js
  6. +3 −0 app/assets/javascripts/players.js.coffee
  7. +3 −0 app/assets/javascripts/pools.js.coffee
  8. +3 −0 app/assets/javascripts/session.js.coffee
  9. +3 −0 app/assets/javascripts/sessions.js.coffee
  10. +3 −0 app/assets/javascripts/users.js.coffee
  11. +13 −0 app/assets/stylesheets/application.css
  12. +3 −0 app/assets/stylesheets/players.css.scss
  13. +3 −0 app/assets/stylesheets/pools.css.scss
  14. +56 −0 app/assets/stylesheets/scaffolds.css.scss
  15. +3 −0 app/assets/stylesheets/session.css.scss
  16. +3 −0 app/assets/stylesheets/sessions.css.scss
  17. +3 −0 app/assets/stylesheets/users.css.scss
  18. +5 −0 app/controllers/application_controller.rb
  19. +59 −0 app/controllers/players_controller.rb
  20. +94 −0 app/controllers/pools_controller.rb
  21. +29 −0 app/controllers/sessions_controller.rb
  22. +83 −0 app/controllers/users_controller.rb
  23. +15 −0 app/helpers/application_helper.rb
  24. +2 −0 app/helpers/players_helper.rb
  25. +2 −0 app/helpers/pools_helper.rb
  26. +2 −0 app/helpers/session_helper.rb
  27. +2 −0 app/helpers/sessions_helper.rb
  28. +2 −0 app/helpers/users_helper.rb
  29. 0 app/mailers/.gitkeep
  30. +8 −0 app/models/pool.rb
  31. +7 −0 app/models/pool_user.rb
  32. +7 −0 app/models/tip.rb
  33. +8 −0 app/models/user.rb
  34. +42 −0 app/views/layouts/application.html.erb
  35. +28 −0 app/views/players/edit.html.erb
  36. +2 −0 app/views/players/index.html.erb
  37. +15 −0 app/views/players/show.html.erb
  38. +21 −0 app/views/pools/_form.html.erb
  39. +6 −0 app/views/pools/edit.html.erb
  40. +12 −0 app/views/pools/index.html.erb
  41. +5 −0 app/views/pools/new.html.erb
  42. +28 −0 app/views/pools/show.html.erb
  43. +20 −0 app/views/sessions/new.html.erb
  44. +21 −0 app/views/users/_form.html.erb
  45. +6 −0 app/views/users/edit.html.erb
  46. +23 −0 app/views/users/index.html.erb
  47. +5 −0 app/views/users/new.html.erb
  48. +10 −0 app/views/users/show.html.erb
  49. +4 −0 config.ru
  50. +59 −0 config/application.rb
  51. +6 −0 config/boot.rb
  52. +25 −0 config/database.yml
  53. +5 −0 config/environment.rb
  54. +37 −0 config/environments/development.rb
  55. +67 −0 config/environments/production.rb
  56. +37 −0 config/environments/test.rb
  57. +7 −0 config/initializers/backtrace_silencers.rb
  58. +15 −0 config/initializers/inflections.rb
  59. +5 −0 config/initializers/mime_types.rb
  60. +7 −0 config/initializers/secret_token.rb
  61. +8 −0 config/initializers/session_store.rb
  62. +14 −0 config/initializers/wrap_parameters.rb
  63. +5 −0 config/locales/en.yml
  64. +18 −0 config/routes.rb
  65. +21 −0 db/migrate/20120305214015_create_db.rb
  66. +69 −0 db/schema.rb
  67. +34 −1 db/seeds.rb
  68. +2 −0 doc/README_FOR_APP
  69. 0 lib/assets/.gitkeep
  70. 0 lib/tasks/.gitkeep
  71. 0 log/.gitkeep
  72. +26 −0 public/404.html
  73. +26 −0 public/422.html
  74. +25 −0 public/500.html
  75. 0 public/favicon.ico
  76. +5 −0 public/robots.txt
  77. +6 −0 script/rails
  78. 0 test/fixtures/.gitkeep
  79. +7 −0 test/fixtures/pools.yml
  80. +11 −0 test/fixtures/tips.yml
  81. +7 −0 test/fixtures/users.yml
  82. 0 test/functional/.gitkeep
  83. +19 −0 test/functional/players_controller_test.rb
  84. +49 −0 test/functional/pools_controller_test.rb
  85. +9 −0 test/functional/session_controller_test.rb
  86. +9 −0 test/functional/sessions_controller_test.rb
  87. +49 −0 test/functional/users_controller_test.rb
  88. 0 test/integration/.gitkeep
  89. +12 −0 test/performance/browsing_test.rb
  90. +13 −0 test/test_helper.rb
  91. 0 test/unit/.gitkeep
  92. +4 −0 test/unit/helpers/players_helper_test.rb
  93. +4 −0 test/unit/helpers/pools_helper_test.rb
  94. +4 −0 test/unit/helpers/session_helper_test.rb
  95. +4 −0 test/unit/helpers/sessions_helper_test.rb
  96. +4 −0 test/unit/helpers/users_helper_test.rb
  97. +7 −0 test/unit/pool_test.rb
  98. +7 −0 test/unit/tip_test.rb
  99. +7 −0 test/unit/user_test.rb
  100. 0 vendor/assets/javascripts/.gitkeep
  101. 0 vendor/assets/stylesheets/.gitkeep
  102. 0 vendor/plugins/.gitkeep
View
@@ -0,0 +1,38 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.1'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer'
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
View
@@ -0,0 +1,111 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.1)
+ actionpack (= 3.2.1)
+ mail (~> 2.4.0)
+ actionpack (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.1)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.1)
+ activesupport (= 3.2.1)
+ builder (~> 3.0.0)
+ activerecord (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ arel (~> 3.0.0)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ activesupport (3.2.1)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ builder (3.0.0)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.2.0)
+ erubis (2.7.0)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.3)
+ jquery-rails (2.0.1)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.6.5)
+ mail (2.4.3)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ multi_json (1.1.0)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.1)
+ actionmailer (= 3.2.1)
+ actionpack (= 3.2.1)
+ activerecord (= 3.2.1)
+ activeresource (= 3.2.1)
+ activesupport (= 3.2.1)
+ bundler (~> 1.0)
+ railties (= 3.2.1)
+ railties (3.2.1)
+ actionpack (= 3.2.1)
+ activesupport (= 3.2.1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.1.15)
+ sass-rails (3.2.4)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5-x86-mingw32)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.32)
+ uglifier (1.2.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ x86-mingw32
+
+DEPENDENCIES
+ coffee-rails (~> 3.2.1)
+ jquery-rails
+ rails (= 3.2.1)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
View
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Euro2012::Application.load_tasks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,15 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,13 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require_tree .
+*/
@@ -0,0 +1,3 @@
+// Place all the styles related to the Players controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
+// Place all the styles related to the Pools controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,56 @@
+body {
+ background-color: #fff;
+ color: #333;
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px; }
+
+p, ol, ul, td {
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px; }
+
+pre {
+ background-color: #eee;
+ padding: 10px;
+ font-size: 11px; }
+
+a {
+ color: #000;
+ &:visited {
+ color: #666; }
+ &:hover {
+ color: #fff;
+ background-color: #000; } }
+
+div {
+ &.field, &.actions {
+ margin-bottom: 10px; } }
+
+#notice {
+ color: green; }
+
+.field_with_errors {
+ padding: 2px;
+ background-color: red;
+ display: table; }
+
+#error_explanation {
+ width: 450px;
+ border: 2px solid red;
+ padding: 7px;
+ padding-bottom: 0;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 5px 5px 15px;
+ font-size: 12px;
+ margin: -7px;
+ margin-bottom: 0px;
+ background-color: #c00;
+ color: #fff; }
+ ul li {
+ font-size: 12px;
+ list-style: square; } }
@@ -0,0 +1,3 @@
+// Place all the styles related to the session controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
+// Place all the styles related to the sessions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
+// Place all the styles related to the Users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,5 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+
+ include ApplicationHelper
+end
@@ -0,0 +1,59 @@
+require 'pp'
+
+class PlayersController < ApplicationController
+ def index
+ end
+
+ def show
+ @pool = Pool.find(params[:pool_id])
+ @user = User.find(params[:id])
+
+ @tips = @user.tips.where( :pool_id => params[:pool_id] ).order( :game_id )
+ end
+
+ def edit
+ @pool = Pool.find(params[:pool_id])
+ @user = User.find(params[:id])
+
+ Game.order( :id ).all.each do |game|
+ # make sure all games exists as tips
+ tips = @user.tips.where( :pool_id => params[:pool_id] ).where( :game_id => game.id )
+ pp tips
+ if tips.empty?
+ Tip.create!( :user => @user, :pool => @pool, :game => game )
+ puts "*** adding tip for game #{game.id}"
+ else
+ puts "*** found tip for game #{game.id}"
+ end
+ end
+
+ @tips = @user.tips.where( :pool_id => params[:pool_id] ).order( :game_id )
+ end
+
+ def update
+ @pool = Pool.find(params[:pool_id])
+ @user = User.find(params[:id])
+
+=begin if @user.update_attributes( params[:user])
+ # success
+ flash.now[:notice] = 'Tipps Erfolgreich gespeichert.'
+ else
+ # failure
+ flash.now[:error] = 'Fehler beim Speichern der Tipps.'
+ ## todo: use redirect etc.
+ end
+=end
+
+ params[:user][:tips].each do |tip_key,tip_value|
+ tip = Tip.find( tip_key )
+ puts "*** updating tip #{tip_key}"
+ tip.update_attributes( tip_value )
+ tip.save!
+ end
+
+
+ @tips = @user.tips.where( :pool_id => params[:pool_id] ).order( :game_id )
+
+ render :action => 'edit'
+ end
+end
Oops, something went wrong.

0 comments on commit 8b72a37

Please sign in to comment.