foodsoft/plugins/printer/lib/foodsoft_printer/engine.rb

29 lines
771 B
Ruby
Raw Permalink Normal View History

module FoodsoftPrinter
class Engine < ::Rails::Engine
def navigation(primary, context)
return unless FoodsoftPrinter.enabled?
return if primary[:orders].nil?
sub_nav = primary[:orders].sub_navigation
sub_nav.items <<
SimpleNavigation::Item.new(primary, :printer_jobs, I18n.t('navigation.orders.printer_jobs'),
context.printer_jobs_path)
end
def default_foodsoft_config(cfg)
cfg[:use_printer] = false
end
initializer 'foodsoft_printer.order_printer_jobs' do |_app|
if Rails.configuration.cache_classes
OrderPrinterJobs.install
else
2020-09-04 12:57:19 +02:00
ActiveSupport::Reloader.to_prepare do
OrderPrinterJobs.install
end
end
end
end
end