forked from pfaffman/discourse-topic-default-tag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.rb~
49 lines (31 loc) · 955 Bytes
/
plugin.rb~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# name: TopicDefaultTag
# about:
# version: 0.1
# authors: pfaffman
# url: https://github.com/pfaffman
register_asset "stylesheets/common/topic-default-tag.scss"
enabled_site_setting :topic_default_tag_enabled
PLUGIN_NAME ||= "TopicDefaultTag".freeze
after_initialize do
# see lib/plugin/instance.rb for the methods available in this context
module ::TopicDefaultTag
class Engine < ::Rails::Engine
engine_name PLUGIN_NAME
isolate_namespace TopicDefaultTag
end
end
require_dependency "application_controller"
class TopicDefaultTag::ActionsController < ::ApplicationController
requires_plugin PLUGIN_NAME
before_action :ensure_logged_in
def list
render json: success_json
end
end
TopicDefaultTag::Engine.routes.draw do
get "/list" => "actions#list"
end
Discourse::Application.routes.append do
mount ::TopicDefaultTag::Engine, at: "/topic-default-tag"
end
end