notifications 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/app/assets/stylesheets/notifications.scss +15 -4
- data/app/controllers/notifications/notifications_controller.rb +2 -0
- data/app/views/notifications/notifications/index.html.erb +6 -1
- data/lib/generators/notifications/controllers_generator.rb +2 -3
- data/lib/generators/notifications/i18n_generator.rb +2 -3
- data/lib/generators/notifications/install_generator.rb +10 -10
- data/lib/generators/notifications/views_generator.rb +2 -3
- data/lib/notifications.rb +10 -10
- data/lib/notifications/model.rb +1 -1
- data/lib/notifications/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db6d361624d9bc1d23d47a7ccc2972a72c2b7db
|
4
|
+
data.tar.gz: 9997b74887d08320e258d170c726e20a5f7b5196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c0c36018c209e2b50b02b856880f4170b2ce33df7322a3a766c27c1b0461cc98c6b4670b25ad9d143d4d29df1441e48499d898b4bed929270ab1a88fb0fec9c
|
7
|
+
data.tar.gz: ec47e9eb45a4bfa1e158f478191dc3b5fb78bc327f25c7205c32aca71df454418ae4fd3a17c01f279c372ead7ed3ff55ab8040a649c52f8e134440bfe4baa32e
|
data/README.md
CHANGED
@@ -103,6 +103,10 @@ We suggest use [second_level_cached](https://github.com/hooopo/second_level_cach
|
|
103
103
|
|
104
104
|
Contribution directions go here.
|
105
105
|
|
106
|
+
## Site Used
|
107
|
+
|
108
|
+
- [Ruby China](https://ruby-china.org)
|
109
|
+
|
106
110
|
## License
|
107
111
|
|
108
112
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -10,10 +10,21 @@
|
|
10
10
|
margin-bottom: 10px;
|
11
11
|
}
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
|
14
|
+
.notification-group {
|
15
15
|
padding: 10px;
|
16
|
-
|
16
|
+
margin-bottom: 20px;
|
17
|
+
|
18
|
+
.group-title {
|
19
|
+
padding: 5px 0;
|
20
|
+
color: #999;
|
21
|
+
border-bottom: 1px solid #eee;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.notification {
|
26
|
+
margin: 0;
|
27
|
+
padding: 10px 0px;
|
17
28
|
color: #999;
|
18
29
|
|
19
30
|
a { color: #555; }
|
@@ -31,7 +42,7 @@
|
|
31
42
|
|
32
43
|
|
33
44
|
.media-content {
|
34
|
-
p:last-
|
45
|
+
p:last-child {
|
35
46
|
margin-bottom: 0;
|
36
47
|
}
|
37
48
|
}
|
@@ -10,7 +10,12 @@
|
|
10
10
|
<% if @notifications.blank? %>
|
11
11
|
<div class="no-records"><%= t('notifications.no_records') %></div>
|
12
12
|
<% else %>
|
13
|
-
|
13
|
+
<% @notification_groups.each do |group, notifications| %>
|
14
|
+
<div class="notification-group">
|
15
|
+
<div class="group-title"><%= group %></div>
|
16
|
+
<%= render notifications %>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
14
19
|
<% end %>
|
15
20
|
</div>
|
16
21
|
<%= will_paginate @notifications %>
|
@@ -1,15 +1,14 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
require 'rails/generators'
|
3
2
|
module Notifications
|
4
3
|
module Generators
|
5
4
|
class ControllersGenerator < Rails::Generators::Base #:nodoc:
|
6
|
-
source_root File.expand_path(
|
5
|
+
source_root File.expand_path('../../../../app/controllers', __FILE__)
|
7
6
|
desc "Used to copy Notifications's controllers to your application's controllers."
|
8
7
|
|
9
8
|
def copy_controllers
|
10
9
|
%w(notifications).each do |fname|
|
11
10
|
path = "#{Rails.root}/app/controllers/notifications/#{fname}_controller.rb"
|
12
|
-
if File.
|
11
|
+
if File.exist?(path)
|
13
12
|
puts "Skipping notifications/#{fname}_controller.rb creation, as file already exists!"
|
14
13
|
else
|
15
14
|
puts "Adding controller (notifications/#{fname}_controller.rb)..."
|
@@ -3,12 +3,12 @@ module Notifications
|
|
3
3
|
module Generators
|
4
4
|
class I18nGenerator < Rails::Generators::Base
|
5
5
|
desc "Create Notifications's default I18n files"
|
6
|
-
source_root File.expand_path(
|
6
|
+
source_root File.expand_path('../../../../', __FILE__)
|
7
7
|
|
8
8
|
def add_locales
|
9
9
|
%w(en.yml zh-CN.yml).each do |fname|
|
10
10
|
path = "#{Rails.root}/config/locales/notifications.#{fname}"
|
11
|
-
if File.
|
11
|
+
if File.exist?(path)
|
12
12
|
puts "Skipping config/locales/notifications.#{fname} creation, as file already exists!"
|
13
13
|
else
|
14
14
|
puts "Adding locale (config/locales/notifications.#{fname})..."
|
@@ -16,7 +16,6 @@ module Notifications
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
@@ -3,25 +3,25 @@ module Notifications
|
|
3
3
|
module Generators
|
4
4
|
class InstallGenerator < Rails::Generators::Base
|
5
5
|
desc "Create Notifications's base files"
|
6
|
-
source_root File.expand_path(
|
6
|
+
source_root File.expand_path('../../../../', __FILE__)
|
7
7
|
|
8
8
|
def add_initializer
|
9
9
|
path = "#{Rails.root}/config/initializers/notifications.rb"
|
10
|
-
if File.
|
11
|
-
puts
|
10
|
+
if File.exist?(path)
|
11
|
+
puts 'Skipping config/initializers/notifications.rb creation, as file already exists!'
|
12
12
|
else
|
13
|
-
puts
|
14
|
-
template
|
13
|
+
puts 'Adding Homeland initializer (config/initializers/notifications.rb)...'
|
14
|
+
template 'config/initializers/notifications.rb', path
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
def add_models
|
19
19
|
path = "#{Rails.root}/app/models/notification.rb"
|
20
|
-
if File.
|
21
|
-
puts
|
20
|
+
if File.exist?(path)
|
21
|
+
puts 'Skipping notification.rb creation, as file already exists!'
|
22
22
|
else
|
23
|
-
puts
|
24
|
-
template
|
23
|
+
puts 'Adding model (notification.rb)...'
|
24
|
+
template 'app/models/notification.rb', path
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -30,7 +30,7 @@ module Notifications
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def add_migrations
|
33
|
-
|
33
|
+
exec('rake notifications:install:migrations')
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -1,13 +1,12 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
require 'rails/generators'
|
3
2
|
module Notifications
|
4
3
|
module Generators
|
5
4
|
class ViewsGenerator < Rails::Generators::Base #:nodoc:
|
6
|
-
source_root File.expand_path(
|
5
|
+
source_root File.expand_path('../../../../', __FILE__)
|
7
6
|
desc "Used to copy Notifications's views to your application's views."
|
8
7
|
|
9
8
|
def copy_views
|
10
|
-
directory 'app/views/notifications',
|
9
|
+
directory 'app/views/notifications', 'app/views/notifications'
|
11
10
|
template 'app/assets/stylesheets/notifications.scss', 'app/assets/stylesheets/notifications.scss'
|
12
11
|
end
|
13
12
|
end
|
data/lib/notifications.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'notifications/model'
|
2
|
+
require 'notifications/engine'
|
3
|
+
require 'notifications/configuration'
|
4
|
+
require 'notifications/version'
|
5
5
|
require 'will_paginate'
|
6
6
|
require 'will_paginate/active_record'
|
7
7
|
|
@@ -10,13 +10,13 @@ module Notifications
|
|
10
10
|
def config
|
11
11
|
return @config if defined?(@config)
|
12
12
|
@config = Configuration.new
|
13
|
-
@config.per_page
|
14
|
-
@config.user_class
|
15
|
-
@config.user_name_method
|
16
|
-
@config.user_avatar_url_method
|
17
|
-
@config.user_profile_url_method
|
13
|
+
@config.per_page = 32
|
14
|
+
@config.user_class = 'User'
|
15
|
+
@config.user_name_method = 'name'
|
16
|
+
@config.user_avatar_url_method = nil
|
17
|
+
@config.user_profile_url_method = 'profile_url'
|
18
18
|
@config.authenticate_user_method = 'authenticate_user!'
|
19
|
-
@config.current_user_method
|
19
|
+
@config.current_user_method = 'current_user'
|
20
20
|
@config
|
21
21
|
end
|
22
22
|
|
data/lib/notifications/model.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.4.8
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Rails mountable Notification for any applications.
|