From 181e878316e8e55b8fafa25e83b161a9f9c6334c Mon Sep 17 00:00:00 2001 From: Evan Burkey Date: Mon, 3 Feb 2025 15:07:16 -0800 Subject: [PATCH] alts --- app/assets/stylesheets/application.css | 15 ------- app/models/player.rb | 6 ++- app/views/game/index.html.erb | 1 + app/views/leaderboard/index.html.erb | 2 +- app/views/player/show.html.erb | 56 ++++++++++++++++++-------- config/routes.rb | 2 +- 6 files changed, 46 insertions(+), 36 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index b76295b..4607609 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -197,21 +197,6 @@ a:visited { 0 0 50px #b16286, 0 0 60px #b16286, 0 0 70px #b16286; - - /* Animation for bouncing/moving effect */ - animation: bounce 1.5s ease infinite alternate; -} - -@keyframes bounce { - 0% { - transform: translateY(0) rotate(0deg); - } - 50% { - transform: translateY(-10px) rotate(5deg); - } - 100% { - transform: translateY(0) rotate(-5deg); - } } select { diff --git a/app/models/player.rb b/app/models/player.rb index 86c1059..f6b20db 100644 --- a/app/models/player.rb +++ b/app/models/player.rb @@ -35,8 +35,10 @@ class Player < ApplicationRecord self.main_player end - def alts_concat - self.alternate_players.map(&:name).join(", ") + def main_name + if alt? + self.main_player.name + end end def no_circular_references diff --git a/app/views/game/index.html.erb b/app/views/game/index.html.erb index b67daf8..5bbca9f 100644 --- a/app/views/game/index.html.erb +++ b/app/views/game/index.html.erb @@ -28,4 +28,5 @@ <% else %>

No recent games

+ Leaderboard <% end %> \ No newline at end of file diff --git a/app/views/leaderboard/index.html.erb b/app/views/leaderboard/index.html.erb index ad3d3fa..3cc14e5 100644 --- a/app/views/leaderboard/index.html.erb +++ b/app/views/leaderboard/index.html.erb @@ -24,7 +24,7 @@ <% @players.each do |player| %>
-
<%= player.name %>
+
<%= link_to player.name, player_path(player) %>
<%= player.total_purse %>
<%= player.total_wins %>
<%= player.total_losses %>
diff --git a/app/views/player/show.html.erb b/app/views/player/show.html.erb index cd634c6..2748dcc 100644 --- a/app/views/player/show.html.erb +++ b/app/views/player/show.html.erb @@ -1,20 +1,42 @@

<%= @player.name %>

- - - - - - - - - <% @player.each do |game| %> - - - - - - +
+
+
+
Name
+
Purse
+
Wins
+
Losses
+
+
+
<%= @player.name %>
+
<%= @player.total_purse %>
+
<%= @player.total_wins %>
+
<%= @player.total_losses %>
+
+
+ + <% if @player.alternate_players.count > 0 %> +

Alts

+
+
+
Alt
+
Purse
+
Wins
+
Losses
+
+ <% @player.alternate_players.each do |alt| %> +
+
<%= link_to alt.name, player_path(alt) %>
+
<%= alt.total_purse %>
+
<%= alt.total_wins %>
+
<%= alt.total_losses %>
+
+ <% end %> +
+ <% elsif @player.alt? %> +

Alt Status

+

<%= @player.name %> is set as an alt of <%= link_to @player.main_name, player_path(@player.main_player) %>

<% end %> -
-
PlayerPurseWinsLosses
<% @player.name %><% @player.purse %><% @player.wins %><% @player.losses %>
\ No newline at end of file + Leaderboard +
diff --git a/config/routes.rb b/config/routes.rb index 3460f26..bea0bd0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,7 +15,7 @@ Rails.application.routes.draw do resources :game, only: [ :create ], defaults: { format: :json } # Player - get "player/:id", to: "player#show" + resources :player, only: [ :show ] # Leaderboard get "leaderboard", to: "leaderboard#index", as: "leaderboard", defaults: { format: :html }