diff --git a/buglist.cgi b/buglist.cgi index de17c06e30..8356f97420 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -29,6 +29,7 @@ use Bugzilla::Status; use Bugzilla::Token; use Date::Parse; +use List::Util qw(any); use List::MoreUtils qw(uniq); @@ -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') { @@ -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") { diff --git a/skins/standard/buglist.css b/skins/standard/buglist.css index 6f0ca67cb9..7480eab49f 100644 --- a/skins/standard/buglist.css +++ b/skins/standard/buglist.css @@ -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; + border-color: transparent; + cursor: default; + font-weight: 500; +} + .bz_query_head h1 { font-size: var(--font-size-h2); } diff --git a/template/en/default/list/list.html.tmpl b/template/en/default/list/list.html.tmpl index c868898af9..83bbefb11f 100644 --- a/template/en/default/list/list.html.tmpl +++ b/template/en/default/list/list.html.tmpl @@ -123,6 +123,32 @@