notifications 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/notifications/notifications_controller.rb +2 -4
- data/app/models/notification.rb +0 -2
- data/app/views/notifications/notifications/_notification.html.erb +1 -1
- data/app/views/notifications/notifications/index.html.erb +1 -1
- data/lib/notifications.rb +1 -3
- data/lib/notifications/configuration.rb +0 -3
- data/lib/notifications/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 289be7485587ec007b2383811b0a99daf76d7099
|
4
|
+
data.tar.gz: d0197d7f693e1462f7ff802101aa3e94d05ec653
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ca9ee7e713d576e07603fe543d34c4eeebb22c726f5eaf185c066c1bb7c7bac8a73fdb61547895588f07c6daa387513cd560ce1efdd1a0243fdb21e1525f455
|
7
|
+
data.tar.gz: 42d62d628b94b53c6d1504bc8f24c747cd955883b2facedde2aab40ebcc4614c78a0258cd1e09243fe687d751baec0b207b7b73dfb53c5e514c68392c7f57305
|
@@ -3,10 +3,7 @@ module Notifications
|
|
3
3
|
def index
|
4
4
|
@notifications = notifications.includes(:actor).order('id desc').page(params[:page])
|
5
5
|
|
6
|
-
unread_ids =
|
7
|
-
@notifications.each do |n|
|
8
|
-
unread_ids << n.id unless n.read?
|
9
|
-
end
|
6
|
+
unread_ids = @notifications.reject(&:read?).select(&:id)
|
10
7
|
Notification.read!(unread_ids)
|
11
8
|
|
12
9
|
@notification_groups = @notifications.group_by { |note| note.created_at.to_date }
|
@@ -20,6 +17,7 @@ module Notifications
|
|
20
17
|
private
|
21
18
|
|
22
19
|
def notifications
|
20
|
+
raise "You need reqiure user login for /notifications page." unless current_user
|
23
21
|
Notification.where(user_id: current_user.id)
|
24
22
|
end
|
25
23
|
end
|
data/app/models/notification.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= cache(['notifications', Notifications::VERSION, notification]) do %>
|
2
2
|
<div id="notification-<%= notification.id %>"
|
3
3
|
data-id="<%= notification.id %>"
|
4
|
-
class="media notification notification-<%= notification.notify_type %><%= ' unread'
|
4
|
+
class="media notification notification-<%= notification.notify_type %><%= ' unread' unless notification.read? %>">
|
5
5
|
<div class="media-left">
|
6
6
|
<% if notification.actor_profile_url && notification.actor_avatar_url %>
|
7
7
|
<%= link_to image_tag(notification.actor_avatar_url), notification.actor_profile_url, title: notification.actor_name, class: 'user-avatar' %>
|
data/lib/notifications.rb
CHANGED
@@ -2,15 +2,13 @@ require 'notifications/model'
|
|
2
2
|
require 'notifications/engine'
|
3
3
|
require 'notifications/configuration'
|
4
4
|
require 'notifications/version'
|
5
|
-
require '
|
6
|
-
require 'will_paginate/active_record'
|
5
|
+
require 'kaminari'
|
7
6
|
|
8
7
|
module Notifications
|
9
8
|
class << self
|
10
9
|
def config
|
11
10
|
return @config if defined?(@config)
|
12
11
|
@config = Configuration.new
|
13
|
-
@config.per_page = 32
|
14
12
|
@config.user_class = 'User'
|
15
13
|
@config.user_name_method = 'name'
|
16
14
|
@config.user_avatar_url_method = nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
@@ -31,19 +31,19 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: kaminari
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '0.15'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '0.15'
|
47
47
|
description: Rails mountable Notification for any applications.
|
48
48
|
email:
|
49
49
|
- huacnlee@gmail.com
|