@@ -0,0 +1,31 @@
<div class="sticky-top">
<nav class="navbar navbar-expand-lg">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar_burger" aria-controls="navbar_burger" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Left aligned items in navbar-->
<ul class="navbar-nav">
<%= link_to(image_tag('logo.jpeg'), root_path, class: 'navbar-brand col-1') %>
</ul>
<!-- Right aligned items in navbar-->
<div class="collapse navbar-collapse" id="navbar_burger">
<ul class=" nav navbar-nav ml-auto">
<% if logged_in? %>
<li class="nav-item">
<%= link_to fa_icon('shopping-cart', text: 'Buy'), '/adverts', method: :get %>
</li>
<li class="nav-item ml-3">
<%= link_to fa_icon('user-circle', text: 'Profile'), '/profile', method: :get %>
</li>
<li class="nav-item ml-3">
<%= link_to fa_icon('sign-out', text: 'Logout'), '/logout', method: :delete %>
</li>
<% else %>
<li class="nav-item">
<%= link_to fa_icon('sign-in', text: 'Log in'), '/login', method: :get %>
</li>
<% end %>
</ul>
</div>
</nav>
</div>
@@ -1,15 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>TcsApp</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TCS Ticket App</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>

<body>
<%= yield %>
<body class="<%= controller_name %> <%= action_name %>">
<%= render 'layouts/navigation' %>
<div id="main" role="main">
<div class="container">
<div class="content desktop-content">
<div class="row">
<div class="col-md-12">
<%= render 'layouts/messages' %>
<%= yield %>
</div>
</div>
<footer>
</footer>
</div>
</div> <!--! end of .container -->
</div> <!--! end of #main -->
</body>
</html>
@@ -1,5 +1,3 @@
<p id="notice"><%= notice %></p>

<h1>Seasonpasses</h1>

<table>
@@ -1,18 +1,6 @@
<h1>New Seasonpass</h1>

<%= form_for(@seasonpass) do |f| %>
<% if @seasonpass.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@seasonpass.errors.count, "error") %> prohibited this seasonpass from being saved:</h2>

<ul>
<% @seasonpass.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.label :club_id, "Club" %>
<%= f.select :club_id, Club.all.collect { |c| [ c.name, c.id ] }, class: 'form-control' %>
@@ -1,5 +1,3 @@
<p id="notice"><%= notice %></p>

<p>
<strong>User:</strong>
<%= @seasonpass.user.full_name %>
@@ -3,8 +3,6 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= form_for(@user) do |f| %>
<%= render 'shared/error_messages' %>
<%= f.label :first_name %>
<%= f.text_field :first_name, class: 'form-control' %>
@@ -3,16 +3,6 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<div id="errors">
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.label :first_name %>
<%= f.text_field :first_name, class: 'form-control' %>
@@ -22,6 +12,9 @@
<%= f.label :birth_date %>
<%= f.date_select :birth_date, class: 'form-control' %>
<%= f.label :tcs_number %>
<%= f.text_field :tcs_number, class: 'form-control' %>
<%= f.label :email %>
<%= f.email_field :email, class: 'form-control' %>
@@ -1,5 +1,3 @@
<p id="notice"><%= notice %></p>

<p>
<strong>First name:</strong>
<%= @user.first_name %>
@@ -20,6 +18,6 @@
<%= @user.email %>
</p>

<%= link_to 'Seasonpasses', seasonpasses_path %>
<%= link_to 'Seasonpasses', seasonpasses_path %> |
<%= link_to 'Edit', edit_user_path(@user) %> |
<%= link_to 'Back', users_path %>
@@ -1,9 +1,20 @@
Rails.application.routes.draw do
get 'sessions/new'
resources :adverts
root 'sessions#new'
resources :adverts, only: [:index, :show, :new, :create, :destroy]
resources :games
resources :seasonpasses
resources :clubs
resources :seasonpasses do
collection do
get :index
get :new
post :create
end
member do
get :show
post :buy
end
end
resources :clubs, only: [:show]
resources :users

get '/login', to: 'sessions#new'
@@ -0,0 +1,5 @@
class AddTcsNumberToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :tcs_number, :string
end
end
@@ -0,0 +1,5 @@
class AddHashcodeToAdverts < ActiveRecord::Migration[5.2]
def change
add_column :adverts, :hashcode, :string
end
end
@@ -10,14 +10,15 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2018_08_24_235711) do
ActiveRecord::Schema.define(version: 2018_08_25_132259) do

create_table "adverts", force: :cascade do |t|
t.integer "seasonpass_id"
t.integer "game_id"
t.integer "sold_to_user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "hashcode"
t.index ["game_id"], name: "index_adverts_on_game_id"
t.index ["seasonpass_id"], name: "index_adverts_on_seasonpass_id"
t.index ["sold_to_user_id"], name: "index_adverts_on_sold_to_user_id"
@@ -56,6 +57,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "password_digest"
t.string "tcs_number"
end

end