module Publications class Engine < ::Rails::Engine initializer "publications" do begin translate_data = Dir["#{Publications::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))} data = {} key1 = {} key1_options = ['table_style', 'accordion_style', 'search_style'] key1_attrs = [] key1_options.each_with_index do |v, i| key1_attrs[i] = {} end translate_data.each do |t_data| v = t_data.values k = t_data.keys[0] key1[k] = v[0]['publication']['inner_page_layout'] key1_options.each_with_index do |kk, i| key1_attrs[i][k] = v[0]['publication'][kk] end end data[key1] = key1_attrs rescue => e puts ['error in publications',e] end OrbitApp.registration "Publications", :type => "ModuleApp" do module_label "publications.publication" base_url File.expand_path File.dirname(__FILE__) # widget_methods ['widget'] # widget_settings [{"data_count"=>30}] # models_to_cache [:my_voting] taggable "Chapter" categorizable authorizable frontend_enabled data_count 1..30 begin show_option_items data rescue => e puts ['there_was_no_show_option_method',e] end side_bar do head_label_i18n 'publications.publication', icon_class: "icon-book" available_for "users" active_for_controllers (['admin/publications']) head_link_path "admin_publications_path" context_link 'all', :link_path=>"admin_publications_path" , :priority=>1, :active_for_action=>{'admin/publications'=>"index"}, :available_for => 'users' context_link 'new_', :link_path=>"new_admin_publication_path" , :priority=>2, :active_for_action=>{'admin/publications'=>"new"}, :available_for => 'sub_managers' context_link 'categories', :link_path=>"admin_module_app_categories_path" , :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'publication').id}", :priority=>3, :active_for_action=>{'admin/publications'=>'categories'}, :active_for_category => 'Publications', :available_for => 'managers' end end end end end