mirror of
https://github.com/discourse/discourse.git
synced 2025-06-24 22:11:34 +08:00

Followup e26a1175d7c33746bddbc858ad89e68cc14beefe Adds extra functionality and tests for the admin search modal. * Show third level plugin config pages in search, e.g. AI Usage * Remember last used search filters * Allow navigating search results with keyboard, using tab or up/down and enter to go to result * Add a placeholder beneath search input to tell the admin what to do * Add a full page search at `/admin/search` which can be reached from pressing Enter on the search input * Add specs for modal and full page search * Change admin sidebar filter "no results found" to point to full page search * Add keyboard shortcut help to modal for admin search
30 lines
965 B
Ruby
30 lines
965 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Admin::SearchController < Admin::AdminController
|
|
RESULT_TYPES = %w[page setting theme component report].freeze
|
|
|
|
def index
|
|
# TODO (martin) Include reports here too, need to refact
|
|
# the reports controller into a reusable lookup service first.
|
|
respond_to do |format|
|
|
format.json do
|
|
render_json_dump(
|
|
settings:
|
|
SiteSetting.all_settings(
|
|
filter_names: params[:filter_names],
|
|
filter_area: params[:filter_area],
|
|
filter_plugin: params[:plugin],
|
|
filter_categories: Array.wrap(params[:categories]),
|
|
include_locale_setting: params[:filter_area] == "localization",
|
|
basic_attributes: true,
|
|
),
|
|
themes_and_components:
|
|
serialize_data(Theme.include_relations.order(:name), BasicThemeSerializer),
|
|
)
|
|
end
|
|
|
|
format.html { render body: nil }
|
|
end
|
|
end
|
|
end
|