discourse/app/controllers/admin/admin_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

20 lines
366 B
Ruby

# frozen_string_literal: true
class Admin::AdminController < ApplicationController
requires_login
before_action :ensure_admin
def index
render body: nil
end
private
def preload_additional_json
store_preloaded(
"enabledPluginAdminRoutes",
MultiJson.dump(Discourse.plugins_sorted_by_name.filter_map(&:admin_route)),
)
end
end