Replies: 4 comments 3 replies
-
Hi Vitaly, Not sure I see what you mean. Like if you have a |
Beta Was this translation helpful? Give feedback.
-
in other words instead of showing all the resources using
I want to show/iterate ove one group only in one page and a different group on a different page. So I need to do something that go into a particular resource and label it as 'Marketing Stuff If there no way to label or tag as yet then please give me a clue how to groupd them and then refer to the group / iterate of a group of resources not all of them. Cheers! |
Beta Was this translation helpful? Give feedback.
-
In other words how to use this
|
Beta Was this translation helpful? Give feedback.
-
So, if you haven't already, you should eject the sidebar view to take control of the items shown in the sidebar. Then you create the rules you want. If you do this Then you can add them back to your sidebar like so: items.each do |label, resource| %>
<%= render Avo::NavigationLinkComponent.new label: label, path: resources_path(resource.model_class) %>
<% end %>
So in essence you should do something like this: items = Avo::App.resources_navigation(_current_user)
# manipulate items while transforming it into a hash with the desired label
# ex:
items = items.map do |resource|
if resource.name === 'User" && SOME_OTHER_CONDITION
return ['Marketing', resource]
end
[resource.name.pluralize.humanize, resource]
end.to_h
items.each do |label, resource| %>
<%= render Avo::NavigationLinkComponent.new label: label, path: resources_path(resource.model_class) %>
<% end %>
|
Beta Was this translation helpful? Give feedback.
-
Say I want to display only links to resources in a certain group.
How can I tag/label a resource and then pick only resources with that label?
Or just group them somehow and then pick up a bunch by a group name.
Many thanks
Beta Was this translation helpful? Give feedback.
All reactions