51 lines
2.2 KiB
Ruby
51 lines
2.2 KiB
Ruby
module RulingBus
|
|
class Engine < ::Rails::Engine
|
|
initializer "ruling_bus" do
|
|
require File.expand_path('../../../app/models/ruling_bus_setting', __FILE__)
|
|
require File.expand_path('../../../app/models/ruling_bus_info', __FILE__)
|
|
require File.expand_path('../../../app/models/ruling_bus_cache', __FILE__)
|
|
RulingBusSetting.create if RulingBusSetting.first.nil?
|
|
OrbitApp.registration "RulingBus", :type => "ModuleApp" do
|
|
module_label "ruling_bus.ruling_bus"
|
|
base_url File.expand_path File.dirname(__FILE__)
|
|
authorizable
|
|
categorizable
|
|
widget_methods ["widget"]
|
|
if File.basename($0) != 'rake'
|
|
begin
|
|
avoid_page_cache RulingBusInfo
|
|
avoid_page_cache RulingBusCache
|
|
rescue => e
|
|
puts ["avoid_page_cache", e.to_s]
|
|
end
|
|
end
|
|
side_bar do
|
|
head_label_i18n 'ruling_bus.ruling_bus', icon_class: "fa fa-bus"
|
|
available_for "users"
|
|
active_for_controllers (['admin/ruling_buses'])
|
|
head_link_path "admin_ruling_buses_path"
|
|
|
|
context_link 'ruling_bus.bus_management',
|
|
:link_path=>"admin_ruling_buses_path" ,
|
|
:priority=>1,
|
|
:active_for_action=>{'admin/ruling_buses'=>'index'},
|
|
:available_for => 'managers'
|
|
context_link 'ruling_bus.setting',
|
|
:link_path=>"setting_admin_ruling_buses_path" ,
|
|
:priority=>2,
|
|
:active_for_action=>{'admin/ruling_buses'=>'setting'},
|
|
:available_for => 'managers'
|
|
context_link 'categories',
|
|
:link_path=>"admin_module_app_categories_path" ,
|
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'ruling_bus').id}",
|
|
:priority=>3,
|
|
:active_for_action=>{'admin/ruling_buses'=>'categories'},
|
|
:active_for_category => 'RulingBus',
|
|
:available_for => 'managers'
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|