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

[Story]: Add checkboxes to the items in the search filters #598

Open
wants to merge 57 commits into
base: develop
Choose a base branch
from

Conversation

aleeexgreeen
Copy link
Contributor

What this PR accomplishes

  • Separates access level from filter sidebar and adds it to the search bar
  • Defaults to open upon opening the dataset search page or an individual group / ministry page
  • Defaults to open when all checkboxes are unchecked
  • Reduce templates rendered on the dataset page (improving marginally the performance of page)
  • Use of "search term" instead of "keyword(s)" and the use of "total"
  • Clear filters button and filter facets now submit form instead of redirecting to links with filters as params in URL
  • Search reset "x" now works when typing in a empty search box
  • Adds text to empty search with additional datasets are present in different access levels
  • Removes duplicate forms wrapping the search_form.html
  • Adds callout with search term (if present) and access level(s) selected
  • Adds an escape to the query string for search results

Issue(s) addressed

  • DATA-1083, DATA-1272, DATA-1514

What needs review

  • All filters should allow multiple checkboxes to be selected and operate as OR.
  • Relationship between filters should operate as AND
  • Callout is updated with every checkbox selected. When all checkboxes are selected "All levels" is displayed
  • Callout is updated when there is no results. Callout is updated when there is a search term present
  • The Access level filter should contain 3 items: Open, Under review and restricted. In this order
    Filters sidebar:
  • All selected checkboxes should be visible, including when there are more than 5 items (will not be bumping it to the top of list)
  • If there are more than 5 items selected than the default view be extended to more than 5 to include all selected items.
    Access level Zero results:
  • if there are zero results in a search with all 3 checkboxes selected Display message “Please try another search or reach out to us if you think data is missing.“
  • if there are zero results in a search for the selected checkbox(es) and there are datasets available in unselected checkboxes, there should be a message with a link to the search results of the access level with datasets displayed in the body of the page
    Other things needing review:
  • Translations are present and correct
  • implementation matches Figma design (to the best of my ability, Figma screens are not consistent)
  • The number of datasets on homepage equals total dataset amount and not open dataset amount
  • The number of datasets per on each Ministry on the ministry page is the total dataset amount and not open dataset amount
  • Navigating the website, there are no internal server errors
  • Clicking the search reset "x" when typing in a empty search box, resets the search box to empty

Tests should be done on individual ministry and group pages and the dataset search page

…rms, reorganized the checkboxes snippet for multipurpose use
@KatiRG
Copy link
Collaborator

KatiRG commented Sep 5, 2024

Can you djlint the html files?

@KatiRG
Copy link
Collaborator

KatiRG commented Sep 13, 2024

@aleeexgreeen I found the following case where 1 dataset exists at level Restricted but when the Restricted access level is selected with the Open checkbox selected as well (also when all checkboxes are selected), that dataset is not shown and the callout says "No datasets":
Screenshot 2024-09-13 at 15 23 16

Steps to reproduce:

  1. select Restricted then deselect Open
  2. select Topic aggregates (1)
  3. select Open checkbox (and can also select Under Review checkbox so that all checkboxes are selected)

@aleeexgreeen
Copy link
Contributor Author

@aleeexgreeen I found the following case where 1 dataset exists at level Restricted but when the Restricted access level is selected with the Open checkbox selected as well (also when all checkboxes are selected), that dataset is not shown and the callout says "No datasets": Screenshot 2024-09-13 at 15 23 16

Steps to reproduce:

  1. select Restricted then deselect Open
  2. select Topic aggregates (1)
  3. select Open checkbox (and can also select Under Review checkbox so that all checkboxes are selected)

Hi @KatiRG, I don't have the environment or access set up at the moment, but can you revert the change proposed in #598 (comment) and let me know if this is still an issue?

@KatiRG
Copy link
Collaborator

KatiRG commented Sep 16, 2024

@aleeexgreeen I found the following case where 1 dataset exists at level Restricted but when the Restricted access level is selected with the Open checkbox selected as well (also when all checkboxes are selected), that dataset is not shown and the callout says "No datasets": Screenshot 2024-09-13 at 15 23 16
Steps to reproduce:

  1. select Restricted then deselect Open
  2. select Topic aggregates (1)
  3. select Open checkbox (and can also select Under Review checkbox so that all checkboxes are selected)

Hi @KatiRG, I don't have the environment or access set up at the moment, but can you revert the change proposed in #598 (comment) and let me know if this is still an issue?

Thanks @aleeexgreeen ! This solves the problem. I didn't notice the brackets around the second or grouping! I'll revert

# To show all access levels on dataset counts on
# the homepage and org/group pages
if ('fq' not in search_params) or (fq and not fl):
fq_list = search_params.setdefault('fq_list', [])
Copy link
Collaborator

Choose a reason for hiding this comment

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

fq_list is set here to [] but is never used again outside this if statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because the fq_list is used with setdefault(). The default value for fq_list is being set and modified within the if statement, so there is no need to use it outside the if statement, because it is being updated directly into search_params

Copy link
Collaborator

Choose a reason for hiding this comment

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

There are indentation irregularities in this file that are not caught by djlint for some reason. e.g. in block {% block search_facets %} and onwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You may have a different version of djlint or what you are using is not specifically tailored for this repo. There are files which the command pre-commit run --hook-stage manual format works from (see .djlintrc and djlint_rules.yaml). I say this because when running pre-commit run --hook-stage manual format there are no formatting errors in the search_form.html

<div>
{{ h.snippet('snippets/facet_arrangement.html', single_option_facets=single_option_facets, extras={'id':c.group_dict.id}) }}
</div>
<div>{{ h.snippet('snippets/facet_arrangement.html', extras={'id':c.group_dict.id}) }}</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

In organization/read.html, you pass single_option_facet="organization" to facet_arrangement.html:

{{ h.snippet('snippets/facet_arrangement.html', extras={'id':c.group_dict.id}, 
single_option_facet="organization") }}

I'm wondering if you need to do the same for groups. Otherwise, all the groups will be listed in the facet column of an individual group page.

Screenshot 2024-09-17 at 18 22 50 (screenshot from local)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A dataset can only have one organization but a dataset can have multiple groups. On the groups page, does it make sense to show what other groups the datasets may be connected to?

<use xlink:href="#ontario-icon-filter"></use>
</svg>
{{ title }}
{% set screen_reader_text = "No search filters applied for "+title+". Options are " %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Chrome screen reader is not reading this text. Can you confirm? And what are the options that are supposed to be read out?

{% set screen_reader_text = "No search filters applied for "+title+". Options are " %}
{% if items %}
{% if (items|selectattr("active")|list|length) > 0 %}
{% set screen_reader_text = "Search filters are applied for "+title+"." %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Chrome screen reader is not reading this text after a topic is selected. Can you confirm?

</span>
</span>
{% endif %}
{% endfor %}
{% if c.fields|length >= 2 %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make it >= 3 since there is always the access_level element in the c.fields array that will count as 1, e.g.:

Screenshot 2024-09-18 at 16 23 06

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't solve the problem, as you can have multiple access levels checked and c.fields|length will increase. All 3 access levels checked will have the same effect (The displaying of the button is all done in the javascript). I've opted to removing the if statement and leaving the javascript as if.

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.

2 participants