Sha256: db8ff8daf044eceb11a6d05e1165835666d1b6639af39e23e94bf009eb19e052
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
require 'rails/generators/active_record' module Adminos::Generators class FeedbackGenerator < Rails::Generators::Base include ActiveRecord::Generators::Migration desc 'Set up feedbacks' source_root File.expand_path '../../templates/feedback', __FILE__ def auto directory 'auto', '.', mode: :preserve end def route insert_into_file "config/routes.rb", after: "namespace :admin do\n" do <<~ROUT.indent(4) resources :feedbacks, except: :show do collection { post :batch_action } end ROUT end end def migration migration_template 'feedbacks_migration.rb', 'db/migrate/create_feedbacks.rb' end def sidebar_link insert_into_file "app/views/shared/admin/_sidebar.slim", before: "\n = top_menu_item active: 'admin/settings#' do" do <<~SLIM.indent(8) = top_menu_item active: 'admin/feedbacks#' do = link_to t('admin.feedbacks.actions.index.header'), admin_feedbacks_path, class: 'nav__link' SLIM end end end end
Version data entries
3 entries across 3 versions & 1 rubygems