From 74dae9ee3d87ea902720ec6774a779c6791b77f8 Mon Sep 17 00:00:00 2001 From: Kang-Kyu Lee Date: Tue, 2 Jul 2024 00:18:21 -0700 Subject: [PATCH] Add owner name on rounds show page for audiences Add round name on audience vote page Change styling a bit --- app/views/contestants/index.html.erb | 4 +++ app/views/owner/contestants/_votes.html.erb | 0 app/views/owner/contestants/index.html.erb | 11 +++------ app/views/rounds/show.html.erb | 27 ++++++++++++--------- 4 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 app/views/owner/contestants/_votes.html.erb diff --git a/app/views/contestants/index.html.erb b/app/views/contestants/index.html.erb index b2f52c0..1128191 100644 --- a/app/views/contestants/index.html.erb +++ b/app/views/contestants/index.html.erb @@ -1,5 +1,9 @@ <%= turbo_stream_from "audience_contestants" %> +
+

“<%= link_to @round.title, round_path(@round) %>” round contestants

+
+ <%= turbo_frame_tag "contestants" do %> <% if @contestants.any? %> -<% unless current_page?(owner_round_results_path(@round)) %> -
<%= form_with(url: owner_round_contestants_path(@round), method: :post, model: [@round, @round.contestants.build], class: "mt-8 space-y-6") do |f| %>
- <%= f.text_field :name, autofocus: true, required: true, placeholder: "Name", class: "appearance-none rounded-l-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" %> - <%= f.text_field :location, placeholder: "Location", class: "appearance-none rounded-r-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" %> + <%= f.text_field :name, autofocus: true, required: true, placeholder: "Name", class: "appearance-none rounded-l-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm" %> + <%= f.text_field :location, placeholder: "Location", class: "appearance-none rounded-r-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm" %>
- <%= f.submit "Add", class: "group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" %> + <%= f.submit "Add", class: "group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md bg-blue-500 hover:bg-blue-700 text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" %>
<% end %>
- - -<% end %> diff --git a/app/views/rounds/show.html.erb b/app/views/rounds/show.html.erb index fb52917..58b8e01 100644 --- a/app/views/rounds/show.html.erb +++ b/app/views/rounds/show.html.erb @@ -1,16 +1,21 @@

Welcome to “<%= @round.title %>” round

- <% if current_user.owner?(@round) %>
-
-

Owner menu

-
    -
  • <%= link_to "list of audiences", owner_round_audiences_path(@round) %>
  • -
  • <%= link_to "list of contestants", owner_round_contestants_path(@round) %>
  • -
-
+ <% if current_user.owner?(@round) %> +
+

Owner menu

+
    +
  • <%= link_to "list of audiences", owner_round_audiences_path(@round) %>
  • +
  • <%= link_to "list of contestants", owner_round_contestants_path(@round) %>
  • +
+
+ <% else %> +
+

User <%= @round.owner.username %> started it

+ <% if !current_user.audience?(@round) %> + <%= button_to "Join the audience", new_round_audience_path(@round), method: :get, class: "bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4" %> + <% end %> +
+ <% end %>
- <% elsif !current_user.audience?(@round) %> - <%= button_to "Join the audience", new_round_audience_path(@round), method: :get, class: "bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4" %> - <% end %>