Sha256: dbecd5f4fb9a0b759c65069a3a39a93eeb19312a1b925c3314aadce6ef8e8e18

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

require "redmine/generators/plugin_name_attribute"
Rails::Generators.lookup %w(rails:model)

module Redmine
  module Generators
    class ProjectMenuGenerator < Rails::Generators::ModelGenerator
      include PluginNameAttribute
      
      remove_hook_for :orm

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redmine-generators-0.0.1 lib/redmine/generators/project_menu_generator.rb