mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:10:17 +08:00
7fcef5f2f9
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.
20 lines
366 B
Ruby
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
|