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

Filter by blog tag #738

Merged
merged 1 commit into from
Oct 9, 2023
Merged

Filter by blog tag #738

merged 1 commit into from
Oct 9, 2023

Conversation

VirginiaDooley
Copy link
Contributor

@VirginiaDooley VirginiaDooley commented Oct 3, 2023

Ref #658

-Render tags on post list and detail
-Fix filtering
-Add tags to Post list admin view
-Change tag widget to multiselect with hard coded tag values

To test, edit or create 2 blog post sin the admin view. Choose a common tag for both posts as well as a unique tag for each. Save the posts and view in the list. Click the unique tags to filter.

On blog list
Screenshot 2023-10-04 at 3 59 20 PM

On blog detail
Screenshot 2023-10-04 at 3 59 26 PM


@VirginiaDooley VirginiaDooley changed the title Filter by tag and category Filter by blog tag Oct 4, 2023
@VirginiaDooley VirginiaDooley marked this pull request as ready for review October 4, 2023 14:33
@@ -35,6 +35,14 @@ def get_queryset(self):
return qs


class TagPostListView(PostListView):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created this for clarity as there are multiple for_tag methods throughout.

@VirginiaDooley VirginiaDooley force-pushed the hotfix/blog-indexing branch 3 times, most recently from e8c978a to 9f09483 Compare October 4, 2023 15:04
@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (f94fb62) 78.57% compared to head (5d8e588) 79.08%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #738      +/-   ##
==========================================
+ Coverage   78.57%   79.08%   +0.51%     
==========================================
  Files          27       27              
  Lines         532      545      +13     
==========================================
+ Hits          418      431      +13     
  Misses        114      114              
Files Coverage Δ
democracy_club/apps/hermes/admin.py 100.00% <100.00%> (ø)
democracy_club/apps/hermes/urls.py 100.00% <100.00%> (ø)
democracy_club/apps/hermes/views.py 90.69% <100.00%> (+0.95%) ⬆️
democracy_club/urls.py 82.35% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@VirginiaDooley VirginiaDooley force-pushed the hotfix/blog-indexing branch 5 times, most recently from 4080aca to 6a44d35 Compare October 4, 2023 17:47
@VirginiaDooley VirginiaDooley requested review from Bekabyx and removed request for symroe October 4, 2023 17:49
<span aria-hidden="true">🏷️</span>
{% for tag in post.tags %}
<a href="{% url 'hermes_post_list_by_tag' tag %}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you render tags as a ul & li list? And add some CSS to show them inline rather than as a list? This will help screen readers read them out as tags.

Copy link
Contributor Author

@VirginiaDooley VirginiaDooley Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Ran Lighthouse and the page scored 100% for navigation.

-Render tags on post list and detail
-Fix filtering
-Add tags to Post list admin view
-Change tag widget to multiselect
Copy link
Contributor

@Bekabyx Bekabyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I like the way that the filtering has been done via the path rather than url params. I've checked this out locally and it seems to work as intended :)

@VirginiaDooley VirginiaDooley merged commit ded9955 into master Oct 9, 2023
3 checks passed
{% if post.tags %}
<span aria-hidden="true">🏷️</span>
{% for tag in post.tags %}
<ul>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ul needs to be outside the loop (drive by review!)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #739

VirginiaDooley added a commit that referenced this pull request Oct 9, 2023
- Rename blog tags
- Add custom css for tags in a list
- Refactor conditional when tags exist
VirginiaDooley added a commit that referenced this pull request Oct 10, 2023
- Rename blog tags
- Add custom css for tags in a list
- Refactor conditional when tags exist
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.

3 participants