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

Ability to filter webhooks by Creative Concept #14

Merged
merged 10 commits into from
Dec 15, 2022

Conversation

ps-ruby
Copy link
Contributor

@ps-ruby ps-ruby commented Nov 30, 2022

#13

@ps-ruby ps-ruby changed the title [WIP] Ability to filter webhooks by Creative Concept Ability to filter webhooks by Creative Concept Nov 30, 2022
@ps-ruby
Copy link
Contributor Author

ps-ruby commented Nov 30, 2022

@andrewculver Do I have to also update bullet_train with new migration file?

Where do we write a test for this? I saw a test case that triggers these codes in bullet_train. Should I update the test out there or add new test cases in this repo?

@@ -4,6 +4,8 @@
<% with_field_settings form: form do %>
<%= render 'shared/fields/text_field', method: :name, options: {autofocus: true} %>
<%= render 'shared/fields/text_field', method: :url %>
<%= render 'shared/fields/super_select', method: :scaffolding_absolutely_abstract_creative_concept_id,
choices: [['None', '']] + @endpoint.creative_concepts.map { |event_type| [event_type.name, event_type.id] }, other_options: {search: true} %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we replace [['None', '']] + with allow_blank: true? Does that work with super_select? /cc @gazayas @pascallaliberte

Copy link
Contributor

@gazayas gazayas Dec 3, 2022

Choose a reason for hiding this comment

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

@andrewculver It looks like we can remove [['None', '']] and just use the allowClear option along with the placeholder option Select2 has available.

You can add the options in the stimulus controller after the options hash here (I ended up adding it as options.allowClear = true; and it worked fine), and this will pass an empty String to the params in the controller, just like with [['None'], ['']]

Concerning the Creative Concept's validation though, allow_blank: true isn't working for now because the empty string has no ID, just resulting in a nil record. For that reason I think the optional: true line that was added in this PR in the EndpointSupport module might be a viable option. That is if we're ok with the Creative Concept being saved to the database as nil.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ps-ruby If adding allow_blank: true doesn't fix the problem, then it's a bug IMO and I need to get that fixed in bullet_train-fields.

@andrewculver
Copy link
Contributor

Great work! Love how you solved this. Left some feedback. Let's get this PR merged, and then we'll open a new issue and move onto the next step of making it easier for downstream developers to add filters for other model types.

@andrewculver andrewculver merged commit bfa35c0 into main Dec 15, 2022
@andrewculver andrewculver deleted the feature/creative-concept-filter branch December 15, 2022 00:45
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