Gary Pendergast f439bf14cc
DEV: Refactor the Automation Plugin UI to match admin UI guidelines (#31060)
This change updates the Automation plugin to make use of the `use_new_show_route` plugin flag, as well as generally updating the UI to match current admin UI guidelines. Notable changes include:

- Moving template/router/controller files to make use of the `admin.adminPlugins.show` route.
- Changing the URIs from `/admin/plugins/discourse-automation` to `/admin/plugins/automation`, to match the `PLUGIN_NAME`.
- Adding UI wrappers around the New/Edit forms, and polishing the list of defined automations.
2025-02-05 14:34:15 +11:00

35 lines
1.2 KiB
Ruby

# frozen_string_literal: true
DiscourseAutomation::Engine.routes.draw do
scope format: :json, constraints: AdminConstraint.new do
post "/automations/:id/trigger" => "automations#trigger"
end
scope format: :json do
delete "/user-global-notices/:id" => "user_global_notices#destroy"
put "/append-last-checked-by/:post_id" => "append_last_checked_by#post_checked"
end
scope "/admin/plugins/automation",
as: "admin_discourse_automation",
constraints: AdminConstraint.new do
scope format: false do
get "/automation" => "admin#index"
get "/automation/new" => "admin#new"
get "/automation/:id" => "admin#edit"
end
scope format: :json do
get "/scriptables" => "admin_scriptables#index"
get "/triggerables" => "admin_triggerables#index"
get "/automations" => "admin_automations#index"
get "/automations/:id" => "admin_automations#show"
delete "/automations/:automation_id" => "admin_automations#destroy"
put "/automations/:id" => "admin_automations#update"
post "/automations" => "admin_automations#create"
end
end
end
Discourse::Application.routes.draw { mount ::DiscourseAutomation::Engine, at: "/" }