admin_notifications_plugin.rb
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class AdminNotificationsPlugin < Noosfero::Plugin
def self.plugin_name
"Notifications Plugin"
end
def self.plugin_description
_("A plugin for notifications.")
end
def stylesheet?
true
end
def js_files
%w(
admin_notifications_plugin.js
)
end
def body_beginning
lambda do
extend AdminNotificationsPlugin::NotificationHelper
render template: 'shared/show_notification'
end
end
def admin_panel_links
{:title => _('Notification Manager'), :url => {:controller => 'admin_notifications_plugin_admin', :action => 'index'}}
end
def control_panel_buttons
if context.profile.organization?
{
:title => _('Manage Notifications'),
:icon => 'important',
:url => {
:controller => 'admin_notifications_plugin_myprofile',
:action => 'index'
}
}
end
end
def account_controller_filters
block = proc do
if !logged_in?
cookies[:hide_notifications] = nil
end
end
[{
:type => "after_filter",
:method_name => "clean_hide_notifications_cookie",
:options => { },
:block => block
}]
end
end