Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
376 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Bids controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Buys controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class BidsController < InheritedResources::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class BuysController < InheritedResources::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
class PredictionsController < InheritedResources::Base | ||
def create | ||
params[:user_id] = current_user.id | ||
create! | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module BidsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module BuysHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Bid < ActiveRecord::Base | ||
attr_accessible :price, :user_id | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Buy < ActiveRecord::Base | ||
attr_accessible :prediction_id, :price, :user_id | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
= form_for @bid do |f| | ||
- if @bid.errors.any? | ||
#error_explanation | ||
%h2= "#{pluralize(@bid.errors.count, "error")} prohibited this bid from being saved:" | ||
%ul | ||
- @bid.errors.full_messages.each do |msg| | ||
%li= msg | ||
|
||
.field | ||
= f.label :price | ||
= f.text_field :price | ||
.field | ||
= f.label :user_id | ||
= f.number_field :user_id | ||
.actions | ||
= f.submit 'Save' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%h1 Editing bid | ||
|
||
= render 'form' | ||
|
||
= link_to 'Show', @bid | ||
\| | ||
= link_to 'Back', bids_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
%h1 Listing bids | ||
|
||
%table | ||
%tr | ||
%th Price | ||
%th User | ||
%th | ||
%th | ||
%th | ||
|
||
- @bids.each do |bid| | ||
%tr | ||
%td= bid.price | ||
%td= bid.user_id | ||
%td= link_to 'Show', bid | ||
%td= link_to 'Edit', edit_bid_path(bid) | ||
%td= link_to 'Destroy', bid, :method => :delete, :data => { :confirm => 'Are you sure?' } | ||
|
||
%br | ||
|
||
= link_to 'New Bid', new_bid_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
%h1 New bid | ||
|
||
= render 'form' | ||
|
||
= link_to 'Back', bids_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
%p#notice= notice | ||
|
||
%p | ||
%b Price: | ||
= @bid.price | ||
%p | ||
%b User: | ||
= @bid.user_id | ||
|
||
= link_to 'Edit', edit_bid_path(@bid) | ||
\| | ||
= link_to 'Back', bids_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
= form_for @buy do |f| | ||
- if @buy.errors.any? | ||
#error_explanation | ||
%h2= "#{pluralize(@buy.errors.count, "error")} prohibited this buy from being saved:" | ||
%ul | ||
- @buy.errors.full_messages.each do |msg| | ||
%li= msg | ||
|
||
.field | ||
= f.label :price | ||
= f.text_field :price | ||
.field | ||
= f.label :user_id | ||
= f.number_field :user_id | ||
.field | ||
= f.label :prediction_id | ||
= f.number_field :prediction_id | ||
.actions | ||
= f.submit 'Save' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%h1 Editing buy | ||
|
||
= render 'form' | ||
|
||
= link_to 'Show', @buy | ||
\| | ||
= link_to 'Back', buys_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
%h1 Listing buys | ||
|
||
%table | ||
%tr | ||
%th Price | ||
%th User | ||
%th Prediction | ||
%th | ||
%th | ||
%th | ||
|
||
- @buys.each do |buy| | ||
%tr | ||
%td= buy.price | ||
%td= buy.user_id | ||
%td= buy.prediction_id | ||
%td= link_to 'Show', buy | ||
%td= link_to 'Edit', edit_buy_path(buy) | ||
%td= link_to 'Destroy', buy, :method => :delete, :data => { :confirm => 'Are you sure?' } | ||
|
||
%br | ||
|
||
= link_to 'New Buy', new_buy_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
%h1 New buy | ||
|
||
= render 'form' | ||
|
||
= link_to 'Back', buys_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%p#notice= notice | ||
|
||
%p | ||
%b Price: | ||
= @buy.price | ||
%p | ||
%b User: | ||
= @buy.user_id | ||
%p | ||
%b Prediction: | ||
= @buy.prediction_id | ||
|
||
= link_to 'Edit', edit_buy_path(@buy) | ||
\| | ||
= link_to 'Back', buys_path |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
!!! | ||
%html | ||
%head | ||
%title BitPredictor | ||
= stylesheet_link_tag "application", :media => "all" | ||
= javascript_include_tag "application" | ||
= csrf_meta_tags | ||
%body | ||
%p.notice= notice | ||
%p.alert= alert | ||
- if !current_user | ||
= link_to "Sign in with Facebook", user_omniauth_authorize_path(:facebook) | ||
- else | ||
Hi, #{current_user.name} | ||
= yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CreateBids < ActiveRecord::Migration | ||
def change | ||
create_table :bids do |t| | ||
t.decimal :price | ||
t.integer :user_id | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddUserIdToPredictions < ActiveRecord::Migration | ||
def change | ||
add_column :predictions, :user_id, :integer | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddPublicKeyToUsers < ActiveRecord::Migration | ||
def change | ||
add_column :users, :public_key, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddPredictionIdToBids < ActiveRecord::Migration | ||
def change | ||
add_column :bids, :prediction_id, :integer | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateBuys < ActiveRecord::Migration | ||
def change | ||
create_table :buys do |t| | ||
t.decimal :price | ||
t.integer :user_id | ||
t.integer :prediction_id | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html | ||
|
||
one: | ||
price: 9.99 | ||
user_id: 1 | ||
|
||
two: | ||
price: 9.99 | ||
user_id: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html | ||
|
||
one: | ||
price: 9.99 | ||
user_id: 1 | ||
prediction_id: 1 | ||
|
||
two: | ||
price: 9.99 | ||
user_id: 1 | ||
prediction_id: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require 'test_helper' | ||
|
||
class BidsControllerTest < ActionController::TestCase | ||
setup do | ||
@bid = bids(:one) | ||
end | ||
|
||
test "should get index" do | ||
get :index | ||
assert_response :success | ||
assert_not_nil assigns(:bids) | ||
end | ||
|
||
test "should get new" do | ||
get :new | ||
assert_response :success | ||
end | ||
|
||
test "should create bid" do | ||
assert_difference('Bid.count') do | ||
post :create, bid: { price: @bid.price, user_id: @bid.user_id } | ||
end | ||
|
||
assert_redirected_to bid_path(assigns(:bid)) | ||
end | ||
|
||
test "should show bid" do | ||
get :show, id: @bid | ||
assert_response :success | ||
end | ||
|
||
test "should get edit" do | ||
get :edit, id: @bid | ||
assert_response :success | ||
end | ||
|
||
test "should update bid" do | ||
put :update, id: @bid, bid: { price: @bid.price, user_id: @bid.user_id } | ||
assert_redirected_to bid_path(assigns(:bid)) | ||
end | ||
|
||
test "should destroy bid" do | ||
assert_difference('Bid.count', -1) do | ||
delete :destroy, id: @bid | ||
end | ||
|
||
assert_redirected_to bids_path | ||
end | ||
end |
Oops, something went wrong.