Improve show contest buttons
Some checks failed
CI / scan_ruby (push) Failing after 15s
CI / scan_js (push) Successful in 10s
CI / lint (push) Successful in 11s
CI / test (push) Successful in 29s

This commit is contained in:
sto 2025-05-14 15:17:42 +02:00
parent 3a8517e637
commit 138fe67baa
3 changed files with 19 additions and 15 deletions

View File

@ -13,6 +13,8 @@ class ContestsController < ApplicationController
authorize @contest
@title = I18n.t("contests.show.title", name: @contest.name)
@action_name = "Edit"
@action_path = edit_contest_path(@contest)
@contestants = @contest.contestants.order(:name)
@puzzles = @contest.puzzles.order(:id)
@messages = @contest.messages.order(:id)

View File

@ -9,9 +9,6 @@
.row.mb-4
.col
.float-end
a.btn.btn-primary href=edit_contest_path(@contest)
| Edit contest
p
= t("contests.show.public_scoreboard")
= link_to root_url + "public/#{@contest.slug}", root_url + "public/#{@contest.slug}"
@ -20,7 +17,10 @@
.col-6
.row
.col
h4 = t("puzzles.plural").capitalize
h4
= t("puzzles.plural").capitalize
a.ms-3.btn.btn-primary href=new_contest_puzzle_path(@contest) style="margin-top: -3px"
= t("contests.show.add_puzzle")
table.table.table-striped.table-hover
thead
tr
@ -42,10 +42,6 @@
td
a.btn.btn-sm.btn-secondary href=edit_contest_puzzle_path(@contest, puzzle)
| Edit
.row
.col
a.btn.btn-primary href=new_contest_puzzle_path(@contest)
= t("contests.show.add_puzzle")
- if @messages
.row.mt-5
.col
@ -64,13 +60,19 @@
= message.time_seconds
td
= message.text
td
a.btn.btn-sm.btn-secondary href="" style="white-space: nowrap;"
| Add completion
td
a.btn.btn-sm.btn-danger href=""
| Delete
.col-6
.row
.col
h4 = t("contestants.plural").capitalize
h4
= t("contestants.plural").capitalize
a.ms-3.btn.btn-primary href=new_contest_contestant_path(@contest) style="margin-top: -3px"
= t("contests.show.add_participant")
table.table.table-striped.table-hover
thead
tr
@ -88,9 +90,5 @@
td
a.btn.btn-sm.btn-secondary href=edit_contest_contestant_path(@contest, contestant)
| Open
a.btn.btn-sm.btn-secondary.ms-2 href=new_contest_completion_path(@contest, contestant_id: contestant.id)
a.btn.btn-sm.btn-secondary.ms-3 href=new_contest_completion_path(@contest, contestant_id: contestant.id)
| Add completion
.row.mt-4
.col
a.btn.btn-primary href=new_contest_contestant_path(@contest)
= t("contests.show.add_participant")

View File

@ -16,6 +16,10 @@ html
= t("nav.settings")
= button_to t("nav.log_out"), session_path, method: :delete
h1.mb-4 = @title
h1.mb-4
= @title
- if @action_path
a.ms-3.btn.btn-primary href=@action_path style="margin-top: -4px"
= @action_name
= yield