@@ -3,43 +3,40 @@ class Engine < ::Rails::Engine
33 isolate_namespace ForemanPluginTemplate
44 engine_name 'foreman_plugin_template'
55
6- config . autoload_paths += Dir [ "#{ config . root } /app/controllers/concerns" ]
7- config . autoload_paths += Dir [ "#{ config . root } /app/helpers/concerns" ]
8- config . autoload_paths += Dir [ "#{ config . root } /app/models/concerns" ]
9- config . autoload_paths += Dir [ "#{ config . root } /app/overrides" ]
10-
116 # Add any db migrations
127 initializer 'foreman_plugin_template.load_app_instance_data' do |app |
138 ForemanPluginTemplate ::Engine . paths [ 'db/migrate' ] . existent . each do |path |
149 app . config . paths [ 'db/migrate' ] << path
1510 end
1611 end
1712
18- initializer 'foreman_plugin_template.register_plugin' , :before => :finisher_hook do |_app |
19- Foreman ::Plugin . register :foreman_plugin_template do
20- requires_foreman '>= 3.7.0'
21- register_gettext
13+ initializer 'foreman_plugin_template.register_plugin' , :before => :finisher_hook do |app |
14+ app . reloader . to_prepare do
15+ Foreman ::Plugin . register :foreman_plugin_template do
16+ requires_foreman '>= 3.14.0'
17+ register_gettext
2218
23- # Add Global files for extending foreman-core components and routes
24- register_global_js_file 'global'
19+ # Add Global files for extending foreman-core components and routes
20+ register_global_js_file 'global'
2521
26- # Add permissions
27- security_block :foreman_plugin_template do
28- permission :view_foreman_plugin_template , { :'foreman_plugin_template/example' => [ :new_action ] ,
29- :react => [ :index ] }
30- end
22+ # Add permissions
23+ security_block :foreman_plugin_template do
24+ permission :view_foreman_plugin_template , { :'foreman_plugin_template/example' => [ :new_action ] ,
25+ :react => [ :index ] }
26+ end
3127
32- # Add a new role called 'Discovery' if it doesn't exist
33- role 'ForemanPluginTemplate' , [ :view_foreman_plugin_template ]
28+ # Add a new role called 'Discovery' if it doesn't exist
29+ role 'ForemanPluginTemplate' , [ :view_foreman_plugin_template ]
3430
35- # add menu entry
36- sub_menu :top_menu , :plugin_template , icon : 'pficon pficon-enterprise' , caption : N_ ( 'Plugin Template' ) , after : :hosts_menu do
37- menu :top_menu , :welcome , caption : N_ ( 'Welcome Page' ) , engine : ForemanPluginTemplate ::Engine
38- menu :top_menu , :new_action , caption : N_ ( 'New Action' ) , engine : ForemanPluginTemplate ::Engine
39- end
31+ # add menu entry
32+ sub_menu :top_menu , :plugin_template , icon : 'pficon pficon-enterprise' , caption : N_ ( 'Plugin Template' ) , after : :hosts_menu do
33+ menu :top_menu , :welcome , caption : N_ ( 'Welcome Page' ) , engine : ForemanPluginTemplate ::Engine
34+ menu :top_menu , :new_action , caption : N_ ( 'New Action' ) , engine : ForemanPluginTemplate ::Engine
35+ end
4036
41- # add dashboard widget
42- widget 'foreman_plugin_template_widget' , name : N_ ( 'Foreman plugin template widget' ) , sizex : 4 , sizey : 1
37+ # add dashboard widget
38+ widget 'foreman_plugin_template_widget' , name : N_ ( 'Foreman plugin template widget' ) , sizex : 4 , sizey : 1
39+ end
4340 end
4441 end
4542
0 commit comments