[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignoredev #22

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
df52921
Adds homepage, set root and view, and adds normalize CSS to app CSS a…
rdfm Feb 15, 2017
af831df
Merge pull request #2 from georgebabayan/homepage
jonbent Feb 15, 2017
57e97fb
adds bcrypt to app, adds some seeds
jonbent Feb 15, 2017
f8623ee
Merge branch 'dev' of https://github.com/georgebabayan/multiplayer-ba…
jonbent Feb 15, 2017
c578880
adds associations for all classes, adds less hardcoded board
jonbent Feb 15, 2017
f482a01
adds game association to rounds
jonbent Feb 15, 2017
09a0962
Merge pull request #4 from georgebabayan/jonbent
rdfm Feb 15, 2017
462de55
Merge branch 'dev' of https://github.com/georgebabayan/multiplayer-ba…
amber-nash Feb 15, 2017
c5644fb
fixes seeds, comment out destroys on first seed
jonbent Feb 15, 2017
b42c1f5
Merge pull request #5 from georgebabayan/jonbent
jonbent Feb 15, 2017
fddce95
Create resource/routes for user.
amber-nash Feb 16, 2017
944919c
Create controller for user.
amber-nash Feb 16, 2017
81b6e8e
Create views for user.
amber-nash Feb 16, 2017
058219b
Create navbar for new users.
amber-nash Feb 16, 2017
6637da1
Update form field type password for security.
amber-nash Feb 16, 2017
bfa11df
Initial build of sessions controller/helper.
amber-nash Feb 16, 2017
b151614
Adds board layout, and background image
rdfm Feb 16, 2017
563c587
Merge pull request #6 from georgebabayan/board_view
amber-nash Feb 16, 2017
93ec92d
Merge branch 'dev' of https://github.com/georgebabayan/multiplayer-ba…
amber-nash Feb 16, 2017
4479825
Merge pull request #8 from georgebabayan/users-login
jonbent Feb 16, 2017
02201fe
fixes some database issues, and adds some logic to rounds model
jonbent Feb 16, 2017
af4197e
Merge branch 'dev' into jonbent
jonbent Feb 16, 2017
34022a5
Update schema.rb
jonbent Feb 16, 2017
63308cf
Update seeds.rb
jonbent Feb 16, 2017
54c95da
Merge pull request #9 from georgebabayan/jonbent
jonbent Feb 16, 2017
d08b62a
Plural sessions_helper file name.
amber-nash Feb 16, 2017
897bbc7
Merge pull request #10 from georgebabayan/users-login
jonbent Feb 16, 2017
6c64727
fixes some minor bugs, adds back serializing for json
jonbent Feb 16, 2017
576d25b
Merge pull request #11 from georgebabayan/jonbent
amber-nash Feb 16, 2017
75a367e
Add logic to sheep
georgebabayan Feb 16, 2017
5d48161
Add logic for user
georgebabayan Feb 16, 2017
deb158a
Add logic for sheep++
georgebabayan Feb 16, 2017
ee6afe1
Create custom routes for sessions, and login view.
amber-nash Feb 16, 2017
26c7f79
Fix bugs with user registration, add errors.
amber-nash Feb 16, 2017
83f00d2
Create errors partial for user.
amber-nash Feb 16, 2017
f9f72e2
Merge pull request #12 from georgebabayan/sheep_shooter
jonbent Feb 16, 2017
f424bb4
Add ships
georgebabayan Feb 16, 2017
be23fc0
Change param term, add password verify/validation feature to reg.
amber-nash Feb 16, 2017
93ab46b
Merge pull request #13 from georgebabayan/sheep_shooter
georgebabayan Feb 16, 2017
81e0dee
Fix incorrect login form_tag param and update login custom routes.
amber-nash Feb 16, 2017
7c1fc1a
Create partial for failed login error messages.
amber-nash Feb 16, 2017
8f1fe7d
Correct user show page link_to path.
amber-nash Feb 16, 2017
d9e5c80
Add gitignore file.
amber-nash Feb 16, 2017
480970a
Fix merge conflict.
amber-nash Feb 16, 2017
f073448
Merge pull request #14 from georgebabayan/users-login
rdfm Feb 16, 2017
d0787e3
Add hirb and fit checker
georgebabayan Feb 16, 2017
de4636d
Add new conflit
georgebabayan Feb 16, 2017
95f5a1b
fixes database and stuff
georgebabayan Feb 16, 2017
1781c6d
fixed seed
georgebabayan Feb 16, 2017
29c5bec
Merge pull request #18 from georgebabayan/sheep_shooter
georgebabayan Feb 16, 2017
9754463
Add title page image.
amber-nash Feb 16, 2017
52624ba
Reconfigure .gititnore file cause GEORGE.
amber-nash Feb 16, 2017
3157bde
Add alot of Jon's mistakes
georgebabayan Feb 16, 2017
d92f470
Merge pull request #19 from georgebabayan/db_master
georgebabayan Feb 16, 2017
4693b6c
Merge pull request #20 from georgebabayan/styling
amber-nash Feb 16, 2017
990f826
Add logic for diplay sheep and Chat
georgebabayan Feb 17, 2017
4ca8759
Add ignore git
georgebabayan Feb 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add alot of Jon's mistakes
  • Loading branch information
georgebabayan committed Feb 16, 2017
commit 3157bde1f221fefafa7c4da1a9653e3a36f6f943
17 changes: 17 additions & 0 deletions app/controllers/games_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class GamesController < ApplicationController
def index
@games = Game.all
end

def show
@game = Game.find(params[:id])
@messages = @game.conversation.messages
@message = Message.new

end

def new
@message = Message.new
end

end
13 changes: 13 additions & 0 deletions app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class MessagesController < ApplicationController
def new
@message = Message.new
end

def create
@message = Message.new(params[:message][:text], user: current_user, conversation: params[:game])

if @message.save
redirect_to "/games/1"
end
end
end
7 changes: 0 additions & 7 deletions app/controllers/rounds_controller.rb

This file was deleted.

6 changes: 6 additions & 0 deletions app/controllers/sides_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class SidesController < ApplicationController
def index
@side = Side.first
@board = @side.board
end
end
5 changes: 2 additions & 3 deletions app/controllers/static_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class StaticController < ApplicationController
def homepage
@round = Round.first
@board = @round.board.to_a
@side = Side.first
@board = @side.board.to_a
end
end

6 changes: 3 additions & 3 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def update
end

def destroy
@user.destroy
redirect_to root_path
end
@user.destroy
redirect_to root_path
end

private

Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
module ApplicationHelper
include SessionsHelper
end
5 changes: 5 additions & 0 deletions app/models/conversation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Conversation < ApplicationRecord
has_many :messages
has_many :users, through: :messages
belongs_to :game
end
1 change: 1 addition & 0 deletions app/models/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ class Game < ApplicationRecord
has_many :users, through: :rounds
belongs_to :winner, class_name: "User", foreign_key: "winner_id"
belongs_to :loser, class_name: "User", foreign_key: "loser_id"
has_one :conversation
end
4 changes: 4 additions & 0 deletions app/models/message.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Message < ApplicationRecord
belongs_to :conversation
belongs_to :user
end
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class User < ApplicationRecord
has_secure_password
has_many :games
has_many :sides
has_many :messages

validates :username, presence: true
validates :username, uniqueness: true
Expand Down
8 changes: 8 additions & 0 deletions app/views/games/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<h1> GAME ! </h1>


<% @games.each do |game| %>
<%= game.name %>
<%= game.created_at %>
<a href="/games/<%= game.id %>"> click me </a>
<% end %>
20 changes: 20 additions & 0 deletions app/views/games/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<h1> SHOW ! </h1>


<div>
<% @messages.each do |message| %>
<%= message.text %>
<% end %>
</div>

<div class="form">
<%= form_for @message do |f| %>
<%= f.label :text %><br>
<%= f.text_field :text %><br>
<% f.hidden @game %><br>

<br>
<%= f.submit %>
<% end %>

</div>
4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Rails.application.routes.draw do

resources :users
resources :games
resources :messages



get '/login', to: 'sessions#new', as: 'login'
post '/login', to: 'sessions#create'
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20170216215849_create_conversations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateConversations < ActiveRecord::Migration[5.0]
def change
create_table :conversations do |t|

t.references :game, foreign_key: true
t.timestamps
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20170216221541_create_messages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateMessages < ActiveRecord::Migration[5.0]
def change
create_table :messages do |t|
t.string :text
t.references :user, foreign_key: true
t.references :conversation, foreign_key: true

t.timestamps
end
end
end
5 changes: 5 additions & 0 deletions db/migrate/20170216222106_add_game_name_to_games.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddGameNameToGames < ActiveRecord::Migration[5.0]
def change
add_column :games, :name, :string
end
end
75 changes: 75 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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 that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170216222106) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "conversations", force: :cascade do |t|
t.integer "game_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["game_id"], name: "index_conversations_on_game_id", using: :btree
end

create_table "games", force: :cascade do |t|
t.integer "winner_id"
t.integer "loser_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name"
end

create_table "messages", force: :cascade do |t|
t.string "text"
t.integer "user_id"
t.integer "conversation_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["conversation_id"], name: "index_messages_on_conversation_id", using: :btree
t.index ["user_id"], name: "index_messages_on_user_id", using: :btree
end

create_table "sides", force: :cascade do |t|
t.integer "user_id"
t.text "board"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "game_id"
t.index ["game_id"], name: "index_sides_on_game_id", using: :btree
t.index ["user_id"], name: "index_sides_on_user_id", using: :btree
end

create_table "stages", force: :cascade do |t|
t.integer "game_id"
t.text "player1_move"
t.text "player2_move"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["game_id"], name: "index_stages_on_game_id", using: :btree
end

create_table "users", force: :cascade do |t|
t.string "username"
t.string "password_digest"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

add_foreign_key "conversations", "games"
add_foreign_key "messages", "conversations"
add_foreign_key "messages", "users"
add_foreign_key "sides", "games"
add_foreign_key "sides", "users"
add_foreign_key "stages", "games"
end
Loading