-
Notifications
You must be signed in to change notification settings - Fork 416
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
Inline component variant bug #429
Inline component variant bug #429
Conversation
@BlakeWilliams Did a first pass of |
c32ade1
to
c8a1656
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@mrjonesbot mind rebasing this PR? You can remove |
c8a1656
to
7fe9780
Compare
@joelhawksley done! |
46fda84
to
dcf2db0
Compare
dcf2db0
to
39a7ccc
Compare
8969809
to
ef0f459
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.
Looks good to me! Mind adding a CHANGELOG entry?
ef0f459
to
043cb49
Compare
@mrjonesbot sorry for the extra cycle, but could you also add a note about this functionality to |
Resolves ViewComponent#319 Introduces the `#with_variant` instance method, which sets the variant to be rendered inline (with and without template). Show usage in README.md
043cb49
to
efc909d
Compare
@@ -325,6 +325,14 @@ class InlineVariantComponent < ViewComponent::Base | |||
end | |||
``` | |||
|
|||
And render them `with_variant`: |
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.
Ah right this is MD 😄
Thank you for your contribution, Nathan! ❤️ |
@mrjonesbot looking back, can you share the context for why you wanted to have this feature added? We're wondering why you'd want to override a variant in a template. |
Hey Joel, I think I was trying to learn the library and was attempting a pattern shown in the README at the time; then noticed it didn't work as described. Not sure I had a personal use case for it, can't remember now. |
Resolves #319
Summary
While rendering inline components without template files, unable to render variant
call
methods -- eg.call_email
-- using the#render :variants
option.Non working example:
Changes
Introduces the
#with_variant
instance method, which sets the variant to be rendered inline (with and without template).