diff --git a/app/views/contests/settings_offline_edit.html.slim b/app/views/contests/settings_offline_edit.html.slim index be8a866..c0f6ceb 100644 --- a/app/views/contests/settings_offline_edit.html.slim +++ b/app/views/contests/settings_offline_edit.html.slim @@ -1,20 +1,27 @@ = render "settings_nav" -= form_with model: @contest, url: "/contests/#{@contest.id}/settings/offline" do |form| - .row.mt-2.mb-3 +- if @contest.puzzles.length > 1 + .row .col - - if @contest.puzzles.length <= 1 - .form-check.form-switch - = form.check_box :offline_form, class: "form-check-input" - = form.label :offline_form - .form-text = t("activerecord.attributes.contest.offline_form_warning") - .form-text = t("activerecord.attributes.contest.offline_form_description") - - else - .form-check.form-switch - = form.check_box :offline_form_fake, class: "form-check-input", disabled: true - = form.label :offline_form - .form-text = t("activerecord.attributes.contest.offline_form_warning") - .form-text = t("activerecord.attributes.contest.offline_form_description") - .row.mt-4 - .col - = form.submit t("helpers.buttons.update"), class: "btn btn-primary" \ No newline at end of file + .alert.alert-warning + = t("contests.form.offline_single_puzzle_warning") + +- if @contest.puzzles.length <= 1 + = form_with model: @contest, url: "/contests/#{@contest.id}/settings/offline" do |form| + .row.mt-2.mb-3 + .col + - if @contest.puzzles.length <= 1 + .form-check.form-switch + = form.check_box :offline_form, class: "form-check-input" + = form.label :offline_form + .form-text = t("activerecord.attributes.contest.offline_form_warning") + .form-text = t("activerecord.attributes.contest.offline_form_description") + - else + .form-check.form-switch + = form.check_box :offline_form_fake, class: "form-check-input", disabled: true + = form.label :offline_form + .form-text = t("activerecord.attributes.contest.offline_form_warning") + .form-text = t("activerecord.attributes.contest.offline_form_description") + .row.mt-4 + .col + = form.submit t("helpers.buttons.update"), class: "btn btn-primary" \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 2e6779b..dba687f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -177,6 +177,7 @@ en: categories: Participant categories general: General parameters offline: Offline participation + offline_single_puzzle_warning: This is not available for contests with more than one puzzle index: title: Welcome %{username}! manage_contests: Manage my contests diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 85b72ad..cd5ffea 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -148,6 +148,7 @@ fr: categories: Catégories de participant.e.s general: Paramètres généraux offline: Participation hors-ligne + offline_single_puzzle_warning: Ce n'est pas activable pour les concours avec plusieurs puzzles index: title: Bienvenue %{username} ! manage_contests: Mes concours de puzzle