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

Fix toggle without search query #863

Merged
merged 2 commits into from
Apr 25, 2022

Conversation

schmidtg
Copy link
Contributor

@schmidtg schmidtg commented Apr 24, 2022

Description

Fix the JS error when selecting a checkbox on an Index page that has no search query defined in the resource.

Fixes # (861)

Manual review steps

  1. Load the dummy app.
  2. Click on the "People" resource
  3. Open the JS console.
  4. Click any checkbox.
  5. Ensure the JS console has no errors.
  6. Ensure the data-selected-resources element is populated with IDs that were selected.

Remove the conditional for `data-selected-resources` element to render
always, and set a `hidden` css class if there are:

* no search params defined in the resource AND
* no filters present AND
* 1 or none available_view_types

Also added the `authenticity_token` to the permitted params as it was
consistently showing up in the logs.

```
Unpermitted parameter: :authenticity_token
```
@codeclimate
Copy link

codeclimate bot commented Apr 24, 2022

Code Climate has analyzed commit 32cf0e2 and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Apr 25, 2022

Codecov Report

Merging #863 (32cf0e2) into main (2fff6cc) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #863   +/-   ##
=======================================
  Coverage   93.86%   93.86%           
=======================================
  Files         457      457           
  Lines        8325     8325           
=======================================
  Hits         7814     7814           
  Misses        511      511           
Impacted Files Coverage Δ
app/controllers/avo/actions_controller.rb 75.00% <100.00%> (ø)
spec/system/avo/default_field_spec.rb 95.12% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fff6cc...32cf0e2. Read the comment docs.

Copy link
Collaborator

@adrianthedev adrianthedev left a comment

Choose a reason for hiding this comment

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

Thank you for this contribution!

@@ -32,7 +32,7 @@ From the root directory you can run `bin/dev` and that will start a foreman proc

## Seeding the database for local development

Run `AVO_ADMIN_PASSWORD=secret bin/rails db:seed` to seed the database with dummy data and create a user for yourself with the email `admin@avohq.io` and password `secret`.
Run `AVO_ADMIN_PASSWORD=secret bin/rails db:seed` to seed the database with dummy data and create a user for yourself with the email `avo@avohq.io` and password `secret`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks 👍

<% end %>
</div>
<% end %>
<div class="flex flex-col xs:flex-row xs:justify-between space-y-2 xs:space-y-0 py-4 <%= 'hidden' if @resource.search_query.nil? && @filters.empty? && available_view_types.count <= 1 %>"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was a remnant from where we had more than two divs in the panel body and we had a space-y-SOMETHING as a parent. So I went and not render this div at all in those scenarios. It's not the case anymore and we can use hidden.

@adrianthedev adrianthedev merged commit e97bacb into avo-hq:main Apr 25, 2022
@schmidtg schmidtg changed the title WIP Fix/toggle without search query Fix toggle without search query Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants