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 authorize @contest
@title = I18n.t("contests.show.title", name: @contest.name) @title = I18n.t("contests.show.title", name: @contest.name)
@action_name = "Edit"
@action_path = edit_contest_path(@contest)
@contestants = @contest.contestants.order(:name) @contestants = @contest.contestants.order(:name)
@puzzles = @contest.puzzles.order(:id) @puzzles = @contest.puzzles.order(:id)
@messages = @contest.messages.order(:id) @messages = @contest.messages.order(:id)

View File

@ -9,9 +9,6 @@
.row.mb-4 .row.mb-4
.col .col
.float-end
a.btn.btn-primary href=edit_contest_path(@contest)
| Edit contest
p p
= t("contests.show.public_scoreboard") = t("contests.show.public_scoreboard")
= link_to root_url + "public/#{@contest.slug}", root_url + "public/#{@contest.slug}" = link_to root_url + "public/#{@contest.slug}", root_url + "public/#{@contest.slug}"
@ -20,7 +17,10 @@
.col-6 .col-6
.row .row
.col .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 table.table.table-striped.table-hover
thead thead
tr tr
@ -42,10 +42,6 @@
td td
a.btn.btn-sm.btn-secondary href=edit_contest_puzzle_path(@contest, puzzle) a.btn.btn-sm.btn-secondary href=edit_contest_puzzle_path(@contest, puzzle)
| Edit | Edit
.row
.col
a.btn.btn-primary href=new_contest_puzzle_path(@contest)
= t("contests.show.add_puzzle")
- if @messages - if @messages
.row.mt-5 .row.mt-5
.col .col
@ -64,13 +60,19 @@
= message.time_seconds = message.time_seconds
td td
= message.text = message.text
td
a.btn.btn-sm.btn-secondary href="" style="white-space: nowrap;"
| Add completion
td td
a.btn.btn-sm.btn-danger href="" a.btn.btn-sm.btn-danger href=""
| Delete | Delete
.col-6 .col-6
.row .row
.col .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 table.table.table-striped.table-hover
thead thead
tr tr
@ -88,9 +90,5 @@
td td
a.btn.btn-sm.btn-secondary href=edit_contest_contestant_path(@contest, contestant) a.btn.btn-sm.btn-secondary href=edit_contest_contestant_path(@contest, contestant)
| Open | 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 | 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") = t("nav.settings")
= button_to t("nav.log_out"), session_path, method: :delete = 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 = yield