-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
✨ Controls placement on resource level #3320
✨ Controls placement on resource level #3320
Conversation
Code Climate has analyzed commit 264876f 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.
Thank you for this contribution @RocKhalil!
We should wrap this logic on a concern and remove unused methods, otherwise the logic is done well!
<% | ||
resource_controls_placement = @resource.controls_placement || Avo.configuration.resource_controls_placement | ||
%> |
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.
Let's extract this logic to a concern, something like
def controls_placement
@controls_placement ||= @resource.controls_placement || Avo.configuration.resource_controls_placement
end
def resource_controls_on_the_right?
controls_placement == :right
end
def resource_controls_on_the_left?
controls_placement == :left
end
Then include the concern on the components that uses this logic.
Let's also ensure that the original methods resource_controls_on_the_right?
and resource_controls_on_the_left?
are deleted if they are no longer used.
@Paul-Bob refactored into a concern + added |
12083c9
to
e65d859
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.
It's looking good @RocKhalil!
I noticed that you added the :both
option and I can see its value.
I'm approving the PR but there is still some work to do to pass this to the finish line:
- Add docs for the
:both
option, including the version in which it was introduced. - Add tests
Feel free to let me know if you need any help.
documentation PR: avo-hq/docs.avohq.io#296 |
159a22e
to
108dd1c
Compare
108dd1c
to
264876f
Compare
Description
You can now have the placement of the actions set on the resource too. So you can have a resource with controls on the left and another one with controls on the right.
Checklist:
Manual review steps
self.controls_placement = :left
left
instead of the defaultright
value