notifiable 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,37 +1,37 @@
|
|
1
1
|
module Notifiable
|
2
2
|
module Helpers
|
3
|
-
module
|
3
|
+
module NotifiableHelpers
|
4
4
|
def notify_msg(message, options={})
|
5
5
|
header = header_div(message.header, message.level)
|
6
6
|
body = message.message
|
7
7
|
base_options = {:class => "notify #{message.level}", :id => "notification_#{message.id}"}.merge(options)
|
8
|
-
|
8
|
+
|
9
9
|
if message.dismissable?
|
10
10
|
body += content_tag(:p, link_to_remote("Dismiss", :url => {:controller => 'notifiable/notifications', :action => 'dismiss',
|
11
11
|
:id => message.id}))
|
12
12
|
end
|
13
13
|
content_tag(:div, header + body, base_options)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def notify_for(obj, options={})
|
17
17
|
messages = obj.notificaions.select(&:viewable?).
|
18
18
|
map {|msg| notify_msg(msg, options)}
|
19
19
|
messages.join("\n")
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def notifications(options={})
|
23
23
|
Notification.global.viewable.map {|msg| notify_msg(msg, options)}.join("\n")
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def static_notification(level, header, options={}, &block)
|
27
27
|
header = header_div(header, level)
|
28
28
|
body = capture(&block)
|
29
|
-
|
29
|
+
|
30
30
|
concat(content_tag(:div, header + body, {:class => "notify #{level}"}.merge(options)), block.binding)
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
private
|
34
|
-
|
34
|
+
|
35
35
|
def header_div(text, level)
|
36
36
|
content_tag(:div, content_tag(:span, text, :class => level), :class => "notify-header #{level}")
|
37
37
|
end
|
data/lib/notifiable/rails.rb
CHANGED
data/lib/notifiable/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Shenouda Bertel
|
@@ -34,7 +34,7 @@ files:
|
|
34
34
|
- app/controllers/notifiable/notifications_controller.rb
|
35
35
|
- app/models/notifiable/notification.rb
|
36
36
|
- app/views/notifiable/notifications/new.html.erb
|
37
|
-
- lib/notifiable/helpers/
|
37
|
+
- lib/notifiable/helpers/notifiable_helpers.rb
|
38
38
|
- lib/notifiable/version.rb
|
39
39
|
- lib/notifiable/rails.rb
|
40
40
|
- lib/notifiable.rb
|