From 79cb0b328945c355a1555228c06fdf666e46087d Mon Sep 17 00:00:00 2001 From: Splines <37160523+Splines@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:26:18 +0100 Subject: [PATCH] Add "no results" messages pointing to new voucher system (#707) * Add "no results" messages indicating the new voucher system * Remove left-over console log --- .../javascripts/_selectize_turbolinks_fix.js | 12 ++++++++++++ app/helpers/lectures_helper.rb | 5 ++++- app/helpers/talks_helper.rb | 9 +++++++-- app/views/tutorials/_form.html.erb | 3 ++- config/locales/de.yml | 16 ++++++++++++++++ config/locales/en.yml | 15 +++++++++++++++ 6 files changed, 56 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/_selectize_turbolinks_fix.js b/app/assets/javascripts/_selectize_turbolinks_fix.js index dfe418cf2..f8ac4666c 100644 --- a/app/assets/javascripts/_selectize_turbolinks_fix.js +++ b/app/assets/javascripts/_selectize_turbolinks_fix.js @@ -127,9 +127,21 @@ function fillOptionsByAjax($selectizedSelection) { })(); } else { + let renderOptions = {}; + + let noResultsMessage = this.dataset.noResults; + if (noResultsMessage) { + renderOptions = { + no_results: function (_data, _escape) { + return '
' + noResultsMessage + "
"; + }, + }; + } + return new TomSelect("#" + this.id, { plugins: plugins, maxOptions: null, + render: renderOptions, }); } }); diff --git a/app/helpers/lectures_helper.rb b/app/helpers/lectures_helper.rb index bd9757890..40bdd69b2 100644 --- a/app/helpers/lectures_helper.rb +++ b/app/helpers/lectures_helper.rb @@ -203,7 +203,10 @@ def editors_select(form, lecture) form.select(:editor_ids, editors_preselection(lecture), {}, class: "selectize", multiple: true, - "data-cy": "lecture-editors-select") + data: { + cy: "lecture-editors-select", + no_results: t("basics.no_results_editor") + }) end end end diff --git a/app/helpers/talks_helper.rb b/app/helpers/talks_helper.rb index 3783bb400..d9337a793 100644 --- a/app/helpers/talks_helper.rb +++ b/app/helpers/talks_helper.rb @@ -69,10 +69,15 @@ def speaker_select(form, talk, with_preselection) } }) else + seminar_edit_people_link = "#{edit_lecture_path(talk.lecture)}#people" + form.select(:speaker_ids, speakers_preselection(talk), {}, class: "selectize", - data: { cy: "speaker-select" }, - multiple: true) + multiple: true, + data: { + cy: "speaker-select", + no_results: t("basics.no_results_speaker", link: seminar_edit_people_link) + }) end label + help_desk + select diff --git a/app/views/tutorials/_form.html.erb b/app/views/tutorials/_form.html.erb index f3beb69d0..ba27cff60 100644 --- a/app/views/tutorials/_form.html.erb +++ b/app/views/tutorials/_form.html.erb @@ -31,7 +31,8 @@ { class: 'selectize', multiple: true, id: "tutorial_tutor_ids_#{tutorial.id}", - data: { cy: "tutor-select"} } %> + data: { cy: "tutor-select", + no_results: t('basics.no_results_tutor') } } %> <% end %>
diff --git a/config/locales/de.yml b/config/locales/de.yml index b55e7d082..4a6b794a9 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -3621,6 +3621,22 @@ de: together_with: zusammen mit enter_two_letters: mind. 2 Zeichen eingeben no_results: Keine Resultate gefunden + no_results_tutor: > + Keine Resultate gefunden.

Beachte, dass Du ab sofort nur noch nach + Personen suchen kannst, die bereits als TutorInnen eingetragen sind oder + die den Tutor-Status mithilfe eines Gutscheins erhalten haben. Einen + solchen Gutschein kannst Du im Bereich Gutscheine generieren. + no_results_editor: > + Keine Resultate gefunden.

Beachte, dass Du ab sofort nur noch nach + Personen suchen kannst, die bereits als EditorInnen eingetragen sind oder + die den Editor-Status mithilfe eines Gutscheins erhalten haben. Einen + solchen Gutschein kannst Du im Bereich Gutscheine generieren. + no_results_speaker: > + Keine Resultate gefunden.

Beachte, dass Du ab sofort nur noch nach + Personen suchen kannst, die bereits als Vortragende eingetragen sind oder + die den Vortrags-Status mithilfe eines Gutscheins erhalten haben. Einen + solchen Gutschein kannst Du im Bereich Gutscheine generieren, der + sich hier im Personen-Tab befindet. editors: EditorInnen vouchers: Gutscheine voucher_for: Gutschein für %{role} diff --git a/config/locales/en.yml b/config/locales/en.yml index 06bf2d31d..e64d78a87 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3422,6 +3422,21 @@ en: together_with: together with enter_two_letters: enter at least 2 letters no_results: No results found + no_results_tutor: > + No results found.

Note that from now on you can only search for + people who are already registered as tutors or who have obtained tutor + status using a voucher. You can generate such a voucher in the + Vouchers section. + no_results_editor: > + No results found.

Note that from now on you can only search for + people who are already registered as editors or who have obtained editor + status using a voucher. You can generate such a voucher in the + Vouchers section. + no_results_speaker: > + No results found.

Note that from now on you can only search for + people who are already registered as speakers or who have obtained speaker + status using a voucher. You can generate such a voucher in the + Vouchers section here in the People tab. vouchers: Vouchers voucher_for: Voucher for %{role} speaker: Speaker