discourse/app/controllers/admin/plugins_controller.rb
Martin Brennan 7fcef5f2f9
FIX: Show admin plugin route sub-links in sidebar (#24982)
This changes the Plugins link in the admin sidebar to
be a section instead, which then shows all enabled plugin
admin routes (which are custom routes some plugins e.g.
chat define).

This is done via adding some special preloaded data for
all controllers based on AdminController, and also specifically
on Admin::PluginsController, to have the routes loaded without
additional requests on page load.

We just use a cog for all the route icons for now...we don't
have anything better.
2023-12-21 11:37:20 +10:00

21 lines
442 B
Ruby

# frozen_string_literal: true
class Admin::PluginsController < Admin::StaffController
def index
render_serialized(
Discourse.plugins_sorted_by_name(enabled_only: false),
AdminPluginSerializer,
root: "plugins",
)
end
private
def preload_additional_json
store_preloaded(
"enabledPluginAdminRoutes",
MultiJson.dump(Discourse.plugins_sorted_by_name.filter_map(&:admin_route)),
)
end
end