mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: support for settings/locales in plugin generator (#6341)
This commit is contained in:
parent
103509b9dd
commit
90e67b671b
|
@ -49,6 +49,15 @@ class PluginGenerator < Rails::Generators::NamedBase
|
|||
template 'javascript.es6.erb', File.join('plugins', dasherized_name, 'assets/javascripts/initializers', "#{dasherized_name}.es6")
|
||||
end
|
||||
|
||||
def create_settings_file
|
||||
template 'settings.yml.erb', File.join('plugins', dasherized_name, 'config', 'settings.yml')
|
||||
end
|
||||
|
||||
def create_locales_file
|
||||
template 'client.en.yml.erb', File.join('plugins', dasherized_name, 'config/locales', 'client.en.yml')
|
||||
template 'server.en.yml.erb', File.join('plugins', dasherized_name, 'config/locales', 'server.en.yml')
|
||||
end
|
||||
|
||||
def create_gitignore_entry
|
||||
plugin_entry = "!/plugins/#{dasherized_name}"
|
||||
|
||||
|
|
3
lib/generators/plugin/templates/client.en.yml.erb
Normal file
3
lib/generators/plugin/templates/client.en.yml.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
en:
|
||||
js:
|
||||
<%= underscored_name %>:
|
3
lib/generators/plugin/templates/server.en.yml.erb
Normal file
3
lib/generators/plugin/templates/server.en.yml.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
en:
|
||||
site_settings:
|
||||
<%= underscored_name %>_enabled: "Enable <%= name %> plugin"
|
4
lib/generators/plugin/templates/settings.yml.erb
Normal file
4
lib/generators/plugin/templates/settings.yml.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
plugins:
|
||||
<%= underscored_name %>_enabled:
|
||||
default: true
|
||||
client: true
|
Loading…
Reference in New Issue
Block a user