2023-06-04 14:41:53 +00:00
|
|
|
module Publications
|
2018-10-04 02:47:23 +00:00
|
|
|
class Engine < ::Rails::Engine
|
2023-06-04 14:41:53 +00:00
|
|
|
initializer "publications" do
|
2023-06-23 10:25:35 +00:00
|
|
|
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
|
2023-06-04 14:41:53 +00:00
|
|
|
OrbitApp.registration "Publications", :type => "ModuleApp" do
|
2023-07-21 02:10:22 +00:00
|
|
|
module_label "publications_.publication"
|
2018-10-04 02:47:23 +00:00
|
|
|
base_url File.expand_path File.dirname(__FILE__)
|
2023-06-23 10:25:35 +00:00
|
|
|
# widget_methods ['widget']
|
|
|
|
# widget_settings [{"data_count"=>30}]
|
2018-10-04 02:47:23 +00:00
|
|
|
# models_to_cache [:my_voting]
|
2023-06-23 10:25:35 +00:00
|
|
|
taggable "Chapter"
|
2018-10-04 02:47:23 +00:00
|
|
|
categorizable
|
|
|
|
authorizable
|
|
|
|
frontend_enabled
|
|
|
|
data_count 1..30
|
|
|
|
|
2023-06-23 10:25:35 +00:00
|
|
|
begin
|
|
|
|
show_option_items data
|
|
|
|
rescue => e
|
|
|
|
puts ['there_was_no_show_option_method',e]
|
|
|
|
end
|
|
|
|
|
2018-10-04 02:47:23 +00:00
|
|
|
side_bar do
|
2023-07-21 02:10:22 +00:00
|
|
|
head_label_i18n 'publications_.publication', icon_class: "icon-book"
|
2018-10-04 02:47:23 +00:00
|
|
|
available_for "users"
|
2023-06-04 14:41:53 +00:00
|
|
|
active_for_controllers (['admin/publications'])
|
|
|
|
head_link_path "admin_publications_path"
|
2018-10-04 02:47:23 +00:00
|
|
|
|
|
|
|
context_link 'all',
|
2023-06-04 14:41:53 +00:00
|
|
|
:link_path=>"admin_publications_path" ,
|
2018-10-04 02:47:23 +00:00
|
|
|
:priority=>1,
|
2023-06-04 14:41:53 +00:00
|
|
|
:active_for_action=>{'admin/publications'=>"index"},
|
2018-10-04 02:47:23 +00:00
|
|
|
:available_for => 'users'
|
|
|
|
context_link 'new_',
|
2023-06-04 14:41:53 +00:00
|
|
|
:link_path=>"new_admin_publication_path" ,
|
2018-10-04 02:47:23 +00:00
|
|
|
:priority=>2,
|
2023-06-04 14:41:53 +00:00
|
|
|
:active_for_action=>{'admin/publications'=>"new"},
|
2018-10-04 02:47:23 +00:00
|
|
|
:available_for => 'sub_managers'
|
|
|
|
context_link 'categories',
|
|
|
|
:link_path=>"admin_module_app_categories_path" ,
|
2023-06-04 14:41:53 +00:00
|
|
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'publication').id}",
|
2018-10-04 02:47:23 +00:00
|
|
|
:priority=>3,
|
2023-06-04 14:41:53 +00:00
|
|
|
:active_for_action=>{'admin/publications'=>'categories'},
|
|
|
|
:active_for_category => 'Publications',
|
2018-10-04 02:47:23 +00:00
|
|
|
:available_for => 'managers'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|