56 lines
2.6 KiB
Ruby
56 lines
2.6 KiB
Ruby
require "yaml"
|
|
module Announcement
|
|
class Engine < ::Rails::Engine
|
|
initializer "announcement" do
|
|
OrbitApp.registration "Announcement", :type => "ModuleApp" do
|
|
module_label "announcement.announcement"
|
|
base_url File.expand_path File.dirname(__FILE__)
|
|
widget_methods ["widget"]
|
|
widget_settings [{"data_count"=>30}]
|
|
taggable "Bulletin"
|
|
categorizable
|
|
authorizable
|
|
frontend_enabled
|
|
data_count 1..30
|
|
|
|
side_bar do
|
|
head_label_i18n 'announcement.announcement', icon_class: "icons-megaphone"
|
|
available_for "users"
|
|
active_for_controllers (['admin/announcements'])
|
|
head_link_path "admin_announcements_path"
|
|
|
|
context_link 'announcement.all_articles',
|
|
:link_path=>"admin_announcements_path" ,
|
|
:priority=>1,
|
|
:active_for_action=>{'admin/announcements'=>'index'},
|
|
:available_for => 'users'
|
|
context_link 'new_',
|
|
:link_path=>"new_admin_announcement_path" ,
|
|
:priority=>2,
|
|
:active_for_action=>{'admin/announcements'=>'new'},
|
|
:available_for => 'sub_managers'
|
|
context_link 'categories',
|
|
:link_path=>"admin_module_app_categories_path" ,
|
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'announcement').id}",
|
|
:priority=>3,
|
|
:active_for_action=>{'admin/announcements'=>'categories'},
|
|
:active_for_category => 'Announcement',
|
|
:available_for => 'managers'
|
|
context_link 'tags',
|
|
:link_path=>"admin_module_app_tags_path" ,
|
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'announcement').id}",
|
|
:priority=>4,
|
|
:active_for_action=>{'admin/announcements'=>'tags'},
|
|
:active_for_tag => 'Announcement',
|
|
:available_for => 'managers'
|
|
end
|
|
|
|
end
|
|
# temp = YAML.load_file(File.join(Rails.root,"config","mongoid.yml"))
|
|
# dbsettings = temp["production"]["sessions"]["default"]
|
|
# s = Moped::Session.new(dbsettings["hosts"])
|
|
# s.use dbsettings["database"]
|
|
# s[:bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
|
|
end
|
|
end
|
|
end |