Discourse 插件开发 part5

(还没翻译完)

原文地址

Beginner's Guide to Creating Discourse Plugins Part 5: Admin Interfaces

有时候 site setting 依然不够,
举个例子,https://github.com/discourse/discourse-akismet
这个插件安装之后
可以看到在 admin panel 直接多加了一个选项。

这一篇教程里我会教你怎么给你的插件加到 admin panel 里面去。
我这里假设插件名叫 purple-tentacle

Setting up the Admin Route

# name: purple-tentacle
# about: A sample plugin showing how to add a plugin route
# version: 0.1
# authors: Robin Ward
# url: https://github.com/discourse/purple-tentacle

add_admin_route 'purple_tentacle.title', 'purple-tentacle'

Discourse::Application.routes.append do
  get '/admin/plugins/purple-tentacle' => 'admin/plugins#index', constraints: StaffConstraint.new
end

Discourse 插件开发 part5
Share this

Subscribe to 1c7 的博客