New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assign users to categories #1563
Conversation
- A user can be assigned to any number of its body's categories - The category ids are stored as a list in the user's extra field
ffc090e
to
0af3e91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :)
columns => [ 'category' ], | ||
order_by => 'category', | ||
})->all; | ||
my $result = [ map( { $_->category } @categories ) ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can probably use get_column here, something like my @categories = search({ id => …}, { order_by => 'category' })->get_column('category')->all; my $result = \@categories;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh that's nicer, thanks!
%] | ||
</p> | ||
</div> | ||
[% INCLUDE 'admin/category-checkboxes.html' %] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Came in useful, this template!
@@ -25,7 +25,7 @@ | |||
%]span[% ELSE %]a href="[% base %]/my"[% END | |||
%]>[% c.user_exists ? loc("Your account") : loc("Sign in") %]</[% c.req.uri.path == '/my' ? 'span' : 'a' %]></li>[% | |||
%]<li><[% IF c.req.uri.path == '/reports' | |||
%]span[% ELSE %]a href="[% base %]/reports"[% END | |||
%]span[% ELSE %]a href="[% base %]/reports[% IF c.user_exists %]?filter_category=[% c.user.categories.join(",") | uri | html %][% END %]"[% END |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with the front page field you've added, do you want to only output this extra part of there are categories to include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, will do that.
This pre-filters the 'all reports' link in the main nav and the /around page reached via the front page postcode form
675f550
to
15e9a1a
Compare
Left to do:
For mysociety/fixmystreetforcouncils#69