-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
base: main
Are you sure you want to change the base?
✨ Controls placement on resource level #3320
Conversation
Code Climate has analyzed commit e65d859 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
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