Skip to content

Commit 93788e0

Browse files
Add speaker name filter to proposal review recap screen
Adds a text input filter that allows filtering proposals by speaker name in the review recap screen. The filter performs case-insensitive substring matching on the speaker's full name. Closes #4547 Co-authored-by: Marco Acierno <marcoacierno@users.noreply.github.com>
1 parent f015f9e commit 93788e0

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

backend/reviews/templates/proposals-recap.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,13 @@
261261
const filterWithReviewsSelect = document.querySelector('#filter-with-n-reviews');
262262
const filterByStatusInputs = [...document.querySelectorAll('input[name="filter-by-status"]')];
263263
const filterByTypeInputs = [...document.querySelectorAll('input[name="filter-by-type"]')];
264+
const filterBySpeakerInput = document.querySelector('#filter-by-speaker');
264265

265266
const applyFilters = () => {
266267
const reviewFilterValue = filterWithReviewsSelect.value;
267268
const visibleStatuses = filterByStatusInputs.filter(input => input.checked).map(input => input.value);
268269
const visibleTypes = filterByTypeInputs.filter(input => input.checked).map(input => input.value);
270+
const speakerFilter = filterBySpeakerInput.value.toLowerCase().trim();
269271

270272
document.querySelectorAll('.proposal-item').forEach(proposalRow => {
271273
const proposalId = parseInt(proposalRow.id.split('-')[1], 10);
@@ -274,8 +276,9 @@
274276
const matchesReviews = reviewFilterValue === 'all' || proposalData.numOfVotes === parseInt(reviewFilterValue, 10);
275277
const matchesStatus = visibleStatuses.includes(proposalData.originalStatus);
276278
const matchesType = visibleTypes.includes(proposalData.submissionType);
279+
const matchesSpeaker = !speakerFilter || proposalData.speakerName.toLowerCase().includes(speakerFilter);
277280

278-
if (matchesReviews && matchesStatus && matchesType) {
281+
if (matchesReviews && matchesStatus && matchesType && matchesSpeaker) {
279282
proposalRow.classList.remove('hidden');
280283
} else {
281284
proposalRow.classList.add('hidden');
@@ -286,6 +289,7 @@
286289
filterWithReviewsSelect.addEventListener('change', applyFilters);
287290
filterByStatusInputs.forEach(input => input.addEventListener('change', applyFilters));
288291
filterByTypeInputs.forEach(input => input.addEventListener('change', applyFilters));
292+
filterBySpeakerInput.addEventListener('input', applyFilters);
289293
});
290294

291295
const updateBottomBarUI = () => {
@@ -405,6 +409,10 @@ <h3>Show proposals with pending status:</h3>
405409
{% endfor %}
406410
</div>
407411
</div>
412+
<div class="opt-filter">
413+
<h3>Filter by speaker name:</h3>
414+
<input type="text" id="filter-by-speaker" placeholder="Type speaker name..." />
415+
</div>
408416
<div class="opt-filter">
409417
<h3>Show proposals of type:</h3>
410418
<div>
@@ -464,6 +472,7 @@ <h3>Show proposals of type:</h3>
464472
languages: [{% for language in item.languages.all %}"{{language.code}}",{% endfor %}],
465473
numOfVotes: {{item.userreview_set.count}},
466474
submissionType: "{{ item.type.name }}",
475+
speakerName: "{{ item.speaker.fullname|escapejs }}",
467476
};
468477
</script>
469478
<tr class="proposal-item" id="submission-{{item.id}}" data-original-status="{{ item.current_or_pending_status }}">

0 commit comments

Comments
 (0)