Skip to content

Commit

Permalink
Add "no results" messages pointing to new voucher system (#707)
Browse files Browse the repository at this point in the history
* Add "no results" messages indicating the new voucher system

* Remove left-over console log
  • Loading branch information
Splines authored Dec 3, 2024
1 parent 8196e38 commit 79cb0b3
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 4 deletions.
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

0 comments on commit 79cb0b3

Please sign in to comment.