Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
35 changes: 35 additions & 0 deletions buglist.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use Bugzilla::Status;
use Bugzilla::Token;

use Date::Parse;
use List::Util qw(any);
use List::MoreUtils qw(uniq);


Expand Down Expand Up @@ -887,6 +888,35 @@ $vars->{'displaycolumns'} = \@displaycolumns;
$vars->{'openstates'} = [BUG_STATE_OPEN];
$vars->{'closedstates'} = [map { $_->name } closed_bug_statuses()];

# Determine which status filter tab is active for the toggle UI.
{
my @requested = $params->param('bug_status');
if (!@requested || any { $_ eq '__all__' } @requested) {
$vars->{'status_filter'} = 'all';
}
elsif (any { $_ eq '__open__' } @requested) {
$vars->{'status_filter'} = 'open';
}
elsif (any { $_ eq '__closed__' } @requested) {
$vars->{'status_filter'} = 'closed';
}
else {
my %open_set = map { $_ => 1 } BUG_STATE_OPEN;
my %closed_set = map { $_ => 1 } map { $_->name } closed_bug_statuses();
my $has_open = grep { $open_set{$_} } @requested;
my $has_closed = grep { $closed_set{$_} } @requested;
if ($has_open && !$has_closed) {
$vars->{'status_filter'} = 'open';
}
elsif ($has_closed && !$has_open) {
$vars->{'status_filter'} = 'closed';
}
else {
$vars->{'status_filter'} = 'all';
}
}
}

# The iCal file needs priorities ordered from 1 to 9 (highest to lowest)
# If there are more than 9 values, just make all the lower ones 9
if ($format->{'extension'} eq 'ics') {
Expand Down Expand Up @@ -1057,6 +1087,11 @@ else {
# Set 'urlquerypart' once the buglist ID is known.
$vars->{'urlquerypart'}
= $params->canonicalize_query('order', 'cmdtype', 'query_based_on', 'token');
# Excludes resolution alongside bug_status from the query used by status toggle buttons.
# resolution is coupled to bug_status, so both must be dropped together
$vars->{'urlquerypart_no_status'}
= $params->canonicalize_query('order', 'cmdtype', 'query_based_on', 'token',
'bug_status', 'resolution');

if ($format->{'extension'} eq "csv") {

Expand Down
37 changes: 37 additions & 0 deletions skins/standard/buglist.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,43 @@
text-align: center;
}

.bz_status_toggle {
display: flex;
align-items: center;
gap: 4px;
margin: 8px 0;
}

.bz_status_toggle_label {
color: var(--secondary-label-color);
font-size: var(--font-size-small);
margin-right: 4px;
}

.bz_status_toggle_btn {
display: inline-block;
padding: 3px 12px;
border: 1px solid var(--secondary-region-border-color);
border-radius: 3px;
font-size: var(--font-size-small);
text-decoration: none;
color: var(--link-text-color);
background: transparent;
cursor: pointer;
}

.bz_status_toggle_btn:hover {
background: var(--secondary-region-background-color);
}

.bz_status_toggle_btn.active {
background: var(--link-text-color);
color: #fff;
Comment thread
Xzzz marked this conversation as resolved.
border-color: transparent;
cursor: default;
font-weight: 500;
}

.bz_query_head h1 {
font-size: var(--font-size-h2);
}
Expand Down
26 changes: 26 additions & 0 deletions template/en/default/list/list.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,32 @@

<hr>

[%############################################################################%]
[%# Status Filter Toggle #%]
[%############################################################################%]

[% IF !dotweak %]
[% SET base_status_url = basepath _ "buglist.cgi?" _ urlquerypart_no_status %]
<div class="bz_status_toggle">
<span class="bz_status_toggle_label">Show:</span>
[% IF status_filter == 'open' %]
<span class="bz_status_toggle_btn active">Open</span>
[% ELSE %]
<a class="bz_status_toggle_btn" href="[% base_status_url FILTER html %]&amp;bug_status=__open__[%- "&order=$qorder" FILTER html IF order %]">Open</a>
[% END %]
[% IF status_filter == 'closed' %]
<span class="bz_status_toggle_btn active">Closed</span>
[% ELSE %]
<a class="bz_status_toggle_btn" href="[% base_status_url FILTER html %]&amp;bug_status=__closed__[%- "&order=$qorder" FILTER html IF order %]">Closed</a>
[% END %]
[% IF status_filter == 'all' %]
<span class="bz_status_toggle_btn active">All</span>
[% ELSE %]
<a class="bz_status_toggle_btn" href="[% base_status_url FILTER html %]&amp;bug_status=__all__[%- "&order=$qorder" FILTER html IF order %]">All</a>
[% END %]
Comment thread
Xzzz marked this conversation as resolved.
</div>
[% END %]

[%############################################################################%]
[%# Preceding Status Line #%]
[%############################################################################%]
Expand Down
Loading