Translations for the contest dashboard page
All checks were successful
CI / scan_ruby (push) Successful in 16s
CI / scan_js (push) Successful in 11s
CI / lint (push) Successful in 11s
CI / test (push) Successful in 28s

This commit is contained in:
sto 2025-05-18 09:52:58 +02:00
parent ec2201f9a8
commit 7444a09046
8 changed files with 58 additions and 28 deletions

View File

@ -13,7 +13,7 @@ class ContestsController < ApplicationController
authorize @contest
@title = I18n.t("contests.show.title", name: @contest.name)
@action_name = "Edit"
@action_name = t("helpers.buttons.edit")
@action_path = edit_contest_path(@contest)
@contestants = @contest.contestants.order(:name)
@puzzles = @contest.puzzles.order(:id)
@ -75,8 +75,8 @@ class ContestsController < ApplicationController
def set_badges
@badges = []
@badges.push("team") if @contest.team
@badges.push("registration") if @contest.allow_registration
@badges.push(t("helpers.badges.team")) if @contest.team
@badges.push(t("helpers.badges.registration")) if @contest.allow_registration
end
def set_contest

View File

@ -8,8 +8,7 @@
= badge
.row.mb-4
.col
p
.col.alert.alert-success
= t("contests.show.public_scoreboard")
= link_to root_url + "public/#{@contest.slug}", root_url + "public/#{@contest.slug}"
@ -19,17 +18,17 @@
.col
h4
= t("puzzles.plural").capitalize
a.ms-3.btn.btn-primary href=new_contest_puzzle_path(@contest) style="margin-top: -3px"
a.ms-3.btn.btn-sm.btn-primary href=new_contest_puzzle_path(@contest) style="margin-top: -3px"
| + #{t("helpers.buttons.add")}
table.table.table-striped.table-hover
thead
tr
th scope="col"
| Image
= t("activerecord.attributes.puzzle.image")
th scope="col"
| Title
= t("activerecord.attributes.puzzle.name")
th scope="col"
| Brand
= t("activerecord.attributes.puzzle.brand")
tbody
- @puzzles.each do |puzzle|
tr.align-middle scope="row"
@ -41,7 +40,7 @@
= puzzle.brand
td
a.btn.btn-sm.btn-secondary href=edit_contest_puzzle_path(@contest, puzzle)
| Edit
= t("helpers.buttons.edit")
- if @messages
.row.mt-5
.col
@ -50,11 +49,11 @@
thead
tr
th scope="col"
| Time
= t("activerecord.attributes.message.time")
th scope="col"
| Author
= t("activerecord.attributes.message.author")
th scope="col"
| Text
= t("activerecord.attributes.message.text")
tbody
- @messages.each do |message|
tr.align-middle scope="row"
@ -66,34 +65,30 @@
= message.text
td
a.btn.btn-sm.btn-secondary href=contest_message_convert_path(@contest, message) style="white-space: nowrap;"
| Add completion
= t("helpers.buttons.add_completion")
td
= link_to "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
.row
.col
h4
= t("contestants.plural").capitalize
a.ms-3.btn.btn-primary href=new_contest_contestant_path(@contest) style="margin-top: -3px"
a.ms-3.btn.btn-sm.btn-primary href=new_contest_contestant_path(@contest) style="margin-top: -3px"
| + #{t("helpers.buttons.add")}
a.ms-3.btn.btn-primary href=contest_import_path(@contest) style="margin-top: -3px"
a.ms-3.btn-sm.btn.btn-primary href=contest_import_path(@contest) style="margin-top: -3px"
| #{t("helpers.buttons.import")}
table.table.table-striped.table-hover
thead
tr
th scope="col"
| Name
th scope="col"
| Completed puzzles
= t("activerecord.attributes.contestant.name")
tbody
- @contestants.each do |contestant|
tr scope="row"
td
= contestant.name
td
= contestant.completions.length
td
a.btn.btn-sm.btn-secondary href=edit_contest_contestant_path(@contest, contestant)
| Open
= t("helpers.buttons.open")
a.btn.btn-sm.btn-secondary.ms-3 href=new_contest_completion_path(@contest, contestant_id: contestant.id)
| Add completion
= t("helpers.buttons.add_completion")

View File

@ -19,7 +19,7 @@ html
h1.mb-4
= @title
- if @action_path
a.ms-3.btn.btn-primary href=@action_path style="margin-top: -4px"
a.ms-4.btn.btn-primary href=@action_path style="margin-top: -4px"
= @action_name
= yield

View File

@ -11,7 +11,8 @@
= form.label :brand, class: "required"
.row.mb-3
.col
.form-text Select an image
.form-text.mb-1
= t("puzzles.image_select")
= form.file_field :image, accept: "image/*", class: "form-control"
.row.mt-4
.col

View File

@ -1 +1 @@
= render "form", contest: @contest, puzzle: @puzzle, submit_text: "Save", method: :patch, url: "/contests/#{@contest.id}/puzzles/#{@puzzle.id}"
= render "form", contest: @contest, puzzle: @puzzle, submit_text: t("helpers.buttons.save"), method: :patch, url: "/contests/#{@contest.id}/puzzles/#{@puzzle.id}"

View File

@ -1 +1 @@
= render "form", contest: @contest, puzzle: @puzzle, submit_text: "Add", method: :post, url: "/contests/#{@contest.id}/puzzles"
= render "form", contest: @contest, puzzle: @puzzle, submit_text: t("helpers.buttons.add"), method: :post, url: "/contests/#{@contest.id}/puzzles"

View File

@ -44,6 +44,16 @@ en:
team_description: "For UI display purposes mainly"
allow_registration: "Allow registration"
allow_registration_description: "Generates a shareable registration form for this contest"
contestant:
name: "Name"
message:
author: "Author"
text: "Content"
time: "Time"
puzzle:
brand: "Brand"
image: "Image"
name: "Name"
user:
username: "Username"
email_address: "Email address"
@ -107,10 +117,16 @@ en:
singular: "team"
plural: "teams"
helpers:
badges:
registration: "registration"
team: "team"
buttons:
add: "Add"
add_completion: "Add completion"
confirm: "Confirm"
create: "Create"
delete: "Delete"
edit: "Edit"
import: "CSV Import"
save: "Save"
field: "Field"
@ -127,6 +143,7 @@ en:
puzzles:
edit:
title: "Edit contest puzzle"
image_select: "Select an image"
new:
title: "New contest puzzle"
singular: "puzzle"

View File

@ -15,6 +15,16 @@ fr:
team_description: "Principalement pour des raisons d'affichage"
allow_registration: "Autoriser l'inscription via l'interface"
allow_registration_description: "Génère un formulaire d'inscription pour ce concours"
contestant:
name: "Nom"
message:
author: "Auteur.ice"
text: "Contenu"
time: "Temps"
puzzle:
brand: "Marque"
image: "Image"
name: "Nom"
user:
username: "Nom d'utilisateur.ice"
email_address: "Adresse email"
@ -78,10 +88,16 @@ fr:
singular: "équipe"
plural: "équipes"
helpers:
badges:
registration: "auto-inscription"
team: "équipes"
buttons:
add: "Ajouter"
add_completion: "Ajouter une complétion"
confirm: "Confirmer"
create: "Créer"
delete: "Supprimer"
edit: "Modifier"
import: "Importer un CSV"
save: "Modifier"
field: "Champ"
@ -98,6 +114,7 @@ fr:
puzzles:
edit:
title: "Modifier le puzzle"
image_select: "Choisis une image"
new:
title: "Nouveau puzzle"
singular: "puzzle"