2014-06-26 07:50:30 +00:00
|
|
|
module SiteMenuWidget
|
|
|
|
class Engine < ::Rails::Engine
|
2020-01-18 16:31:39 +00:00
|
|
|
initializer "site_menu_widget", before: :load_config_initializers do
|
|
|
|
translate_data = Dir["#{SiteMenuWidget::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
|
|
|
data = {}
|
|
|
|
key1 = {}
|
|
|
|
key2 = {}
|
2020-01-21 09:37:25 +00:00
|
|
|
key3 = {}
|
2020-01-18 16:31:39 +00:00
|
|
|
value1 = {}
|
|
|
|
value2 = {}
|
|
|
|
translate_data.each do |t_data|
|
|
|
|
key1[t_data.keys[0]] = t_data.values[0]['site_menu']['show_previous_layer']
|
|
|
|
key2[t_data.keys[0]] = t_data.values[0]['site_menu']['expand_current_layer']
|
2020-01-21 09:37:25 +00:00
|
|
|
key3[t_data.keys[0]] = t_data.values[0]['site_menu']['expand_next_layer']
|
2020-01-18 16:31:39 +00:00
|
|
|
value2[t_data.keys[0]] = t_data.values[0]['site_menu']['no']
|
|
|
|
value1[t_data.keys[0]] = t_data.values[0]['site_menu']['yes']
|
|
|
|
end
|
|
|
|
data[key1] = [value2,value1]
|
|
|
|
data[key2] = [value2,value1]
|
2020-01-21 09:37:25 +00:00
|
|
|
data[key3] = [value2,value1]
|
2020-01-18 16:31:39 +00:00
|
|
|
OrbitApp.registration "SiteMenuWidget", :type => "OrbitWidget" do
|
|
|
|
widget_label "SiteMenu"
|
2014-06-26 11:09:40 +00:00
|
|
|
widget_methods ["widget"]
|
2020-01-18 16:31:39 +00:00
|
|
|
begin
|
|
|
|
show_options data
|
|
|
|
rescue => e
|
|
|
|
puts ['there_was_no_show_option_method',e]
|
|
|
|
end
|
2014-06-26 11:09:40 +00:00
|
|
|
end
|
|
|
|
end
|
2014-06-26 07:50:30 +00:00
|
|
|
end
|
|
|
|
end
|