Class: Redmine::Generators::ProjectMenuGenerator

Inherits:
Rails::Generators::ModelGenerator
  • Object
show all
Includes:
PluginNameAttribute
Defined in:
lib/redmine/generators/project_menu_generator.rb

Instance Method Summary collapse

Methods included from PluginNameAttribute

#initialize

Instance Method Details

#add_project_menuObject



11
12
13
14
15
16
17
18
# File 'lib/redmine/generators/project_menu_generator.rb', line 11

def add_project_menu
  menu = %(  menu :project_menu, :#{plural_table_name}, {controller: "#{plural_table_name}", action: "index" }, caption: :label_#{singular_table_name}_plural, param: :project_id\n)
  sentinel = /Redmine::Plugin\.register\s+:\w+\s+do\s?\n/

  in_root do
    inject_into_file "init.rb", menu, after: sentinel
  end
end