lib/avo/app.rb in avo-1.0.5 vs lib/avo/app.rb in avo-1.1.0.pre.1
- old
+ new
@@ -127,13 +127,26 @@
Services::AuthorizationService.authorize user, resource.model, Avo.configuration.authorization_methods.stringify_keys["index"], raise_exception: false
end
.sort_by { |r| r.name }
end
- def get_navigation_items(user = nil)
+ def resources_navigation(user = nil)
get_available_resources(user).select do |resource|
resource.model_class.present?
end
+ end
+
+ # Insert any partials that we find in app/views/avo/sidebar/items.
+ def get_sidebar_partials
+ Dir.glob(Rails.root.join("app", "views", "avo", "sidebar", "items", "*.html.erb"))
+ .map do |path|
+ File.basename path
+ end
+ .map do |filename|
+ # remove the leading underscore (_)
+ filename[0] = ""
+ filename
+ end
end
def draw_routes
# We should eager load all the classes so we find all descendants
Rails.application.eager_load!