2019-02-02 12:40:57 +01:00
|
|
|
module FoodsoftPrinter
|
|
|
|
class Engine < ::Rails::Engine
|
|
|
|
def navigation(primary, context)
|
|
|
|
return unless FoodsoftPrinter.enabled?
|
2021-03-01 15:27:26 +01:00
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
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)
|
2019-02-02 12:40:57 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def default_foodsoft_config(cfg)
|
|
|
|
cfg[:use_printer] = false
|
|
|
|
end
|
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
initializer 'foodsoft_printer.order_printer_jobs' do |_app|
|
2019-02-02 12:40:57 +01:00
|
|
|
if Rails.configuration.cache_classes
|
|
|
|
OrderPrinterJobs.install
|
|
|
|
else
|
2020-09-04 12:57:19 +02:00
|
|
|
ActiveSupport::Reloader.to_prepare do
|
2019-02-02 12:40:57 +01:00
|
|
|
OrderPrinterJobs.install
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|