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

implement filters in nested select #300 #301

Merged

Conversation

stefsava
Copy link

No description provided.

Copy link
Member

@rjherrera rjherrera left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, it seems alright but I think there are some things that need to be addressed before we can merge:

  1. This change includes a new feature so there should be documentation for it, also it should be tested.
  2. Does this break when there are no filters? Did you consider that case?

Let us know!

@stefsava
Copy link
Author

Thanks for the PR, it seems alright but I think there are some things that need to be addressed before we can merge:

  1. This change includes a new feature so there should be documentation for it, also it should be tested.
  2. Does this break when there are no filters? Did you consider that case?

Let us know!

My PR simply does something already documented in select2_nested_select.md for a long time but never implemented.
It is not necessary to update the documentation and does not introduce any breaking changes.
I agree that it is always good to test all the code, and I intend to add tests, but I don't know when I will have the time.
In this case the modification is very simple so if you are preparing a new release with many PR and want to add this IMHO you can do it immediately.

on_input_ctx("invoice_city_id") { expect_select2_selection("Colina") }
end

context "updating medium level" do

Choose a reason for hiding this comment

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

Start context description with 'when', 'with', or 'without'.


create_cities
create_invoice(city: @colina)
visit edit_admin_invoice_path(@invoice)

Choose a reason for hiding this comment

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

Replace instance variable with local variable or let.

end

create_cities
create_invoice(city: @colina)

Choose a reason for hiding this comment

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

Replace instance variable with local variable or let.

level_2: {
attribute: :region_id,
# filters: { name_contains: 'Met' }
},

Choose a reason for hiding this comment

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

Indent the right brace the same as the start of the line where the left brace is.

level_1: { attribute: :country_id },
level_2: {
attribute: :region_id,
# filters: { name_contains: 'Met' }

Choose a reason for hiding this comment

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

Incorrect indentation detected (column 28 instead of 30).

f.input :city_id, as: :nested_select,
level_1: { attribute: :country_id },
level_2: {
attribute: :region_id,

Choose a reason for hiding this comment

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

Avoid comma after the last item of a hash.

end
end

context "without filters", focus: true do

Choose a reason for hiding this comment

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

Focused spec found.

on_input_ctx("invoice_city_id") { expect_select2_selection("Colina") }
end

context "updating medium level" do

Choose a reason for hiding this comment

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

Start context description with 'when', 'with', or 'without'.


create_cities
create_invoice(city: @colina)
visit edit_admin_invoice_path(@invoice)

Choose a reason for hiding this comment

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

Replace instance variable with local variable or let.

end

create_cities
create_invoice(city: @colina)

Choose a reason for hiding this comment

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

Replace instance variable with local variable or let.

level_2: {
attribute: :region_id,
filters: { name_contains: 'Met' }
},
Copy link

Choose a reason for hiding this comment

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

Indent the right brace the same as the start of the line where the left brace is.

@stefsava
Copy link
Author

stefsava commented May 5, 2020

I added the tests as required.
I hope it is enough for the merge in the next version.

@rjherrera
Copy link
Member

thank you! I'll review it as soon as I can!

@ldlsegovia ldlsegovia merged commit 4d38c45 into platanus:master May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants