Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding basic rails development

  • Loading branch information...
commit b9ac86a4d31b1d7507becf077d601d9da4474dbb 1 parent 4105ccd
Volmer Soares authored
Showing with 2,059 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +35 −0 Gemfile
  3. +119 −0 Gemfile.lock
  4. +7 −0 Rakefile
  5. BIN  app/assets/images/colorless.png
  6. BIN  app/assets/images/common.png
  7. BIN  app/assets/images/darkness.png
  8. BIN  app/assets/images/fighting.png
  9. BIN  app/assets/images/fire.png
  10. BIN  app/assets/images/grass.png
  11. BIN  app/assets/images/lightning.png
  12. BIN  app/assets/images/metal.png
  13. BIN  app/assets/images/psychic.png
  14. BIN  app/assets/images/rails.png
  15. BIN  app/assets/images/rare.png
  16. BIN  app/assets/images/rare_holo_lv_x.png
  17. BIN  app/assets/images/tcg.ico
  18. BIN  app/assets/images/uncommon.png
  19. BIN  app/assets/images/water.png
  20. +9 −0 app/assets/javascripts/application.js
  21. +3 −0  app/assets/javascripts/cards.js.coffee
  22. +3 −0  app/assets/javascripts/expansions.js.coffee
  23. +3 −0  app/assets/javascripts/home.js.coffee
  24. +90 −0 app/assets/stylesheets/application.css
  25. +5 −0 app/assets/stylesheets/cards.css.scss
  26. +5 −0 app/assets/stylesheets/expansions.css.scss
  27. +5 −0 app/assets/stylesheets/home.css.scss
  28. +58 −0 app/assets/stylesheets/scaffold.css.scss
  29. +10 −0 app/controllers/application_controller.rb
  30. +77 −0 app/controllers/cards_controller.rb
  31. +96 −0 app/controllers/expansions_controller.rb
  32. +7 −0 app/controllers/home_controller.rb
  33. +2 −0  app/helpers/application_helper.rb
  34. +2 −0  app/helpers/cards_helper.rb
  35. +52 −0 app/helpers/expansions_helper.rb
  36. +2 −0  app/helpers/home_helper.rb
  37. 0  app/mailers/.gitkeep
  38. 0  app/models/.gitkeep
  39. +28 −0 app/models/card.rb
  40. +10 −0 app/models/expansion.rb
  41. +81 −0 app/models/user.rb
  42. +33 −0 app/views/cards/_form.html.erb
  43. +5 −0 app/views/cards/edit.html.erb
  44. +21 −0 app/views/expansions/_form.html.erb
  45. +6 −0 app/views/expansions/edit.html.erb
  46. +20 −0 app/views/expansions/index.html.erb
  47. +5 −0 app/views/expansions/new.html.erb
  48. +47 −0 app/views/expansions/show.html.erb
  49. +2 −0  app/views/home/index.html.erb
  50. +18 −0 app/views/layouts/application.html.erb
  51. +12 −0 app/views/users/confirmations/new.html.erb
  52. +5 −0 app/views/users/mailer/confirmation_instructions.html.erb
  53. +8 −0 app/views/users/mailer/reset_password_instructions.html.erb
  54. +7 −0 app/views/users/mailer/unlock_instructions.html.erb
  55. +16 −0 app/views/users/passwords/edit.html.erb
  56. +12 −0 app/views/users/passwords/new.html.erb
  57. +28 −0 app/views/users/registrations/edit.html.erb
  58. +21 −0 app/views/users/registrations/new.html.erb
  59. +17 −0 app/views/users/sessions/new.html.erb
  60. +25 −0 app/views/users/shared/_links.erb
  61. +12 −0 app/views/users/unlocks/new.html.erb
  62. +4 −0 config.ru
  63. +49 −0 config/application.rb
  64. +6 −0 config/boot.rb
  65. +42 −0 config/database.yml
  66. +5 −0 config/environment.rb
  67. +33 −0 config/environments/development.rb
  68. +52 −0 config/environments/production.rb
  69. +39 −0 config/environments/test.rb
  70. +7 −0 config/initializers/backtrace_silencers.rb
  71. +194 −0 config/initializers/devise.rb
  72. +10 −0 config/initializers/inflections.rb
  73. +5 −0 config/initializers/mime_types.rb
  74. +7 −0 config/initializers/secret_token.rb
  75. +8 −0 config/initializers/session_store.rb
  76. +12 −0 config/initializers/wrap_parameters.rb
  77. +50 −0 config/locales/devise.en.yml
  78. +9 −0 config/locales/en.yml
  79. +70 −0 config/routes.rb
  80. +28 −0 db/migrate/20110528171219_devise_create_users.rb
  81. +9 −0 db/migrate/20110528171539_create_expansions.rb
  82. +14 −0 db/migrate/20110528171703_create_cards.rb
  83. +5 −0 db/migrate/20110528225127_add_login_to_users.rb
  84. +8 −0 db/migrate/20110529035907_cards_users.rb
  85. +5 −0 db/migrate/20110529203416_add_admin_to_users.rb
  86. +58 −0 db/schema.rb
  87. +7 −0 db/seeds.rb
  88. +2 −0  doc/README_FOR_APP
  89. 0  lib/tasks/.gitkeep
  90. 0  log/.gitkeep
  91. +26 −0 public/404.html
  92. +26 −0 public/422.html
  93. +26 −0 public/500.html
  94. 0  public/favicon.ico
  95. BIN  public/images/Thumbs.db
  96. BIN  public/images/colorless.png
  97. BIN  public/images/common.png
  98. BIN  public/images/darkness.png
  99. BIN  public/images/fighting.png
  100. BIN  public/images/fire.png
  101. BIN  public/images/grass.png
  102. BIN  public/images/lightning.png
  103. BIN  public/images/metal.png
  104. BIN  public/images/psychic.png
  105. BIN  public/images/rare.png
  106. BIN  public/images/rare_holo_lv_x.png
  107. BIN  public/images/tcg.ico
  108. BIN  public/images/uncommon.png
  109. BIN  public/images/water.png
  110. +5 −0 public/robots.txt
  111. +6 −0 script/rails
  112. 0  test/fixtures/.gitkeep
  113. +15 −0 test/fixtures/cards.yml
  114. +7 −0 test/fixtures/expansions.yml
  115. +11 −0 test/fixtures/users.yml
  116. 0  test/functional/.gitkeep
  117. +49 −0 test/functional/cards_controller_test.rb
  118. +49 −0 test/functional/expansions_controller_test.rb
  119. +9 −0 test/functional/home_controller_test.rb
  120. 0  test/integration/.gitkeep
  121. +12 −0 test/performance/browsing_test.rb
  122. +13 −0 test/test_helper.rb
  123. 0  test/unit/.gitkeep
  124. +7 −0 test/unit/card_test.rb
  125. +7 −0 test/unit/expansion_test.rb
  126. +4 −0 test/unit/helpers/cards_helper_test.rb
  127. +4 −0 test/unit/helpers/expansions_helper_test.rb
  128. +4 −0 test/unit/helpers/home_helper_test.rb
  129. +7 −0 test/unit/user_test.rb
  130. 0  vendor/assets/stylesheets/.gitkeep
  131. 0  vendor/plugins/.gitkeep
5 .gitignore
View
@@ -0,0 +1,5 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
+.sass-cache/
35 Gemfile
View
@@ -0,0 +1,35 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.0.rc1'
+
+# Custom gems
+
+gem 'devise'
+gem 'therubyracer'
+gem 'rake', '!=0.9.0'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'mysql2'
+
+# Asset template engines
+gem 'sass'
+gem 'coffee-script'
+gem 'uglifier'
+
+gem 'jquery-rails'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
+
+group :test do
+ # Pretty printed test output
+ gem 'turn', :require => false
+end
119 Gemfile.lock
View
@@ -0,0 +1,119 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ mail (~> 2.3.0)
+ actionpack (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6.0beta1)
+ rack (~> 1.3.0.beta2)
+ rack-cache (~> 1.0.1)
+ rack-mount (~> 0.8.1)
+ rack-test (~> 0.6.0)
+ sprockets (~> 2.0.0.beta.5)
+ tzinfo (~> 0.3.27)
+ activemodel (3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ bcrypt-ruby (~> 2.1.4)
+ builder (~> 3.0.0)
+ i18n (~> 0.6.0beta1)
+ activerecord (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ arel (~> 2.1.1)
+ tzinfo (~> 0.3.27)
+ activeresource (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ activesupport (3.1.0.rc1)
+ multi_json (~> 1.0)
+ ansi (1.2.5)
+ arel (2.1.1)
+ bcrypt-ruby (2.1.4)
+ builder (3.0.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.1.1)
+ devise (1.3.4)
+ bcrypt-ruby (~> 2.1.2)
+ orm_adapter (~> 0.0.3)
+ warden (~> 1.0.3)
+ erubis (2.7.0)
+ execjs (1.0.0)
+ multi_json (~> 1.0)
+ hike (1.0.0)
+ i18n (0.6.0)
+ jquery-rails (1.0.9)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ multi_json (1.0.3)
+ mysql2 (0.3.2)
+ orm_adapter (0.0.5)
+ polyglot (0.3.1)
+ rack (1.3.0)
+ rack-cache (1.0.2)
+ rack (>= 0.4)
+ rack-mount (0.8.1)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.0)
+ rack (>= 1.0)
+ rails (3.1.0.rc1)
+ actionmailer (= 3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activerecord (= 3.1.0.rc1)
+ activeresource (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ bundler (~> 1.0)
+ railties (= 3.1.0.rc1)
+ railties (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ thor (~> 0.14.6)
+ rake (0.8.7)
+ sass (3.1.1)
+ sprockets (2.0.0.beta.8)
+ hike (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ therubyracer (0.8.1)
+ thor (0.14.6)
+ tilt (1.3.2)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ turn (0.8.2)
+ ansi (>= 1.2.2)
+ tzinfo (0.3.27)
+ uglifier (0.5.4)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+ warden (1.0.4)
+ rack (>= 1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-script
+ devise
+ jquery-rails
+ mysql2
+ rails (= 3.1.0.rc1)
+ rake (!= 0.9.0)
+ sass
+ therubyracer
+ turn
+ uglifier
7 Rakefile
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__)
+
+Tcg::Application.load_tasks
BIN  app/assets/images/colorless.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/common.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/darkness.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/fighting.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/fire.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/grass.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/lightning.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/metal.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/psychic.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/rails.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/rare.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/rare_holo_lv_x.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/tcg.ico
View
Binary file not shown
BIN  app/assets/images/uncommon.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/water.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 app/assets/javascripts/application.js
View
@@ -0,0 +1,9 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
3  app/assets/javascripts/cards.js.coffee
View
@@ -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/
3  app/assets/javascripts/expansions.js.coffee
View
@@ -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/
3  app/assets/javascripts/home.js.coffee
View
@@ -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/
90 app/assets/stylesheets/application.css
View
@@ -0,0 +1,90 @@
+body {
+ background-color:#000000;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ color:#CCCCCC;
+ font-size:12px;
+ padding-top:10px;
+ padding-bottom:20px;
+}
+
+h1,h2,h3,h4{
+ color:#B70000;
+}
+
+.content{
+ background-color: #ebebeb;
+ padding: 5px 15px 15px 15px;
+ color:#000000;
+}
+
+.expansion_table{
+ width:100%;
+}
+
+.expansion_list{
+ width:200px;
+}
+
+a,a:visited{
+ color:#B70000;
+ text-decoration:none;
+}
+
+a:hover{
+ color:#CCCCCC;
+ text-decoration:none;
+}
+
+a.expansion_table,a.expansion_table:visited{
+ color:black;
+ text-decoration:none;
+}
+
+a.expansion_table:hover{
+ color:#B70000;
+ text-decoration:underline;
+}
+
+a.content,a.content:visited{
+ color:black;
+ text-decoration:none;
+}
+
+a.content:hover{
+ color:#B70000;
+ text-decoration:underline;
+}
+
+table{
+ border-style:double;
+ border-color:#FFFF33;
+ color:black;
+}
+
+tr{
+ background-color:white;
+}
+
+tr.is_mine{
+ background-color:#7FFFD4;
+}
+
+tr.i_need_it{
+ background-color:#FF6A6A;
+}
+
+td{
+ text-align:center;
+ font-size:12px;
+}
+
+legend{
+ font-size:18px;
+ font-weight:bold;
+}
+
+
+img
+{
+border-width:0;
+}
5 app/assets/stylesheets/cards.css.scss
View
@@ -0,0 +1,5 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+ You can use Sass (SCSS) here: http://sass-lang.com/
+*/
5 app/assets/stylesheets/expansions.css.scss
View
@@ -0,0 +1,5 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+ You can use Sass (SCSS) here: http://sass-lang.com/
+*/
5 app/assets/stylesheets/home.css.scss
View
@@ -0,0 +1,5 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+ You can use Sass (SCSS) here: http://sass-lang.com/
+*/
58 app/assets/stylesheets/scaffold.css.scss
View
@@ -0,0 +1,58 @@
+body { background-color: #fff; color: #333; }
+
+body, 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, div.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;
+ }
+}
10 app/controllers/application_controller.rb
View
@@ -0,0 +1,10 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+
+ def admin_required
+ unless current_user.is_admin?
+ flash[:error] = "You must be logged in as admin to access this section"
+ redirect_to root_path
+ end
+ end
+end
77 app/controllers/cards_controller.rb
View
@@ -0,0 +1,77 @@
+class CardsController < ApplicationController
+ before_filter :authenticate_user!
+ before_filter :admin_required, :only => [:new,:edit,:create,:update,:destroy]
+
+ def add
+ card = Card.find(params[:id])
+ current_user.cards << card
+ redirect_to card.expansion
+ end
+
+ def remove
+ card = Card.find(params[:id])
+ current_user.cards.delete(card)
+ redirect_to card.expansion
+ end
+
+ # GET /cards/new
+ # GET /cards/new.json
+ def new
+ @card = Card.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @card }
+ end
+ end
+
+ # GET /cards/1/edit
+ def edit
+ @card = Card.find(params[:id])
+ end
+
+ # POST /cards
+ # POST /cards.json
+ def create
+ @card = Card.new(params[:card])
+
+ respond_to do |format|
+ if @card.save
+ format.html { redirect_to @card.expansion, notice: 'Card was successfully created.' }
+ format.json { render json: @card, status: :created, location: @card }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @card.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /cards/1
+ # PUT /cards/1.json
+ def update
+ @card = Card.find(params[:id])
+
+ respond_to do |format|
+ if @card.update_attributes(params[:card])
+ format.html { redirect_to @card.expansion, notice: 'Card was successfully updated.' }
+ format.json { head :ok }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @card.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /cards/1
+ # DELETE /cards/1.json
+ def destroy
+ @card = Card.find(params[:id])
+ expansion = @card.expansion
+ @card.destroy
+
+ respond_to do |format|
+ format.html { redirect_to expansion }
+ format.json { head :ok }
+ end
+ end
+end
96 app/controllers/expansions_controller.rb
View
@@ -0,0 +1,96 @@
+class ExpansionsController < ApplicationController
+ before_filter :authenticate_user!
+ before_filter :admin_required, :only => [:new,:edit,:create,:update,:destroy]
+ # GET /expansions
+ # GET /expansions.json
+ def index
+ @expansions = Expansion.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @expansions }
+ end
+ end
+
+ # GET /expansions/1
+ # GET /expansions/1.json
+ def show
+ @expansion = Expansion.find(params[:id])
+ if params[:login].nil?
+ @user = current_user
+ else
+ @user = User.find_by_login(params[:login])
+ end
+
+ @card = Card.new
+ @card.expansion = @expansion
+
+ @others = []
+ User.all.each{|usr| @others << usr unless usr.id == @user.id }
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @expansion }
+ end
+ end
+
+ # GET /expansions/new
+ # GET /expansions/new.json
+ def new
+ @expansion = Expansion.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @expansion }
+ end
+ end
+
+ # GET /expansions/1/edit
+ def edit
+ @expansion = Expansion.find(params[:id])
+ end
+
+ # POST /expansions
+ # POST /expansions.json
+ def create
+ @expansion = Expansion.new(params[:expansion])
+
+ respond_to do |format|
+ if @expansion.save
+ format.html { redirect_to @expansion, notice: 'Expansion was successfully created.' }
+ format.json { render json: @expansion, status: :created, location: @expansion }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @expansion.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /expansions/1
+ # PUT /expansions/1.json
+ def update
+ @expansion = Expansion.find(params[:id])
+
+ respond_to do |format|
+ if @expansion.update_attributes(params[:expansion])
+ format.html { redirect_to @expansion, notice: 'Expansion was successfully updated.' }
+ format.json { head :ok }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @expansion.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /expansions/1
+ # DELETE /expansions/1.json
+ def destroy
+ @expansion = Expansion.find(params[:id])
+ @expansion.destroy
+
+ respond_to do |format|
+ format.html { redirect_to expansions_url }
+ format.json { head :ok }
+ end
+ end
+end
7 app/controllers/home_controller.rb
View
@@ -0,0 +1,7 @@
+class HomeController < ApplicationController
+ before_filter :authenticate_user!
+ def index
+
+ end
+
+end
2  app/helpers/application_helper.rb
View
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
2  app/helpers/cards_helper.rb
View
@@ -0,0 +1,2 @@
+module CardsHelper
+end
52 app/helpers/expansions_helper.rb
View
@@ -0,0 +1,52 @@
+# encoding: utf-8
+module ExpansionsHelper
+ def rarity_image rarity
+ if rarity == :rare_holo
+ filename = 'rare'
+ else
+ filename = rarity.to_s
+ end
+ (image_tag(filename+'.png')+(rarity == :rare_holo ? 'H' : ''))
+ end
+
+ def type_symbol type
+ if type == :stadium
+ symbol = 'St'
+ elsif type == :trainer
+ symbol = 'T'
+ elsif type == :supporter
+ symbol = 'Su'
+ elsif type == :energy
+ symbol = 'E'
+ elsif type == :special_energy
+ symbol = 'Sp.E'
+ else
+ symbol = image_tag(type.to_s+'.png')
+ end
+ symbol
+ end
+
+ def pop_up_card card
+ window_id = card.expansion.name.gsub('é','e').gsub(' ','-').downcase+'_'+card.expansion_order
+ image_url = "http://pokebeach.com/scans/#{card.expansion.name.gsub('é','e').gsub(' ','-').downcase}/#{card.expansion_order.downcase}-#{card.name.gsub(' ','-').gsub('é','e').downcase}.jpg"
+ link_to card.name, image_url, :onclick => "javascript:open('#{image_url}','#{window_id}','status=no,width=440,height=610');return false;"
+ end
+
+ def card_row_class card,user
+ if(user.id == current_user.id && user.has_card(card))
+ return 'is_mine'
+ elsif user.has_card(card)
+ if current_user.has_card(card)
+ return 'is_mine'
+ else
+ return 'i_need_it'
+ end
+ else
+ return 'doesnt_exist'
+ end
+ end
+
+ def add_remove_card card
+ link_to card.expansion_order, (current_user.has_card(card) ? remove_card_path(card.id) : add_card_path(card.id)) , :confirm => 'Are you sure?'
+ end
+end
2  app/helpers/home_helper.rb
View
@@ -0,0 +1,2 @@
+module HomeHelper
+end
0  app/mailers/.gitkeep
View
No changes.
0  app/models/.gitkeep
View
No changes.
28 app/models/card.rb
View
@@ -0,0 +1,28 @@
+class Card < ActiveRecord::Base
+ belongs_to :expansion
+ has_and_belongs_to_many :users
+
+ validates_presence_of :expansion_order, :name, :rarity, :card_type
+ validates_uniqueness_of :expansion_order, :scope => :expansion
+
+ validates_inclusion_of :rarity, :in => [:common,:uncommon,:rare,:rare_holo,:rare_holo_lv_x]
+ validates_inclusion_of :card_type, :in => [:trainer,:water,:grass,:psychic,:lightning,:darkness,:metal,:fire,:fighting,:colorless,:supporter,:stadium,:energy,:special_energy]
+
+ def rarity
+ value = read_attribute(:rarity)
+ value.nil? ? nil : value.to_sym
+ end
+
+ def rarity= (value)
+ write_attribute(:rarity, value.to_s)
+ end
+
+ def card_type
+ value = read_attribute(:card_type)
+ value.nil? ? nil : value.to_sym
+ end
+
+ def card_type= (value)
+ write_attribute(:card_type, value.to_s)
+ end
+end
10 app/models/expansion.rb
View
@@ -0,0 +1,10 @@
+class Expansion < ActiveRecord::Base
+ validates :name, :presence => true
+ has_many :cards, :dependent => :destroy
+
+ def cards_by_rarity rarity
+ r = []
+ cards.each {|card| r << card if card.rarity == rarity}
+ r
+ end
+end
81 app/models/user.rb
View
@@ -0,0 +1,81 @@
+class User < ActiveRecord::Base
+ has_and_belongs_to_many :cards
+
+ # Include default devise modules. Others available are:
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable
+
+ validates_presence_of :login
+ validates_uniqueness_of :login
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessor :credential
+ attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :credential
+
+ def is_admin?
+ read_attribute(:admin)
+ end
+
+ def has_card test_card
+ cards.each{|card| return true if card.id == test_card.id}
+ return false
+ end
+
+ def cards_of_expansion expansion
+ r = []
+ cards.each{|card| r << card if card.expansion.id == expansion.id}
+ r
+ end
+
+ def cards_of_expansion_and_rarity expansion, rarity
+ r = []
+ cards_of_expansion(expansion).each{|card| r << card if card.rarity == rarity}
+ r
+ end
+
+ protected
+
+ def self.find_for_database_authentication(warden_conditions)
+ conditions = warden_conditions.dup
+ credential = conditions.delete(:credential)
+ where(conditions).where(["lower(login) = :value OR lower(email) = :value", { :value => credential.downcase }]).first
+ end
+
+ def self.send_reset_password_instructions(attributes={})
+ recoverable = find_recoverable_or_initialize_with_errors(reset_password_keys, attributes, :not_found)
+ recoverable.send_reset_password_instructions if recoverable.persisted?
+ recoverable
+ end
+
+ def self.find_recoverable_or_initialize_with_errors(required_attributes, attributes, error=:invalid)
+ (case_insensitive_keys || []).each { |k| attributes[k].try(:downcase!) }
+
+ attributes = attributes.slice(*required_attributes)
+ attributes.delete_if { |key, value| value.blank? }
+
+ if attributes.size == required_attributes.size
+ if attributes.has_key?(:credential)
+ credential = attributes.delete(:credential)
+ record = find_record(credential)
+ else
+ record = where(attributes).first
+ end
+ end
+
+ unless record
+ record = new
+
+ required_attributes.each do |key|
+ value = attributes[key]
+ record.send("#{key}=", value)
+ record.errors.add(key, value.present? ? error : :blank)
+ end
+ end
+ record
+ end
+
+ def self.find_record(credential)
+ where(["login = :value OR email = :value", { :value => credential }]).first
+ end
+end
33 app/views/cards/_form.html.erb
View
@@ -0,0 +1,33 @@
+<%= form_for(@card) do |f| %>
+ <% if @card.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@card.errors.count, "error") %> prohibited this card from being saved:</h2>
+
+ <ul>
+ <% @card.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :expansion_order %><br />
+ <%= f.text_field :expansion_order %>
+ </div>
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="field">
+ <%= f.label :rarity %><br />
+ <%= f.select :rarity, [:common,:uncommon,:rare,:rare_holo,:rare_holo_lv_x] %>
+ </div>
+ <div class="field">
+ <%= f.label :card_type %><br />
+ <%= f.select :card_type, [:trainer,:water,:grass,:psychic,:lightning,:darkness,:metal,:fire,:fighting,:colorless,:supporter,:stadium,:energy,:special_energy] %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
5 app/views/cards/edit.html.erb
View
@@ -0,0 +1,5 @@
+<h1>Editing card</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', @card.expansion %>
21 app/views/expansions/_form.html.erb
View
@@ -0,0 +1,21 @@
+<%= form_for(@expansion) do |f| %>
+ <% if @expansion.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@expansion.errors.count, "error") %> prohibited this expansion from being saved:</h2>
+
+ <ul>
+ <% @expansion.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
6 app/views/expansions/edit.html.erb
View
@@ -0,0 +1,6 @@
+<h1>Editing expansion</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @expansion %> |
+<%= link_to 'Back', expansions_path %>
20 app/views/expansions/index.html.erb
View
@@ -0,0 +1,20 @@
+<center><div style="width:300px;">
+ <h1>Minhas Cole&ccedil;&otilde;es</h1>
+
+ <table class="expansion_list">
+ <% @expansions.each do |expansion| %>
+ <tr>
+ <td><%= link_to expansion.name, expansion, :login => current_user.login %></td>
+ <td><%= expansion.cards.length %></td>
+ <% if current_user.is_admin? %>
+ <td><%= link_to 'Edit', edit_expansion_path(expansion) %></td>
+ <td><%= link_to 'Destroy', expansion, confirm: 'Are you sure?', method: :delete %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ </table>
+ <% if current_user.is_admin? %>
+ <br />
+ <%= link_to 'New Expansion', new_expansion_path %>
+ <% end %>
+</div></center>
5 app/views/expansions/new.html.erb
View
@@ -0,0 +1,5 @@
+<h1>New expansion</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', expansions_path %>
47 app/views/expansions/show.html.erb
View
@@ -0,0 +1,47 @@
+<div align="center">
+ <h1 align="center"><%= @expansion.name %> de <%= @user.login %></h1>
+ <br/>
+ <div align="center" style="margin:0px;padding:0px;width:800px;padding-bottom:40px">
+ <div style="width:500px;float:left;margin-right:20px">
+ <table class="expansion_table">
+ <% @expansion.cards.each_with_index do |card,i| %>
+ <tr class="<%= card_row_class(card,@user)%>">
+ <td><b><%= (@user.id == current_user.id) ? add_remove_card(card) : card.expansion_order %></b></td>
+ <td><%= type_symbol card.card_type %></td>
+ <td><%= pop_up_card card %></td>
+ <td><%= rarity_image card.rarity %></td>
+ <%if current_user.is_admin? %>
+ <td><%= link_to 'Edit', edit_card_path(card) %></td>
+ <td><%= link_to 'Destroy', card, confirm: 'Are you sure?', method: :delete %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ </table>
+ </div>
+ <div style="width:250px;float:left;text-align:left">
+ <div class="content">
+ <% [:common,:uncommon,:rare,:rare_holo,:rare_holo_lv_x].each do |rarity| %>
+ <%= rarity_image rarity %> <b><%= @user.cards_of_expansion_and_rarity(@expansion, rarity).length %>/<%= @expansion.cards_by_rarity(rarity).length %></b>
+ <br/>
+ <% end %>
+ Total: <b><%= @user.cards_of_expansion(@expansion).length %>/<%= @expansion.cards.length %></b>
+ </div>
+ <br/>
+ <div class="content">
+ <h3>Outros jogadores</h3>
+ <ul>
+ <% @others.each do |other| %>
+ <li><%= link_to other.login, {:controller => 'expansions',:action => 'show', :id=> @expansion.id, :login => other.login} %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% if current_user.is_admin? %>
+ <br/>
+ <div class="content">
+ <h3>Novo Card</h3>
+ <%= render 'cards/form' %>
+ </div>
+ <% end %>
+ </div>
+ </div>
+</div>
2  app/views/home/index.html.erb
View
@@ -0,0 +1,2 @@
+<h1>Home#index</h1>
+<p>Find me in app/views/home/index.html.erb</p>
18 app/views/layouts/application.html.erb
View
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Tcg</title>
+ <%= stylesheet_link_tag "application" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+ <h1><%= link_to 'TCG', root_path %></h1>
+ <% if user_signed_in? %>
+ <b>Ol&aacute;, <%= current_user.login %>! :: <%= link_to('sair', destroy_user_session_path) %></b>
+ <% end %>
+ <p id="notice" class="notice"><%= notice %></p>
+ <p class="alert"><%= alert %></p>
+ <%= yield %>
+</body>
+</html>
12 app/views/users/confirmations/new.html.erb
View
@@ -0,0 +1,12 @@
+<h2>Resend confirmation instructions</h2>
+
+<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.email_field :email %></p>
+
+ <p><%= f.submit "Resend confirmation instructions" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
5 app/views/users/mailer/confirmation_instructions.html.erb
View
@@ -0,0 +1,5 @@
+<p>Welcome <%= @resource.email %>!</p>
+
+<p>You can confirm your account through the link below:</p>
+
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
8 app/views/users/mailer/reset_password_instructions.html.erb
View
@@ -0,0 +1,8 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
+
+<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
+
+<p>If you didn't request this, please ignore this email.</p>
+<p>Your password won't change until you access the link above and create a new one.</p>
7 app/views/users/mailer/unlock_instructions.html.erb
View
@@ -0,0 +1,7 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
+
+<p>Click the link below to unlock your account:</p>
+
+<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
16 app/views/users/passwords/edit.html.erb
View
@@ -0,0 +1,16 @@
+<h2>Change your password</h2>
+
+<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
+ <%= devise_error_messages! %>
+ <%= f.hidden_field :reset_password_token %>
+
+ <p><%= f.label :password, "New password" %><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation, "Confirm new password" %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.submit "Change my password" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
12 app/views/users/passwords/new.html.erb
View
@@ -0,0 +1,12 @@
+<h2>Forgot your password?</h2>
+
+<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :credential %><br />
+ <%= f.text_field :credential %></p>
+
+ <p><%= f.submit "Send me reset password instructions" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
28 app/views/users/registrations/edit.html.erb
View
@@ -0,0 +1,28 @@
+<h2>Edit <%= resource_name.to_s.humanize %></h2>
+
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.email_field :email %></p>
+
+ <p><%= f.label :login %><br />
+ <%= f.text_field :login %></p>
+
+ <p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
+ <%= f.password_field :current_password %></p>
+
+ <p><%= f.submit "Update" %></p>
+<% end %>
+
+<h3>Cancel my account</h3>
+
+<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
+
+<%= link_to "Back", :back %>
21 app/views/users/registrations/new.html.erb
View
@@ -0,0 +1,21 @@
+<h2>Sign up</h2>
+
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.email_field :email %></p>
+
+ <p><%= f.label :login %><br />
+ <%= f.text_field :login %></p>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.submit "Sign up" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
17 app/views/users/sessions/new.html.erb
View
@@ -0,0 +1,17 @@
+<h2>Sign in</h2>
+
+<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
+ <p><%= f.label :credential %><br />
+ <%= f.text_field :credential %></p>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <% if devise_mapping.rememberable? -%>
+ <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
+ <% end -%>
+
+ <p><%= f.submit "Sign in" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
25 app/views/users/shared/_links.erb
View
@@ -0,0 +1,25 @@
+<%- if controller_name != 'sessions' %>
+ <%= link_to "Sign in", new_session_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.omniauthable? %>
+ <%- resource_class.omniauth_providers.each do |provider| %>
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
+ <% end -%>
+<% end -%>
12 app/views/users/unlocks/new.html.erb
View
@@ -0,0 +1,12 @@
+<h2>Resend unlock instructions</h2>
+
+<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.email_field :email %></p>
+
+ <p><%= f.submit "Resend unlock instructions" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
4 config.ru
View
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Tcg::Application
49 config/application.rb
View
@@ -0,0 +1,49 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module Tcg
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Please note that JavaScript expansions are *ignored altogether* if the asset
+ # pipeline is enabled (see config.assets.enabled below). Put your defaults in
+ # app/assets/javascripts/application.js in that case.
+ #
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(prototype prototype_ujs)
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+ end
+end
6 config/boot.rb
View
@@ -0,0 +1,6 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
42 config/database.yml
View
@@ -0,0 +1,42 @@
+# MySQL. Versions 4.1 and 5.0 are recommended.
+#
+# Install the MYSQL driver
+# gem install mysql2
+#
+# Ensure the MySQL gem is defined in your Gemfile
+# gem 'mysql2'
+#
+# And be sure to use new-style password hashing:
+# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
+development:
+ adapter: mysql2
+ encoding: utf8
+ reconnect: false
+ database: tcg_development
+ pool: 5
+ username: root
+ password:
+ socket: /var/run/mysqld/mysqld.sock
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ adapter: mysql2
+ encoding: utf8
+ reconnect: false
+ database: tcg_test
+ pool: 5
+ username: root
+ password:
+ socket: /var/run/mysqld/mysqld.sock
+
+production:
+ adapter: mysql2
+ encoding: utf8
+ reconnect: false
+ database: tcg_production
+ pool: 5
+ username: root
+ password:
+ socket: /var/run/mysqld/mysqld.sock
5 config/environment.rb
View
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Tcg::Application.initialize!
33 config/environments/development.rb
View
@@ -0,0 +1,33 @@
+Tcg::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+ config.action_mailer.delivery_method = :smtp
+ config.action_mailer.smtp_settings = {
+ :address => "smtp.gmail.com",
+ :port => 587,
+ :user_name => 'test@gmail.com',
+ :password => '',
+ :authentication => 'plain',
+ :enable_starttls_auto => true }
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+end
52 config/environments/production.rb
View
@@ -0,0 +1,52 @@
+Tcg::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # Code is not reloaded between requests
+ config.cache_classes = true
+
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
+
+ # Compress both stylesheets and JavaScripts
+ config.assets.js_compressor = :uglifier
+ config.assets.css_compressor = :scss
+
+ # Specifies the header that your server uses for sending files
+ # (comment out if your front-end server doesn't support this)
+ config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ # config.assets.precompile += %w( search.js )
+
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+end
39 config/environments/test.rb
View
@@ -0,0 +1,39 @@
+Tcg::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Configure static asset server for tests with Cache-Control for performance
+ config.serve_static_assets = true
+ config.static_cache_control = "public, max-age=3600"
+
+ # Log error messages when you accidentally call methods on nil
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
7 config/initializers/backtrace_silencers.rb
View
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
194 config/initializers/devise.rb
View
@@ -0,0 +1,194 @@
+# Use this hook to configure devise mailer, warden hooks and so forth. The first
+# four configuration values can also be set straight in your models.
+Devise.setup do |config|
+ # ==> Mailer Configuration
+ # Configure the e-mail address which will be shown in DeviseMailer.
+ config.mailer_sender = "volmer@radicaos.com"
+
+ # Configure the class responsible to send e-mails.
+ # config.mailer = "Devise::Mailer"
+
+ # ==> ORM configuration
+ # Load and configure the ORM. Supports :active_record (default) and
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
+ # available as additional gems.
+ require 'devise/orm/active_record'
+
+ # ==> Configuration for any authentication mechanism
+ # Configure which keys are used when authenticating a user. The default is
+ # just :email. You can configure it to use [:username, :subdomain], so for
+ # authenticating a user, both parameters are required. Remember that those
+ # parameters are used only when authenticating and not when retrieving from
+ # session. If you need permissions, you should implement that in a before filter.
+ # You can also supply a hash where the value is a boolean determining whether
+ # or not authentication should be aborted when the value is not present.
+ config.authentication_keys = [ :credential ]
+
+ # Configure parameters from the request object used for authentication. Each entry
+ # given should be a request method and it will automatically be passed to the
+ # find_for_authentication method and considered in your model lookup. For instance,
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
+ # config.request_keys = []
+
+ # Configure which authentication keys should be case-insensitive.
+ # These keys will be downcased upon creating or modifying a user and when used
+ # to authenticate or find a user. Default is :email.
+ config.case_insensitive_keys = [ :email ]
+
+ # Tell if authentication through request.params is enabled. True by default.
+ # config.params_authenticatable = true
+
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
+ # config.http_authenticatable = false
+
+ # If http headers should be returned for AJAX requests. True by default.
+ # config.http_authenticatable_on_xhr = true
+
+ # The realm used in Http Basic Authentication. "Application" by default.
+ # config.http_authentication_realm = "Application"
+
+ # ==> Configuration for :database_authenticatable
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
+ # using other encryptors, it sets how many times you want the password re-encrypted.
+ config.stretches = 10
+
+ # Setup a pepper to generate the encrypted password.
+ # config.pepper = "4be9565539159e17febafc53392343367b953458de091b7e59bb2b6a8d000fe030576db563f16e17274d40250c1ff221e23a2aa731506a3f5b7efab6b5add858"
+
+ # ==> Configuration for :confirmable
+ # The time you want to give your user to confirm his account. During this time
+ # he will be able to access your application without confirming. Default is 0.days
+ # When confirm_within is zero, the user won't be able to sign in without confirming.
+ # You can use this to let your user access some features of your application
+ # without confirming the account, but blocking it after a certain period
+ # (ie 2 days).
+ # config.confirm_within = 2.days
+
+ # Defines which key will be used when confirming an account
+ # config.confirmation_keys = [ :email ]
+
+ # ==> Configuration for :rememberable
+ # The time the user will be remembered without asking for credentials again.
+ # config.remember_for = 2.weeks
+
+ # If true, a valid remember token can be re-used between multiple browsers.
+ # config.remember_across_browsers = true
+
+ # If true, extends the user's remember period when remembered via cookie.
+ # config.extend_remember_period = false
+
+ # If true, uses the password salt as remember token. This should be turned
+ # to false if you are not using database authenticatable.
+ config.use_salt_as_remember_token = true
+
+ # Options to be passed to the created cookie. For instance, you can set
+ # :secure => true in order to force SSL only cookies.
+ # config.cookie_options = {}
+
+ # ==> Configuration for :validatable
+ # Range for password length. Default is 6..128.
+ # config.password_length = 6..128
+
+ # Regex to use to validate the email address
+ # config.email_regexp = /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
+
+ # ==> Configuration for :timeoutable
+ # The time you want to timeout the user session without activity. After this
+ # time the user will be asked for credentials again. Default is 30 minutes.
+ # config.timeout_in = 30.minutes
+
+ # ==> Configuration for :lockable
+ # Defines which strategy will be used to lock an account.
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
+ # :none = No lock strategy. You should handle locking by yourself.
+ # config.lock_strategy = :failed_attempts
+
+ # Defines which key will be used when locking and unlocking an account
+ # config.unlock_keys = [ :email ]
+
+ # Defines which strategy will be used to unlock an account.
+ # :email = Sends an unlock link to the user email
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
+ # :both = Enables both strategies
+ # :none = No unlock strategy. You should handle unlocking by yourself.
+ # config.unlock_strategy = :both
+
+ # Number of authentication tries before locking an account if lock_strategy
+ # is failed attempts.
+ # config.maximum_attempts = 20
+
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
+ # config.unlock_in = 1.hour
+
+ # ==> Configuration for :recoverable
+ #
+ # Defines which key will be used when recovering the password for an account
+ config.reset_password_keys = [ :credential ]
+
+ # Time interval you can reset your password with a reset password key.
+ # Don't put a too small interval or your users won't have the time to
+ # change their passwords.
+ config.reset_password_within = 2.hours
+
+ # ==> Configuration for :encryptable
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
+ # REST_AUTH_SITE_KEY to pepper)
+ # config.encryptor = :sha512
+
+ # ==> Configuration for :token_authenticatable
+ # Defines name of the authentication token params key
+ # config.token_authentication_key = :auth_token
+
+ # If true, authentication through token does not store user in session and needs
+ # to be supplied on each request. Useful if you are using the token as API token.
+ # config.stateless_token = false
+
+ # ==> Scopes configuration
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
+ # "users/sessions/new". It's turned off by default because it's slower if you
+ # are using only default views.
+ config.scoped_views = true
+
+ # Configure the default scope given to Warden. By default it's the first
+ # devise role declared in your routes (usually :user).
+ # config.default_scope = :user
+
+ # Configure sign_out behavior.
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
+ # The default is true, which means any logout action will sign out all active scopes.
+ # config.sign_out_all_scopes = true
+
+ # ==> Navigation configuration
+ # Lists the formats that should be treated as navigational. Formats like
+ # :html, should redirect to the sign in page when the user does not have
+ # access, but formats like :xml or :json, should return 401.
+ #
+ # If you have any extra navigational formats, like :iphone or :mobile, you
+ # should add them to the navigational formats lists.
+ #
+ # The :"*/*" and "*/*" formats below is required to match Internet
+ # Explorer requests.
+ # config.navigational_formats = [:"*/*", "*/*", :html]
+
+ # The default HTTP method used to sign out a resource. Default is :get.
+ # config.sign_out_via = :get
+
+ # ==> OmniAuth
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
+ # up on your models and hooks.
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
+
+ # ==> Warden configuration
+ # If you want to use other strategies, that are not supported by Devise, or
+ # change the failure app, you can configure them inside the config.warden block.
+ #
+ # config.warden do |manager|
+ # manager.failure_app = AnotherApp
+ # manager.intercept_401 = false
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
+ # end
+end
10 config/initializers/inflections.rb
View
@@ -0,0 +1,10 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format
+# (all these examples are active by default):
+# ActiveSupport::Inflector.inflections do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
5 config/initializers/mime_types.rb
View
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register_alias "text/html", :iphone
7 config/initializers/secret_token.rb
View
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+Tcg::Application.config.secret_token = '49536077073285f787711c1b3954a67cd1df2b57a60431c5498a5ae2e90c822b012463bf9115383f9bb8806763b2f75d3bec58e304a77f4cebd3ea3f8d7defa8'
8 config/initializers/session_store.rb
View
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Tcg::Application.config.session_store :cookie_store, key: '_tcg_session'
+
+# Use the database for sessions instead of the cookie-based default,
+# which shouldn't be used to store highly confidential information
+# (create the session table with "rails generate session_migration")
+# Tcg::Application.config.session_store :active_record_store
12 config/initializers/wrap_parameters.rb
View
@@ -0,0 +1,12 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains the settings for ActionController::ParametersWrapper
+# which will be enabled by default in the upcoming version of Ruby on Rails.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActionController::Base.wrap_parameters format: [:json]
+
+# Disable root element in JSON by default.
+if defined?(ActiveRecord)
+ ActiveRecord::Base.include_root_in_json = false
+end
50 config/locales/devise.en.yml
View
@@ -0,0 +1,50 @@
+# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
+
+en:
+ errors:
+ messages:
+ expired: "has expired, please request a new one"
+ not_found: "not found"
+ already_confirmed: "was already confirmed, please try signing in"
+ not_locked: "was not locked"
+ not_saved:
+ one: "1 error prohibited this %{resource} from being saved:"
+ other: "%{count} errors prohibited this %{resource} from being saved:"
+
+ devise:
+ failure:
+ already_authenticated: 'You are already signed in.'
+ unauthenticated: 'You need to sign in or sign up before continuing.'
+ unconfirmed: 'You have to confirm your account before continuing.'
+ locked: 'Your account is locked.'
+ invalid: 'Invalid email or password.'
+ invalid_token: 'Invalid authentication token.'
+ timeout: 'Your session expired, please sign in again to continue.'
+ inactive: 'Your account was not activated yet.'
+ sessions:
+ signed_in: 'Signed in successfully.'
+ signed_out: 'Signed out successfully.'
+ passwords:
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
+ updated: 'Your password was changed successfully. You are now signed in.'
+ confirmations:
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
+ registrations:
+ signed_up: 'Welcome! You have signed up successfully.'
+ inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
+ updated: 'You updated your account successfully.'
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
+ unlocks:
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
+ unlocked: 'Your account was successfully unlocked. You are now signed in.'
+ omniauth_callbacks:
+ success: 'Successfully authorized from %{kind} account.'
+ failure: 'Could not authorize you from %{kind} because "%{reason}".'
+ mailer:
+ confirmation_instructions:
+ subject: 'Confirmation instructions'
+ reset_password_instructions:
+ subject: 'Reset password instructions'
+ unlock_instructions:
+ subject: 'Unlock Instructions'
9 config/locales/en.yml
View
@@ -0,0 +1,9 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ hello: "Hello world"
+ activerecord:
+ attributes:
+ user:
+ credential: "login name or email"
70 config/routes.rb
View
@@ -0,0 +1,70 @@
+Tcg::Application.routes.draw do
+ get "home/index"
+
+ resources :expansions
+ resources :cards do
+ member do
+ get 'add'
+ get 'remove'
+ end
+ end
+
+ devise_for :users
+
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
+
+ # Sample of regular route:
+ match 'expansions/:id/:login' => 'expansions#show'
+ # Keep in mind you can assign values other than :controller and :action
+
+ # Sample of named route:
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
+ # This route can be invoked with purchase_url(:id => product.id)
+
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Sample resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Sample resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Sample resource route with more complex sub-resources
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', :on => :collection
+ # end
+ # end
+
+ # Sample resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ root :to => 'expansions#index'
+
+ # See how all your routes lay out with "rake routes"
+
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
+ # Note: This route will make all actions in every controller accessible via GET requests.
+ # match ':controller(/:action(/:id(.:format)))'
+end
28 db/migrate/20110528171219_devise_create_users.rb
View
@@ -0,0 +1,28 @@
+class DeviseCreateUsers < ActiveRecord::Migration
+ def self.up
+ create_table(:users) do |t|
+ t.database_authenticatable :null => false
+ t.recoverable
+ t.rememberable
+ t.trackable
+
+ # t.encryptable
+ # t.confirmable
+ # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
+ # t.token_authenticatable
+
+
+ t.timestamps
+ end
+
+ add_index :users, :email, :unique => true
+ add_index :users, :reset_password_token, :unique => true
+ # add_index :users, :confirmation_token, :unique => true
+ # add_index :users, :unlock_token, :unique => true
+ # add_index :users, :authentication_token, :unique => true
+ end
+
+ def self.down
+ drop_table :users
+ end
+end
9 db/migrate/20110528171539_create_expansions.rb
View
@@ -0,0 +1,9 @@
+class CreateExpansions < ActiveRecord::Migration
+ def change
+ create_table :expansions do |t|
+ t.string :name
+
+ t.timestamps
+ end
+ end
+end
14 db/migrate/20110528171703_create_cards.rb
View
@@ -0,0 +1,14 @@
+class CreateCards < ActiveRecord::Migration
+ def change
+ create_table :cards do |t|
+ t.string :expansion_order
+ t.string :name
+ t.string :rarity
+ t.string :card_type
+ t.references :expansion
+
+ t.timestamps
+ end
+ add_index :cards, :expansion_id
+ end
+end
5 db/migrate/20110528225127_add_login_to_users.rb
View
@@ -0,0 +1,5 @@
+class AddLoginToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :login, :string
+ end
+end
8 db/migrate/20110529035907_cards_users.rb
View
@@ -0,0 +1,8 @@
+#class CardsUsers < ActiveRecord::Migration
+# def change
+# create_table :cards_users, :id=>false do |t|
+# t.references :card, :null => false
+# t.references :user, :null => false
+# end
+# end
+#end
5 db/migrate/20110529203416_add_admin_to_users.rb
View
@@ -0,0 +1,5 @@
+class AddAdminToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :admin, :boolean
+ end
+end
58 db/schema.rb
View
@@ -0,0 +1,58 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20110529203416) do
+
+ create_table "cards", :force => true do |t|
+ t.string "expansion_order"
+ t.string "name"
+ t.string "rarity"
+ t.string "card_type"
+ t.integer "expansion_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "cards", ["expansion_id"], :name => "index_cards_on_expansion_id"
+
+ create_table "cards_users", :id => false, :force => true do |t|
+ t.integer "card_id", :null => false
+ t.integer "user_id", :null => false
+ end
+
+ create_table "expansions", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "users", :force => true do |t|
+ t.string "email", :default => "", :null => false
+ t.string "encrypted_password", :limit => 128, :default => "", :null => false
+ t.string "reset_password_token"
+ t.datetime "reset_password_sent_at"
+ t.datetime "remember_created_at"
+ t.integer "sign_in_count", :default => 0
+ t.datetime "current_sign_in_at"
+ t.datetime "last_sign_in_at"
+ t.string "current_sign_in_ip"
+ t.string "last_sign_in_ip"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "login"
+ t.boolean "admin"
+ end
+
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
+
+end
7 db/seeds.rb
View
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
+# Mayor.create(name: 'Emanuel', city: cities.first)
2  doc/README_FOR_APP
View
@@ -0,0 +1,2 @@
+Use this README file to introduce your application and point to useful places in the API for learning more.
+Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
0  lib/tasks/.gitkeep
View
No changes.
0  log/.gitkeep
View
No changes.
26 public/404.html
View
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The page you were looking for doesn't exist (404)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/404.html -->
+ <div class="dialog">
+ <h1>The page you were looking for doesn't exist.</h1>
+ <p>You may have mistyped the address or the page may have moved.</p>
+ </div>
+</body>
+</html>
26 public/422.html
View
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The change you wanted was rejected (422)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/422.html -->
+ <div class="dialog">
+ <h1>The change you wanted was rejected.</h1>
+ <p>Maybe you tried to change something you didn't have access to.</p>
+ </div>
+</body>
+</html>
26 public/500.html
View
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>We're sorry, but something went wrong (500)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/500.html -->
+ <div class="dialog">
+ <h1>We're sorry, but something went wrong.</h1>
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
+ </div>
+</body>
+</html>
0  public/favicon.ico
View
No changes.
BIN  public/images/Thumbs.db
View
Binary file not shown
BIN  public/images/colorless.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/common.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/darkness.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/fighting.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/fire.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.