Skip to content
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

Merged
merged 3 commits into from Oct 31, 2016
Merged

Conversation

davea
Copy link
Member

@davea davea commented Oct 21, 2016

  • Users can be assigned to one or more of their parent body's categories
  • The 'all reports' link is prefiltered with the user's categories, if they have any, on the Oxfordshire cobrand

Left to do:

  • Prefilter /around when entering a postcode/location
  • Check other places in the site where it makes sense to prefilter

For mysociety/fixmystreetforcouncils#69

 - 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
@davea davea force-pushed the issues/forcouncils/69-user-categories branch 2 times, most recently from ffc090e to 0af3e91 Compare October 28, 2016 14:08
Copy link
Member

@dracos dracos left a 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 ) ];
Copy link
Member

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;

Copy link
Member Author

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' %]
Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

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.

@dracos dracos added Reviewed and removed Reviewing labels Oct 28, 2016
This pre-filters the 'all reports' link in the main nav and the /around page
reached via the front page postcode form
@davea davea force-pushed the issues/forcouncils/69-user-categories branch from 675f550 to 15e9a1a Compare October 31, 2016 13:18
@davea davea merged commit 15e9a1a into master Oct 31, 2016
@davea davea removed the Reviewed label Oct 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants