Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "no results" messages pointing to new voucher system #707

Merged
merged 7 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/assets/javascripts/_selectize_turbolinks_fix.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,21 @@ function fillOptionsByAjax($selectizedSelection) {
})();
}
else {
let renderOptions = {};

let noResultsMessage = this.dataset.noResults;
if (noResultsMessage) {
renderOptions = {
no_results: function (_data, _escape) {
return '<div class="no-results">' + noResultsMessage + "</div>";
},
};
}

return new TomSelect("#" + this.id, {
plugins: plugins,
maxOptions: null,
render: renderOptions,
});
}
});
Expand Down
5 changes: 4 additions & 1 deletion app/helpers/lectures_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions app/helpers/talks_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/views/tutorials/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
</div>
<div class="form-group col-4">
Expand Down
16 changes: 16 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br><br>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 <i>Gutscheine</i> generieren.
no_results_editor: >
Keine Resultate gefunden.<br><br>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 <i>Gutscheine</i> generieren.
no_results_speaker: >
Keine Resultate gefunden.<br><br>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 <i>Gutscheine</i> generieren, der
sich <a href="%{link}">hier</a> im <i>Personen</i>-Tab befindet.
editors: EditorInnen
vouchers: Gutscheine
voucher_for: Gutschein für %{role}
Expand Down
15 changes: 15 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br><br>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
<i>Vouchers</i> section.
no_results_editor: >
No results found.<br><br>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
<i>Vouchers</i> section.
no_results_speaker: >
No results found.<br><br>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
<i>Vouchers</i> section <a href="%{link}">here</a> in the <i>People</i> tab.
vouchers: Vouchers
voucher_for: Voucher for %{role}
speaker: Speaker
Expand Down
Loading