-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
feature: radio field #3425
feature: radio field #3425
Conversation
Code Climate has analyzed commit dfead97 and detected 0 issues on this pull request. View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it!
Thank you!
@@ -10,7 +10,7 @@ class Avo::Resources::Person < Avo::BaseResource | |||
|
|||
def fields | |||
field :name, as: :text, link_to_record: true, sortable: true, stacked: true | |||
field :type, as: ::Pluggy::Fields::RadioField, name: "Type", options: {Spouse: "Spouse", Sibling: "Sibling"}, include_blank: true, filterable: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
spec/system/avo/radio_field_spec.rb
Outdated
@@ -0,0 +1,60 @@ | |||
require "rails_helper" | |||
|
|||
RSpec.describe "RadioField", type: :system do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can get away with a feature test instead of a system one.
6352b0a
to
b855474
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! Thank you @thiagoyoussef !
@@ -10,7 +10,7 @@ class Avo::Resources::Person < Avo::BaseResource | |||
|
|||
def fields | |||
field :name, as: :text, link_to_record: true, sortable: true, stacked: true | |||
field :type, as: ::Pluggy::Fields::RadioField, name: "Type", options: {Spouse: "Spouse", Sibling: "Sibling"}, include_blank: true, filterable: true | |||
field :type, as: :pluggy_radio, name: "Type", options: {Spouse: "Spouse", Sibling: "Sibling"}, include_blank: true, filterable: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change really necessary? I think it's a good test for declaring fields using the constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change to use the constant then! It's not necessary, just thought would be a better practice.
Description
Fixes #3140
Checklist:
Screenshots & recording