Skip to content

Commit

Permalink
Add option to hide already-rated entries from ballot. (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
Keltena authored Sep 18, 2024
1 parent 464ceed commit 45f7b7d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
19 changes: 19 additions & 0 deletions IFComp/root/src/_filter_entries.tt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
const $playtimeSelect = document.querySelector('.playtime-select');
const $styleSelect = document.querySelector('.style-select');
const $platformSelect = document.querySelector('.platform-select');
const $hideRated = document.querySelector('.hide-rated');

var filter_style = new Array();
var filter_playtime = new Array();
var filter_platform = new Array();
var filter_rated = new Boolean();

$("#no-visible-games").hide();

Expand Down Expand Up @@ -44,6 +46,14 @@ function updateDisplay() {
}
});
}
if (filter_rated == true) {
$('[id ^= "entry-"').filter(":visible").each(function() {
if ($(this).attr('ifcomp-rated') === 'true') {
$(this).hide();
count -= 1;
}
});
}

if (count == 0) {
$('div[id = "no-visible-games"]').show();
Expand Down Expand Up @@ -82,5 +92,14 @@ $platformSelect.onchange = function() {
updateDisplay();
}

$hideRated.onchange = function() {
if (!this.checked) {
filter_rated = false;
} else {
filter_rated = true;
}
updateDisplay();
}

</script>
[% END %]
10 changes: 10 additions & 0 deletions IFComp/root/src/ballot/index.tt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ And for a more compact list of this year's entries, <a href="/ballot/vote/">see

</div>

<div class="row">
<div class="col-sm-3"></div>

<div class="col-sm-6">
<input type="checkbox" id="hide-rated" name="hide-rated" class="hide-rated" style="margin-top:10px;" autocomplete="off" />
<label for="hide-rated" style="font-weight:inherit;">Hide entries I've already rated.</label>
</div>
</div>

<div class="row" align=center style="padding-top: 1em;">
<p>NOTE: you can use Ctrl-click / &#8984;-Click to select multiple items from the lists above. Clicking on "All" at the top will clear the selections</p>
</div>
Expand All @@ -275,6 +284,7 @@ And for a more compact list of this year's entries, <a href="/ballot/vote/">see
ifcomp-style="[% IF entry.style %][% entry.style %][% ELSE %]other[% END %]"
ifcomp-playtime="[% IF entry.playtime %][% entry.playtime %][% ELSE %]other[% END %]"
ifcomp-platform="[% IF entry.platform %][% entry.platform %][% ELSE %]other[% END %]"
ifcomp-rated="[% IF rating_for_entry.${entry.id} %]true[% ELSE %]false[% END %]"
>
[% INCLUDE _entry_title.tt include_permalink = 1 %]
[% INCLUDE _current_entry_row.tt %]
Expand Down

0 comments on commit 45f7b7d

Please sign in to comment.