Exploratory dev custom host. Prep reintro of thirteen tien len
This commit is contained in:
parent
d3481526a2
commit
e8599242ee
@ -31,6 +31,8 @@ class TablesController < ApplicationController
|
|||||||
# GET /tables/1
|
# GET /tables/1
|
||||||
# GET /tables/1.json
|
# GET /tables/1.json
|
||||||
def show
|
def show
|
||||||
|
authorize @table
|
||||||
|
if @game
|
||||||
authorize @game
|
authorize @game
|
||||||
# TODO refactor to ensure play for 2nd and 3rd place
|
# TODO refactor to ensure play for 2nd and 3rd place
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ class TablesController < ApplicationController
|
|||||||
@game.save
|
@game.save
|
||||||
@game.reload
|
@game.reload
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_game
|
def new_game
|
||||||
|
|||||||
@ -13,7 +13,7 @@ class Table < ActiveRecord::Base
|
|||||||
|
|
||||||
#TODO: Should these be part of Game initialize instead of callback?
|
#TODO: Should these be part of Game initialize instead of callback?
|
||||||
after_create :add_seats
|
after_create :add_seats
|
||||||
after_create :add_game
|
# after_create :add_game
|
||||||
|
|
||||||
# Returns the newest joinable table or creates a new table if none are found
|
# Returns the newest joinable table or creates a new table if none are found
|
||||||
# scope :play_now, lambda { |user|
|
# scope :play_now, lambda { |user|
|
||||||
|
|||||||
@ -26,6 +26,10 @@ class SeatPolicy
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stand?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
def sit?
|
def sit?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class TablePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index?
|
def index?
|
||||||
@current_user.admin?
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def show?
|
def show?
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class UserPolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show?
|
def show?
|
||||||
@current_user.admin? || @current_user == @user || @user.admin?
|
@current_user.admin? || @current_user == @user
|
||||||
end
|
end
|
||||||
|
|
||||||
def update?
|
def update?
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
|
<%# <% if current_user.signed_in? %1> %>
|
||||||
|
<%# <li><%= link_to 'My Zone', user_path(current_user), data: { turbo: false } %1></li> %>
|
||||||
|
<%# <% end %1> %>
|
||||||
<li><%= link_to 'Public', root_path, data: { turbo: false } %></li>
|
<li><%= link_to 'Public', root_path, data: { turbo: false } %></li>
|
||||||
<li><%= link_to 'Tokens', tokens_path %></li>
|
<li><%= link_to 'Tokens', tokens_path %></li>
|
||||||
<li><%= link_to 'Profiles', profiles_path %></li>
|
<li><%= link_to 'Profiles', profiles_path %></li>
|
||||||
<li><%= link_to 'Projects', projects_path %></li>
|
<li><%= link_to 'Projects', projects_path %></li>
|
||||||
<li><%= link_to 'Doodads', doodads_path, data: { turbo: false } %></li>
|
<li><%= link_to 'Doodads', doodads_path, data: { turbo: false } %></li>
|
||||||
<% if !request.base_url.match(/pin|my|fireside/) %>
|
|
||||||
<% if policy(:table).index? %>
|
<% if policy(:table).index? %>
|
||||||
<li><%= link_to 'Tables', tables_path %></li>
|
<li><%= link_to 'Tables', tables_path %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
|
||||||
<% if current_user.signed_in? %>
|
<% if current_user.signed_in? %>
|
||||||
<% if current_user.admin? %>
|
<% if current_user.admin? %>
|
||||||
<%# <li><%= link_to 'Admin', '/admin' %1></li> %>
|
|
||||||
<li><%= link_to 'Users', users_path %></li>
|
<li><%= link_to 'Users', users_path %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#play-to-beat
|
- if @game
|
||||||
|
#play-to-beat
|
||||||
%h4 Hand to beat:
|
%h4 Hand to beat:
|
||||||
- if @game.play_to_beat == nil
|
- if @game.play_to_beat == nil
|
||||||
None
|
None
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
- @game = seat.game
|
- if seat
|
||||||
.seat{class: "position-#{@seats.index(seat) + 1}"}
|
- @game = seat.game
|
||||||
|
.seat{class: "position-#{@seats.index(seat) + 1}"}
|
||||||
.seat-controls
|
.seat-controls
|
||||||
- if seat.occupied?
|
- if seat.occupied?
|
||||||
- if seat.player.is_bot?
|
- if seat.player.try("is_bot?")
|
||||||
-# = button_to remove_bot_seat_path(seat) do
|
-# = button_to remove_bot_seat_path(seat) do
|
||||||
- "- Bot"
|
- "- Bot"
|
||||||
- if seat.occupied_by? current_user
|
- if seat.occupied_by? current_user
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
%h1 Listing tables
|
%h1 Listing tables
|
||||||
|
|
||||||
.button= link_to 'New Table', new_table_path
|
- if policy(:table).new?
|
||||||
|
.button= link_to 'New Table', new_table_path
|
||||||
|
|
||||||
.tables-container
|
.tables-container
|
||||||
- @tables.each do |table|
|
- @tables.each do |table|
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
= button_to 'Rename', edit_table_path(@table), class: "smallbtn", method: :get
|
= button_to 'Rename', edit_table_path(@table), class: "smallbtn", method: :get
|
||||||
= button_to 'Delete', @game, :method => :delete, :data => { :confirm => 'Are you sure?' }, class: "smallbtn"
|
= button_to 'Delete', @game, :method => :delete, :data => { :confirm => 'Are you sure?' }, class: "smallbtn"
|
||||||
|
|
||||||
- if @game.already_has?(current_user)
|
- if @game && @game.already_has?(current_user)
|
||||||
- if @game.startable?
|
- if @game.startable?
|
||||||
= button_to 'Start', start_game_path(@game)
|
= button_to 'Start', start_game_path(@game)
|
||||||
|
|
||||||
@ -40,7 +40,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
#game-component
|
#game-component
|
||||||
- if @game.winner_player_id
|
- if @game && @game.winner_player_id
|
||||||
%h1= @game.status
|
%h1= @game.status
|
||||||
|
|
||||||
#playerList
|
#playerList
|
||||||
|
|||||||
@ -74,4 +74,5 @@ Rails.application.configure do
|
|||||||
# Uncomment if you wish to allow Action Cable access from any origin.
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||||
# config.action_cable.disable_request_forgery_protection = true
|
# config.action_cable.disable_request_forgery_protection = true
|
||||||
config.hosts << "pineapple.punked.us"
|
config.hosts << "pineapple.punked.us"
|
||||||
|
config.hosts << "theneedfuldo.tendy.zone"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -58,6 +58,12 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
constraints query_string: /website=theneedfuldo/ do
|
||||||
|
root to: 'doodads#index', as: :needful_root
|
||||||
|
end
|
||||||
|
constraints host: 'theneedfuldo.tendy.zone' do
|
||||||
|
root to: 'projects#show', id: 2, as: :needful_host_root
|
||||||
|
end
|
||||||
root to: 'visitors#index'
|
root to: 'visitors#index'
|
||||||
get '/play-now', to: 'tables#play_now', as: 'play_now'
|
get '/play-now', to: 'tables#play_now', as: 'play_now'
|
||||||
get '/tutorial', to: 'tables#tutorial', as: 'tutorial'
|
get '/tutorial', to: 'tables#tutorial', as: 'tutorial'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user