Add notices
This commit is contained in:
parent
2616cbaa71
commit
5b908fe37c
@ -37,9 +37,9 @@ class CompletionsController < ApplicationController
|
|||||||
if @completion.save
|
if @completion.save
|
||||||
extend_completions!(@completion.contestant)
|
extend_completions!(@completion.contestant)
|
||||||
if @contestant && !params[:completion].key?(:message_id)
|
if @contestant && !params[:completion].key?(:message_id)
|
||||||
redirect_to edit_contest_contestant_path(@contest, @contestant)
|
redirect_to edit_contest_contestant_path(@contest, @contestant), notice: t("completions.new.notice")
|
||||||
else
|
else
|
||||||
redirect_to @contest
|
redirect_to @contest, notice: t("completions.new.notice")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if params[:completion].key?(:message_id)
|
if params[:completion].key?(:message_id)
|
||||||
@ -61,9 +61,9 @@ class CompletionsController < ApplicationController
|
|||||||
if @completion.update(completion_params)
|
if @completion.update(completion_params)
|
||||||
extend_completions!(@completion.contestant)
|
extend_completions!(@completion.contestant)
|
||||||
if @contestant
|
if @contestant
|
||||||
redirect_to edit_contest_contestant_path(@contest, @contestant)
|
redirect_to edit_contest_contestant_path(@contest, @contestant), notice: t("completions.edit.notice")
|
||||||
else
|
else
|
||||||
redirect_to @contest
|
redirect_to @contest, notice: t("completions.edit.notice")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if @contestant
|
if @contestant
|
||||||
@ -79,9 +79,9 @@ class CompletionsController < ApplicationController
|
|||||||
|
|
||||||
@completion.destroy
|
@completion.destroy
|
||||||
if params[:contestant_id]
|
if params[:contestant_id]
|
||||||
redirect_to contest_contestant_path(@contest, params[:contestant_id])
|
redirect_to contest_contestant_path(@contest, params[:contestant_id]), notice: t("completions.destroy.notice")
|
||||||
else
|
else
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest), notice: t("completions.destroy.notice")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class ContestantsController < ApplicationController
|
|||||||
@contestant = Contestant.new(contestant_params)
|
@contestant = Contestant.new(contestant_params)
|
||||||
@contestant.contest_id = @contest.id
|
@contestant.contest_id = @contest.id
|
||||||
if @contestant.save
|
if @contestant.save
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest), notice: t("contestants.new.notice")
|
||||||
else
|
else
|
||||||
@action_name = t("helpers.buttons.back")
|
@action_name = t("helpers.buttons.back")
|
||||||
@action_path = contest_path(@contest)
|
@action_path = contest_path(@contest)
|
||||||
@ -36,7 +36,7 @@ class ContestantsController < ApplicationController
|
|||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
if @contestant.update(contestant_params)
|
if @contestant.update(contestant_params)
|
||||||
redirect_to @contest
|
redirect_to @contest, notice: t("contestants.edit.notice")
|
||||||
else
|
else
|
||||||
@action_name = t("helpers.buttons.back")
|
@action_name = t("helpers.buttons.back")
|
||||||
@action_path = contest_path(@contest)
|
@action_path = contest_path(@contest)
|
||||||
@ -48,7 +48,7 @@ class ContestantsController < ApplicationController
|
|||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
@contestant.destroy
|
@contestant.destroy
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest), notice: t("contestants.destroy.notice")
|
||||||
end
|
end
|
||||||
|
|
||||||
def import
|
def import
|
||||||
@ -101,7 +101,7 @@ class ContestantsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest), notice: t("contestants.import.notice")
|
||||||
else
|
else
|
||||||
@action_name = t("helpers.buttons.back")
|
@action_name = t("helpers.buttons.back")
|
||||||
@action_path = contest_path(@contest)
|
@action_path = contest_path(@contest)
|
||||||
|
@ -40,7 +40,7 @@ class ContestsController < ApplicationController
|
|||||||
@contest = Contest.new(contest_params)
|
@contest = Contest.new(contest_params)
|
||||||
@contest.user_id = current_user.id
|
@contest.user_id = current_user.id
|
||||||
if @contest.save
|
if @contest.save
|
||||||
redirect_to @contest
|
redirect_to @contest, notice: t("contests.new.notice")
|
||||||
else
|
else
|
||||||
render :new, status: :unprocessable_entity
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
@ -50,7 +50,7 @@ class ContestsController < ApplicationController
|
|||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
if @contest.update(contest_params)
|
if @contest.update(contest_params)
|
||||||
redirect_to @contest
|
redirect_to @contest, notice: t("contests.edit.notice")
|
||||||
else
|
else
|
||||||
@action_name = t("helpers.buttons.back")
|
@action_name = t("helpers.buttons.back")
|
||||||
@action_path = contest_path(@contest)
|
@action_path = contest_path(@contest)
|
||||||
@ -60,6 +60,9 @@ class ContestsController < ApplicationController
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
@contest.destroy
|
||||||
|
redirect_to contests_path, notice: t("contests.destroy.notice")
|
||||||
end
|
end
|
||||||
|
|
||||||
def scoreboard
|
def scoreboard
|
||||||
|
@ -65,7 +65,7 @@ class MessagesController < ApplicationController
|
|||||||
|
|
||||||
@message = Message.find(params[:id])
|
@message = Message.find(params[:id])
|
||||||
@message.destroy
|
@message.destroy
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest), notice: t("messages.destroy.notice")
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -23,7 +23,7 @@ class PuzzlesController < ApplicationController
|
|||||||
@puzzle = Puzzle.new(puzzle_params)
|
@puzzle = Puzzle.new(puzzle_params)
|
||||||
@puzzle.contest_id = @contest.id
|
@puzzle.contest_id = @contest.id
|
||||||
if @puzzle.save
|
if @puzzle.save
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest), notice: t("puzzles.new.notice")
|
||||||
else
|
else
|
||||||
@action_name = t("helpers.buttons.back")
|
@action_name = t("helpers.buttons.back")
|
||||||
@action_path = contest_path(@contest)
|
@action_path = contest_path(@contest)
|
||||||
@ -35,7 +35,7 @@ class PuzzlesController < ApplicationController
|
|||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
if @puzzle.update(puzzle_params)
|
if @puzzle.update(puzzle_params)
|
||||||
redirect_to @contest
|
redirect_to @contest, notice: t("puzzles.edit.notice")
|
||||||
else
|
else
|
||||||
@action_name = t("helpers.buttons.back")
|
@action_name = t("helpers.buttons.back")
|
||||||
@action_path = contest_path(@contest)
|
@action_path = contest_path(@contest)
|
||||||
@ -47,7 +47,7 @@ class PuzzlesController < ApplicationController
|
|||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
@puzzle.destroy
|
@puzzle.destroy
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest), notice: t("puzzles.destroy.notice")
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -9,7 +9,7 @@ class SessionsController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
if user = User.authenticate_by(params.permit(:email_address, :password))
|
if user = User.authenticate_by(params.permit(:email_address, :password))
|
||||||
start_new_session_for user
|
start_new_session_for user
|
||||||
redirect_to after_authentication_url
|
redirect_to after_authentication_url, notice: t("sessions.new.notice")
|
||||||
else
|
else
|
||||||
redirect_to new_session_path, alert: "Try another email address or password."
|
redirect_to new_session_path, alert: "Try another email address or password."
|
||||||
end
|
end
|
||||||
|
@ -15,7 +15,7 @@ class UsersController < ApplicationController
|
|||||||
authorize @user
|
authorize @user
|
||||||
|
|
||||||
if @user.update(user_params)
|
if @user.update(user_params)
|
||||||
redirect_to contests_path
|
redirect_to contests_path, notice: t("users.edit.notice")
|
||||||
else
|
else
|
||||||
render :edit, status: :unprocessable_entity
|
render :edit, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
@ -38,7 +38,7 @@ class UsersController < ApplicationController
|
|||||||
|
|
||||||
@user = User.new(user_params)
|
@user = User.new(user_params)
|
||||||
if @user.save
|
if @user.save
|
||||||
redirect_to users_path
|
redirect_to users_path, notice: t("users.new.notice")
|
||||||
else
|
else
|
||||||
render :new, status: :unprocessable_entity
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
@ -16,6 +16,33 @@ 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
|
||||||
|
|
||||||
|
css:
|
||||||
|
.toast {
|
||||||
|
opacity: 0;
|
||||||
|
animation: fadeInAndOut 6s linear;
|
||||||
|
}
|
||||||
|
@keyframes fadeInAndOut {
|
||||||
|
0%, 5%, 100% { opacity: 0 }
|
||||||
|
7%, 85% { opacity: 1 }
|
||||||
|
}
|
||||||
|
javascript:
|
||||||
|
function closeToast(event) {
|
||||||
|
event.target.parentElement.parentElement.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast-container.position-fixed.p-3 style="right: 30px; top: 100px"
|
||||||
|
- flash.each do |type, msg|
|
||||||
|
.toast role="alert" aria-live="assertive" aria-atomic="true" style="display: block"
|
||||||
|
.toast-header
|
||||||
|
strong.me-auto
|
||||||
|
i.bi-bell-fill.fs-6.text-primary
|
||||||
|
=< type.humanize
|
||||||
|
small.text-body-secondary
|
||||||
|
| Just now
|
||||||
|
button.btn-close type="button" data-bs-dismiss="toast" aria-label="Close" onclick="closeToast(event)"
|
||||||
|
.toast-body
|
||||||
|
= msg
|
||||||
|
|
||||||
h1.mb-4
|
h1.mb-4
|
||||||
= @title
|
= @title
|
||||||
- if @action_path
|
- if @action_path
|
||||||
|
@ -111,52 +111,65 @@ en:
|
|||||||
username:
|
username:
|
||||||
blank: Your username cannot be empty
|
blank: Your username cannot be empty
|
||||||
completions:
|
completions:
|
||||||
|
destroy:
|
||||||
|
notice: Completion deleted
|
||||||
edit:
|
edit:
|
||||||
|
notice: Completion updated
|
||||||
title: Edit completion
|
title: Edit completion
|
||||||
new:
|
new:
|
||||||
|
notice: Completion added
|
||||||
title: New completion
|
title: New completion
|
||||||
singular: completion
|
singular: completion
|
||||||
contests:
|
contests:
|
||||||
|
destroy:
|
||||||
|
notice: Contest deleted
|
||||||
edit:
|
edit:
|
||||||
title: "Edit contest settings"
|
notice: Contest updated
|
||||||
|
title: Edit contest settings
|
||||||
index:
|
index:
|
||||||
title: "Welcome %{username}!"
|
title: Welcome %{username}!
|
||||||
manage_contests: "Manage my contests"
|
manage_contests: Manage my contests
|
||||||
new_contest: "Create a new contest"
|
new_contest: Create a new contest
|
||||||
new:
|
new:
|
||||||
title: "New jigsaw puzzle contest"
|
notice: Contest added
|
||||||
|
title: New jigsaw puzzle contest
|
||||||
scoreboard:
|
scoreboard:
|
||||||
title: "%{name}"
|
title: "%{name}"
|
||||||
show:
|
show:
|
||||||
title: "%{name}"
|
title: "%{name}"
|
||||||
add_participant: Add contestant
|
add_participant: Add participant
|
||||||
add_puzzle: Add puzzle
|
add_puzzle: Add puzzle
|
||||||
copy_extension_url: Copy the URL for connecting from the browser extension
|
copy_extension_url: Copy the URL for connecting from the browser extension
|
||||||
open_public_scoreboard: Open public scoreboard
|
open_public_scoreboard: Open public scoreboard
|
||||||
url_copied: URL copied to the clipboard
|
url_copied: URL copied to the clipboard
|
||||||
contestants:
|
contestants:
|
||||||
convert_csv:
|
convert_csv:
|
||||||
title: "Import participants"
|
title: Import participants
|
||||||
|
destroy:
|
||||||
|
notice: Participant deleted
|
||||||
edit:
|
edit:
|
||||||
title: "Participant"
|
notice: Participant updated
|
||||||
team_title: "Teams"
|
title: Participant
|
||||||
|
team_title: Teams
|
||||||
finalize_import:
|
finalize_import:
|
||||||
title: "Import participants"
|
title: Import participants
|
||||||
import:
|
import:
|
||||||
email_column: "Participant email"
|
email_column: Participant email
|
||||||
import_column: "Import?"
|
import_column: Import?
|
||||||
name_column: "Participant name"
|
name_column: Participant name
|
||||||
title: "Import participants"
|
notice: Participants imported
|
||||||
|
title: Import participants
|
||||||
new:
|
new:
|
||||||
title: "New participant"
|
notice: Participant added
|
||||||
team_title: "New team"
|
title: New participant
|
||||||
singular: "participant"
|
team_title: New team
|
||||||
plural: "participants"
|
singular: participant
|
||||||
|
plural: participants
|
||||||
teams:
|
teams:
|
||||||
singular: "team"
|
singular: team
|
||||||
plural: "teams"
|
plural: teams
|
||||||
upload_csv:
|
upload_csv:
|
||||||
title: "Import participants"
|
title: Import participants
|
||||||
helpers:
|
helpers:
|
||||||
badges:
|
badges:
|
||||||
registration: "registration"
|
registration: "registration"
|
||||||
@ -180,6 +193,8 @@ en:
|
|||||||
messages:
|
messages:
|
||||||
convert:
|
convert:
|
||||||
title: New completion
|
title: New completion
|
||||||
|
destroy:
|
||||||
|
notice: Message deleted
|
||||||
plural: "messages"
|
plural: "messages"
|
||||||
singular: "message"
|
singular: "message"
|
||||||
warning: "You first need to add a puzzle before converting messages to completions."
|
warning: "You first need to add a puzzle before converting messages to completions."
|
||||||
@ -189,24 +204,31 @@ en:
|
|||||||
settings: "Settings"
|
settings: "Settings"
|
||||||
log_out: "Log out"
|
log_out: "Log out"
|
||||||
puzzles:
|
puzzles:
|
||||||
|
destroy:
|
||||||
|
notice: Puzzle deleted
|
||||||
edit:
|
edit:
|
||||||
title: "Edit contest puzzle"
|
notice: Puzzle updated
|
||||||
|
title: Edit contest puzzle
|
||||||
form:
|
form:
|
||||||
fake_data_recommendation: It is recommended to first enter a fake name and image, and to use the real ones only once the contest starts.
|
fake_data_recommendation: It is recommended to first enter a fake name and image, and to use the real ones only once the contest starts.
|
||||||
image_select: "Select an image"
|
image_select: Select an image
|
||||||
new:
|
new:
|
||||||
title: "New contest puzzle"
|
notice: Puzzle added
|
||||||
singular: "puzzle"
|
title: New contest puzzle
|
||||||
plural: "puzzles"
|
singular: puzzle
|
||||||
|
plural: puzzles
|
||||||
sessions:
|
sessions:
|
||||||
new:
|
new:
|
||||||
|
notice: Login successful
|
||||||
title: "Login to the Public Scoreboard app"
|
title: "Login to the Public Scoreboard app"
|
||||||
users:
|
users:
|
||||||
edit:
|
edit:
|
||||||
|
notice: Settings updated
|
||||||
title: "My settings"
|
title: "My settings"
|
||||||
general_section: "General settings"
|
general_section: "General settings"
|
||||||
password_section: "Change password"
|
password_section: "Change password"
|
||||||
index:
|
index:
|
||||||
title: "All users"
|
title: "All users"
|
||||||
new:
|
new:
|
||||||
|
notice: User created
|
||||||
title: "New user"
|
title: "New user"
|
||||||
|
@ -82,20 +82,28 @@ fr:
|
|||||||
username:
|
username:
|
||||||
blank: Le nom d'utilisateur.ice est obligatoire
|
blank: Le nom d'utilisateur.ice est obligatoire
|
||||||
completions:
|
completions:
|
||||||
|
destroy:
|
||||||
|
notice: Complétion supprimée
|
||||||
edit:
|
edit:
|
||||||
|
notice: Complétion modifiée
|
||||||
title: Modifier la complétion
|
title: Modifier la complétion
|
||||||
new:
|
new:
|
||||||
|
notice: Complétion ajoutée
|
||||||
title: Ajout d'une complétion
|
title: Ajout d'une complétion
|
||||||
singular: complétion
|
singular: complétion
|
||||||
contests:
|
contests:
|
||||||
|
destroy:
|
||||||
|
notice: Concours supprimé
|
||||||
edit:
|
edit:
|
||||||
title: "Paramètres du concours"
|
notice: Concours modifié
|
||||||
|
title: Paramètres du concours
|
||||||
index:
|
index:
|
||||||
title: "Bienvenue %{username} !"
|
title: Bienvenue %{username} !
|
||||||
manage_contests: "Mes concours de puzzle"
|
manage_contests: Mes concours de puzzle
|
||||||
new_contest: "Créer un nouveau concours"
|
new_contest: Créer un nouveau concours
|
||||||
new:
|
new:
|
||||||
title: "Nouveau concours"
|
notice: Concours ajouté
|
||||||
|
title: Nouveau concours
|
||||||
scoreboard:
|
scoreboard:
|
||||||
title: "%{name}"
|
title: "%{name}"
|
||||||
show:
|
show:
|
||||||
@ -107,27 +115,32 @@ fr:
|
|||||||
url_copied: L’URL a été copiée dans le presse-papier
|
url_copied: L’URL a été copiée dans le presse-papier
|
||||||
contestants:
|
contestants:
|
||||||
convert_csv:
|
convert_csv:
|
||||||
title: "Importer des participant.e.s"
|
title: Importer des participant.e.s
|
||||||
|
destroy:
|
||||||
|
notice: Participant.e supprimé.e
|
||||||
edit:
|
edit:
|
||||||
title: "Participant.e"
|
notice: Participant.e modifié.e
|
||||||
team_title: "Équipe"
|
title: Participant.e
|
||||||
|
team_title: Équipe
|
||||||
finalize_import:
|
finalize_import:
|
||||||
title: "Importer des participant.e.s"
|
title: Importer des participant.e.s
|
||||||
import:
|
import:
|
||||||
email_column: "Email des participant.e.s"
|
email_column: Email des participant.e.s
|
||||||
import_column: "Importer ?"
|
import_column: Importer ?
|
||||||
name_column: "Noms des participant.e.s"
|
name_column: Noms des participant.e.s
|
||||||
title: "Importer des participant.e.s"
|
notice: Participant.e.s importé.e.s
|
||||||
|
title: Importer des participant.e.s
|
||||||
new:
|
new:
|
||||||
title: "Nouveau.elle participant.e"
|
notice: Participant.e ajouté.e
|
||||||
team_title: "Nouvelle équipe"
|
title: Nouveau.elle participant.e
|
||||||
singular: "participant.e"
|
team_title: Nouvelle équipe
|
||||||
plural: "participant.e.s"
|
singular: participant.e
|
||||||
|
plural: participant.e.s
|
||||||
teams:
|
teams:
|
||||||
singular: "équipe"
|
singular: équipe
|
||||||
plural: "équipes"
|
plural: équipes
|
||||||
upload_csv:
|
upload_csv:
|
||||||
title: "Importer des participant.e.s"
|
title: Importer des participant.e.s
|
||||||
helpers:
|
helpers:
|
||||||
badges:
|
badges:
|
||||||
registration: "auto-inscription"
|
registration: "auto-inscription"
|
||||||
@ -151,6 +164,8 @@ fr:
|
|||||||
messages:
|
messages:
|
||||||
convert:
|
convert:
|
||||||
title: Ajout d'une complétion
|
title: Ajout d'une complétion
|
||||||
|
destroy:
|
||||||
|
notice: Message supprimé
|
||||||
plural: "messages"
|
plural: "messages"
|
||||||
singular: "message"
|
singular: "message"
|
||||||
warning: "Au moins un puzzle doit être ajouté avant de pouvoir convertir des messages en complétions."
|
warning: "Au moins un puzzle doit être ajouté avant de pouvoir convertir des messages en complétions."
|
||||||
@ -160,24 +175,31 @@ fr:
|
|||||||
settings: "Paramètres"
|
settings: "Paramètres"
|
||||||
log_out: "Déconnexion"
|
log_out: "Déconnexion"
|
||||||
puzzles:
|
puzzles:
|
||||||
|
destroy:
|
||||||
|
notice: Puzzle supprimé
|
||||||
edit:
|
edit:
|
||||||
title: "Modifier le puzzle"
|
notice: Puzzle modifié
|
||||||
|
title: Modifier le puzzle
|
||||||
form:
|
form:
|
||||||
fake_data_recommendation: Il est recommendé d'entrer de faux noms et images, et de mettre les vrais uniquement quand le concours démarre.
|
fake_data_recommendation: Il est recommendé d'entrer de faux noms et images, et de mettre les vrais uniquement quand le concours démarre.
|
||||||
image_select: "Choisis une image"
|
image_select: Choisis une image
|
||||||
new:
|
new:
|
||||||
title: "Nouveau puzzle"
|
notice: Puzzle ajouté
|
||||||
singular: "puzzle"
|
title: Nouveau puzzle
|
||||||
plural: "puzzles"
|
singular: puzzle
|
||||||
|
plural: puzzles
|
||||||
sessions:
|
sessions:
|
||||||
new:
|
new:
|
||||||
|
notice: Connection réussie
|
||||||
title: "Se connecter à l'app Public Scoreboard"
|
title: "Se connecter à l'app Public Scoreboard"
|
||||||
users:
|
users:
|
||||||
edit:
|
edit:
|
||||||
|
notice: Paramètres modifiés
|
||||||
title: "Mes paramètres"
|
title: "Mes paramètres"
|
||||||
general_section: "Paramètres globaux"
|
general_section: "Paramètres globaux"
|
||||||
password_section: "Modifier mon mot de passe"
|
password_section: "Modifier mon mot de passe"
|
||||||
index:
|
index:
|
||||||
title: "Tous.tes les utilisateur.ices"
|
title: "Tous.tes les utilisateur.ices"
|
||||||
new:
|
new:
|
||||||
|
notice: Utilisateur.ice ajouté.e
|
||||||
title: "Nouveau.elle utilisateur.ice"
|
title: "Nouveau.elle utilisateur.ice"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user