Skip to content

Commit

Permalink
[WIP] Makes category a multi-select
Browse files Browse the repository at this point in the history
Trying to make batches of categories selectable by label:

Made the form a multi, though that has lost the styling on optgroup labels.

As I see it, clicking on an optgroup label should select the group of categories
under it. Styling needs to be fixed for the label - and/or the label should
have its own checkbox.
  • Loading branch information
MorayMySoc committed Nov 23, 2023
1 parent 965c015 commit 59165af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/App/Controller/Dashboard.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ sub index : Path : Args(0) {
$c->forward('/report/stash_category_groups', [ $c->stash->{contacts} ]);

# See if we've had anything from the body dropdowns
$c->stash->{category} = $c->get_param('category');
$c->stash->{category} = [ $c->get_param_list('category') ];
$c->stash->{ward} = [ $c->get_param_list('ward') ];

if ($c->user_exists) {
Expand Down
4 changes: 2 additions & 2 deletions perllib/FixMyStreet/Reporting.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ has on_updates => ( is => 'lazy', default => sub { $_[0]->type eq 'updates' } );

has body => ( is => 'ro', isa => Maybe[InstanceOf['FixMyStreet::DB::Result::Body']] );
has wards => ( is => 'ro', isa => ArrayRef[Int], default => sub { [] } );
has category => ( is => 'ro', isa => Maybe[Str] );
has category => ( is => 'ro', isa => ArrayRef[Maybe[Str]], default => sub { [] } );
has state => ( is => 'ro', isa => Maybe[Str] );
has start_date => ( is => 'ro',
isa => Str,
Expand Down Expand Up @@ -90,7 +90,7 @@ has csv_extra_data => ( is => 'rw', isa => CodeRef );
has filename => ( is => 'rw', isa => Str, lazy => 1, default => sub {
my $self = shift;
my %where = (
category => $self->category,
category => join(',', @{$self->category}),
state => $self->state,
ward => join(',', @{$self->wards}),
start_date => $self->start_date,
Expand Down
4 changes: 2 additions & 2 deletions templates/web/base/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ <h1>[% loc('Summary statistics') %]</h1>

<p>
<label for="category">[% loc('Category:') %]</label>
<select class="form-control" name="category" id="category"><option value=''>[% loc('All') %]</option>
<select class="form-control js-multiple" multiple name="category" id="category"><option value=''>[% loc('All') %]</option>
[% BLOCK category_option %]
<option value='[% cat.category | html %]'[% ' selected' IF category == cat.category %]>[% cat.category_display | html %]</option>
<option value='[% cat.category | html %]'[% ' selected' IF category.grep(cat.category).size %]>[% cat.category_display | html %]</option>
[% END %]
[%~ INCLUDE 'report/new/_category_select.html' ~%]
</select>
Expand Down

0 comments on commit 59165af

Please sign in to comment.