Prevent the user from converting messages and warn them, if there are no puzzles
All checks were successful
CI / scan_ruby (push) Successful in 16s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 13s
CI / test (push) Successful in 33s

This commit is contained in:
sto 2025-06-18 07:40:05 +02:00
parent baea71b312
commit 17a1af4e9f

View File

@ -9,13 +9,13 @@
.row .row
.col.alert.alert-success .col.alert.alert-success
= 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}"
.row.mb-4 .row.mb-4
.col.alert.alert-success .col.alert.alert-success
|> URL for the public scoreboard extension: |> URL for the public scoreboard extension:
= link_to "#{message_url}?token=#{@contest.generate_token_for(:token)}" = link_to "#{message_url}?token=#{@contest.generate_token_for(:token)}"
.row.mb-4 .row.mb-4
.col-6 .col-6
@ -50,6 +50,10 @@
.row.mt-5 .row.mt-5
.col .col
h4 = t("messages.plural").capitalize h4 = t("messages.plural").capitalize
- if !@puzzles.size
.row
.col.alert.alert-danger
| You first need to add a puzzle before converting messages to completions
table.table.table-striped.table-hover table.table.table-striped.table-hover
thead thead
tr tr
@ -69,8 +73,12 @@
td td
= message.text = message.text
td td
a.btn.btn-sm.btn-secondary href=contest_message_convert_path(@contest, message) style="white-space: nowrap;" - if @puzzles.size
= t("helpers.buttons.add_completion") a.btn.btn-sm.btn-secondary href=contest_message_convert_path(@contest, message) style="white-space: nowrap;"
= t("helpers.buttons.add_completion")
- else
a.btn.btn-sm.btn-secondary.disabled href=contest_message_convert_path(@contest, message) style="white-space: nowrap;"
= t("helpers.buttons.add_completion")
td td
= link_to t("helpers.buttons.delete"), contest_message_path(@contest, message), data: { turbo_method: :delete }, class: "btn btn-sm btn-danger" = link_to t("helpers.buttons.delete"), contest_message_path(@contest, message), data: { turbo_method: :delete }, class: "btn btn-sm btn-danger"
.col-6 .col-6