mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 20:23:41 +08:00
52 lines
1.2 KiB
Plaintext
52 lines
1.2 KiB
Plaintext
# name: <%= name %>
|
|
# about:
|
|
# version: 0.1
|
|
# authors: <%= @github_username %>
|
|
# url: https://github.com/<%= @github_username %>
|
|
|
|
<% if @options["stylesheet"] %>
|
|
register_asset "stylesheets/common/<%= dasherized_name %>.scss"
|
|
<% end %>
|
|
|
|
enabled_site_setting :<%= underscored_name %>_enabled
|
|
|
|
PLUGIN_NAME ||= "<%= name %>".freeze
|
|
|
|
after_initialize do
|
|
<% if @options['help'] %>
|
|
# see lib/plugin/instance.rb for the methods available in this context
|
|
<% end %>
|
|
|
|
module ::<%= classified_name %>
|
|
class Engine < ::Rails::Engine
|
|
engine_name PLUGIN_NAME
|
|
isolate_namespace <%= classified_name %>
|
|
end
|
|
end
|
|
|
|
<% if @options["scheduled_job"] %>
|
|
require File.expand_path("../jobs/scheduled/check_<%= underscored_name %>.rb", __FILE__)
|
|
<% end %>
|
|
|
|
<% if @options["controller"] %>
|
|
require_dependency "application_controller"
|
|
class <%= name %>::ActionsController < ::ApplicationController
|
|
requires_plugin PLUGIN_NAME
|
|
|
|
before_action :ensure_logged_in
|
|
|
|
def list
|
|
render json: success_json
|
|
end
|
|
end
|
|
|
|
<%= name %>::Engine.routes.draw do
|
|
get "/list" => "actions#list"
|
|
end
|
|
|
|
Discourse::Application.routes.append do
|
|
mount ::<%= name %>::Engine, at: "/<%= dasherized_name %>"
|
|
end
|
|
<% end %>
|
|
end
|