user_notif 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile +3 -1
- data/README.md +129 -4
- data/Rakefile +2 -1
- data/lib/generators/user_notif/install_generator.rb +23 -0
- data/lib/generators/user_notif/install_templates/create_notifs.rb +12 -0
- data/lib/generators/user_notif/install_templates/initializer.rb +8 -0
- data/lib/generators/user_notif/install_templates/locales/en.yml +3 -0
- data/lib/generators/user_notif/install_templates/locales/fr.yml +3 -0
- data/lib/generators/user_notif/install_templates/notifs_controller.rb +25 -0
- data/lib/generators/user_notif/templates/full_notif_view.html.erb +6 -0
- data/lib/generators/user_notif/templates/notif.rb.erb +20 -0
- data/lib/generators/user_notif/templates/notif_email.text.erb +9 -0
- data/lib/generators/user_notif/templates/small_notif_view.html.erb +6 -0
- data/lib/generators/user_notif/user_notif_generator.rb +17 -0
- data/lib/user_notif/model_exceptions.rb +4 -0
- data/lib/user_notif/notif.rb +49 -0
- data/lib/user_notif/notif_mailer.rb +23 -0
- data/lib/user_notif/railtie.rb +19 -0
- data/lib/user_notif/version.rb +1 -1
- data/lib/user_notif/view_helpers.rb +26 -0
- data/lib/user_notif.rb +20 -1
- data/user_notif.gemspec +10 -0
- data/vendor/assets/javascripts/user_notif.js.coffee +6 -0
- data/vendor/assets/stylesheets/user_notif.scss +38 -0
- metadata +146 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ece7ee958af9fc43e1833e07a6327a239203d33
|
4
|
+
data.tar.gz: 4a4c1c3d36a0f7ef6dafec1fc80b30baced6f319
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f3090ab82b14199a5e9269afaa267aaa5ab85ac9c0af4a1444f021e1cbf4727396dc742825dc577e5308513677c16916a1625adec50070ad10f43878c6da829
|
7
|
+
data.tar.gz: d44ba19bb7363c2f99e709554be25c59645332d8a40955eaef1cfd6b25ec29545a1141a61b3709ff0252648462ec1db263db778accbd27546224a92c768d3f19
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# UserNotif
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/user_notif.svg)](https://badge.fury.io/rb/user_notif)
|
3
4
|
[![Build Status](https://travis-ci.org/terry90/user_notif.svg?branch=master)](https://travis-ci.org/terry90/user_notif)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/terry90/user_notif/badge.svg?branch=master)](https://coveralls.io/github/terry90/user_notif?branch=master)
|
4
6
|
[![Code Climate](https://codeclimate.com/github/terry90/user_notif/badges/gpa.svg)](https://codeclimate.com/github/terry90/user_notif)
|
5
7
|
[![Dependency Status](https://gemnasium.com/badges/github.com/terry90/user_notif.svg)](https://gemnasium.com/github.com/terry90/user_notif)
|
6
8
|
[![security](https://hakiri.io/github/terry90/user_notif/master.svg)](https://hakiri.io/github/terry90/user_notif/master)
|
@@ -17,13 +19,137 @@ And then execute:
|
|
17
19
|
|
18
20
|
$ bundle
|
19
21
|
|
20
|
-
Or install it yourself as:
|
21
22
|
|
22
|
-
|
23
|
+
---
|
24
|
+
|
25
|
+
|
26
|
+
After you install UserNotif and add it to your Gemfile, you need to run the generator:
|
27
|
+
|
28
|
+
`rails generate user_notif:install`
|
29
|
+
|
30
|
+
The UserNotifs belong to a user. To ensure it works, make sure you have a `User` model
|
31
|
+
|
32
|
+
|
33
|
+
---
|
34
|
+
|
35
|
+
|
36
|
+
If you want to use it out of the box, require JS and SCSS files
|
37
|
+
|
38
|
+
In your `app/assets/stylesheets/application.css`
|
39
|
+
|
40
|
+
```css
|
41
|
+
/*
|
42
|
+
*= require user_notif
|
43
|
+
*/
|
44
|
+
```
|
45
|
+
|
46
|
+
In your `app/assets/javascripts/application.js`
|
47
|
+
|
48
|
+
```js
|
49
|
+
//
|
50
|
+
//= require user_notif
|
51
|
+
//
|
52
|
+
```
|
23
53
|
|
24
54
|
## Usage
|
25
55
|
|
26
|
-
|
56
|
+
Now you can create your first notification !
|
57
|
+
|
58
|
+
### Models
|
59
|
+
|
60
|
+
Run this generator:
|
61
|
+
|
62
|
+
`rails generate user_notif name target_model`
|
63
|
+
|
64
|
+
It will create a `NameNotif` model and his associated views. You should customize the generated views.
|
65
|
+
|
66
|
+
A notification has a user and a target. The target can be any model, like a `User` or something else.
|
67
|
+
You can then override the views to display informations about the target.
|
68
|
+
|
69
|
+
Example:
|
70
|
+
|
71
|
+
`rails generate user_notif new_follower user`
|
72
|
+
|
73
|
+
It creates a NewFollowerNotif
|
74
|
+
|
75
|
+
Now you can add the logic to create notifications when a user is followed by another one (the target).
|
76
|
+
|
77
|
+
### Views
|
78
|
+
|
79
|
+
To display your notifications, you can use some helpers:
|
80
|
+
|
81
|
+
`list_user_notifs(notifs, small = true)`
|
82
|
+
|
83
|
+
`user_notif(notif, small = true)`
|
84
|
+
|
85
|
+
```erb
|
86
|
+
<%= list_user_notifs(UserNotif.all) %>
|
87
|
+
<%= user_notif(UserNotif.last, false) %>
|
88
|
+
```
|
89
|
+
|
90
|
+
The `small` parameter will take care of rendering the partial located in `app/views/notifs/[small,full]`
|
91
|
+
|
92
|
+
|
93
|
+
#### Cutomizing your views
|
94
|
+
|
95
|
+
You can customize your views by modifying `app/views/notifs/[small,full]/*` files.
|
96
|
+
|
97
|
+
Implement your own element to mark notifications as read with `mark-as-read` class.
|
98
|
+
|
99
|
+
An ajax call to the `data-url` is triggered when you click on this element. This makes the notification read !
|
100
|
+
|
101
|
+
Example:
|
102
|
+
|
103
|
+
```erb
|
104
|
+
<div class=user-notif">
|
105
|
+
...
|
106
|
+
<div class="mark-as-read" data-url="<%= read_user_notif_path(id: @notif.id) %>">X</div>
|
107
|
+
</div>
|
108
|
+
```
|
109
|
+
|
110
|
+
The default behavior remove the unread class on the element itself but you can override it or add your own behavior.
|
111
|
+
|
112
|
+
### Mailer
|
113
|
+
|
114
|
+
Every notification send a mail by default.
|
115
|
+
You can override this in your generated model: `app/models/notifs/your_notif.rb`
|
116
|
+
|
117
|
+
The mailer views are located at `app/views/notifs/mailer/your_notif.[html,text].erb`
|
118
|
+
|
119
|
+
You can customize the mailer by providing options in your generated initializer (install step):
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
# config/initializers/user_notif.rb
|
123
|
+
|
124
|
+
UserNotif.setup do |config|
|
125
|
+
config.app_name = 'My App'
|
126
|
+
config.mailer_sender = 'no-reply@myapp.com'
|
127
|
+
config.mailer_bcc = 'admin@myapp.com'
|
128
|
+
config.mailer_cc = 'admin@myapp.com'
|
129
|
+
config.mailer_reply_to = 'admin@myapp.com'
|
130
|
+
config.mailer_date = Date.current
|
131
|
+
config.return_path = 'contact@myapp.com'
|
132
|
+
end
|
133
|
+
```
|
134
|
+
|
135
|
+
By modifying the initializer, all your notification mailers will default to this.
|
136
|
+
You can still provide custom values per notification by overriding the method `email_options` in your generated model.
|
137
|
+
|
138
|
+
This method should look like this:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
# app/models/notifs/your_notif.rb
|
142
|
+
...
|
143
|
+
def email_options
|
144
|
+
super({
|
145
|
+
subject: I18n.t('awesome.18n.key'),
|
146
|
+
cc: @coworker.email,
|
147
|
+
bcc: @president.email
|
148
|
+
})
|
149
|
+
end
|
150
|
+
```
|
151
|
+
|
152
|
+
The `super` ensures default values are loaded.
|
27
153
|
|
28
154
|
## Development
|
29
155
|
|
@@ -35,7 +161,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
35
161
|
|
36
162
|
Bug reports and pull requests are welcome on GitHub at https://github.com/terry90/user_notif. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
37
163
|
|
38
|
-
|
39
164
|
## License
|
40
165
|
|
41
166
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module UserNotif
|
4
|
+
class InstallGenerator < ActiveRecord::Generators::Base
|
5
|
+
desc 'This generator creates a migration file at db/migrate and an initializer'
|
6
|
+
|
7
|
+
source_root File.expand_path('../install_templates', __FILE__)
|
8
|
+
|
9
|
+
argument :name, type: :string, default: 'create_user_notif'
|
10
|
+
|
11
|
+
def copy_files
|
12
|
+
migration_template 'create_notifs.rb', 'db/migrate/create_notifs.rb'
|
13
|
+
copy_file 'initializer.rb', 'config/initializers/user_notif.rb'
|
14
|
+
copy_file 'notifs_controller.rb', 'app/controllers/user_notif/notifs_controller.rb'
|
15
|
+
copy_file 'locales/fr.yml', 'config/locales/user_notif.fr.yml'
|
16
|
+
copy_file 'locales/en.yml', 'config/locales/user_notif.en.yml'
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_user_notif_routes
|
20
|
+
route "put '/user_notif/:id', to: 'user_notif/notifs#read', as: :read_user_notif"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateNotifs < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :notifs do |t|
|
4
|
+
# Target is the object of the notification (like a Project, Donation or User)
|
5
|
+
t.references :target, polymorphic: true, index: true, null: false
|
6
|
+
t.belongs_to :user, index: true
|
7
|
+
t.boolean :unread, index: true, default: true
|
8
|
+
t.string :type
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
UserNotif.setup do |config|
|
2
|
+
config.app_name = 'My App'
|
3
|
+
config.mailer_sender = 'no-reply@myapp.com'
|
4
|
+
# config.mailer_bcc = 'admin@myapp.com'
|
5
|
+
# config.mailer_return_path = 'contact@myapp.com'
|
6
|
+
# config.mailer_reply_to = 'contact@myapp.com'
|
7
|
+
# config.mailer_cc = 'contact2@myapp.com'
|
8
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module UserNotif
|
2
|
+
class NotifsController < ApplicationController
|
3
|
+
before_action :set_notif
|
4
|
+
before_action :authorized?, only: [:read]
|
5
|
+
|
6
|
+
def read
|
7
|
+
set_notif
|
8
|
+
raise ActiveRecord::RecordNotFound.new('Not Found') unless @notif
|
9
|
+
raise ActiveRecord::RecordNotFound.new('Not Found') unless @notif
|
10
|
+
@notif.update!(unread: false)
|
11
|
+
render nothing: true
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def set_notif
|
17
|
+
@notif = UserNotif::Notif.find(params[:id].to_i)
|
18
|
+
end
|
19
|
+
|
20
|
+
def authorized?
|
21
|
+
# This method assumes you are using Devise. You can change it to use your custom logic.
|
22
|
+
raise ActiveRecord::RecordNotFound.new('Not Found') unless @notif.owner == current_user
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="user-notif mark-as-read <%= 'unread' if @notif.unread %>" data-url="<%= read_user_notif_path(id: @notif.id) %>">
|
2
|
+
<div class="notif-body">
|
3
|
+
<div class="notif-title">New <%= @notif.type %> !</div>
|
4
|
+
<div class="notif-content">This notif is the <%= @notif.id.ordinalize %></div>
|
5
|
+
</div>
|
6
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class <%= file_name.classify %>Notif < UserNotif::Notif
|
2
|
+
def email?
|
3
|
+
# Override or delete (default: true)
|
4
|
+
end
|
5
|
+
|
6
|
+
def template_name
|
7
|
+
'<%= file_name %>_notif'
|
8
|
+
end
|
9
|
+
|
10
|
+
def email_options
|
11
|
+
# TODO: Add this I18n key in your yml and add options or delete the method if you want to keep default values
|
12
|
+
super({
|
13
|
+
subject: I18n.t('notif.<%= file_name %>.subject')
|
14
|
+
})
|
15
|
+
end
|
16
|
+
|
17
|
+
def target_class
|
18
|
+
<%= target.classify %>
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="small-user-notif mark-as-read <%= 'unread' if @notif.unread %>" data-url="<%= read_user_notif_path(id: @notif.id) %>">
|
2
|
+
<div class="notif-body">
|
3
|
+
<div class="notif-title">New <%= @notif.type %> !</div>
|
4
|
+
<div class="notif-content">This notif is the <%= @notif.id.ordinalize %></div>
|
5
|
+
</div>
|
6
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
class UserNotifGenerator < Rails::Generators::NamedBase
|
4
|
+
desc 'This generator creates a new notification model with his associated files'
|
5
|
+
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
argument :target, type: :string
|
9
|
+
|
10
|
+
def copy_files
|
11
|
+
template 'notif.rb.erb', "app/models/notifs/#{file_name}_notif.rb"
|
12
|
+
template 'notif_email.text.erb', "app/views/notifs/mailer/#{file_name}_notif.html.erb"
|
13
|
+
template 'notif_email.text.erb', "app/views/notifs/mailer/#{file_name}_notif.text.erb"
|
14
|
+
copy_file 'small_notif_view.html.erb', "app/views/notifs/small/_#{file_name}_notif.html.erb"
|
15
|
+
copy_file 'full_notif_view.html.erb', "app/views/notifs/full/_#{file_name}_notif.html.erb"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
module UserNotif
|
4
|
+
class Notif < ActiveRecord::Base
|
5
|
+
belongs_to :target, polymorphic: true
|
6
|
+
belongs_to :user
|
7
|
+
|
8
|
+
scope :unread, -> { where(unread: true) }
|
9
|
+
|
10
|
+
before_save :validate_target_and_user
|
11
|
+
after_create :notify_email
|
12
|
+
|
13
|
+
def email?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
def template_name
|
18
|
+
'generic_notif'
|
19
|
+
end
|
20
|
+
|
21
|
+
def email_options(opts = {})
|
22
|
+
{
|
23
|
+
subject: I18n.t('notif.generic.subject'),
|
24
|
+
bcc: UserNotif.mailer_bcc,
|
25
|
+
return_path: UserNotif.mailer_return_path,
|
26
|
+
from: UserNotif.mailer_sender,
|
27
|
+
reply_to: UserNotif.mailer_reply_to,
|
28
|
+
cc: UserNotif.mailer_cc,
|
29
|
+
date: Time.current,
|
30
|
+
}.merge(opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
def target_class
|
34
|
+
nil # Has to be overriden
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def validate_target_and_user
|
40
|
+
raise ModelExceptions::BadTypeNotification unless self.target.class == target_class
|
41
|
+
raise ModelExceptions::NotifOwnerNil if self.user == nil
|
42
|
+
end
|
43
|
+
|
44
|
+
def notify_email
|
45
|
+
return unless email?
|
46
|
+
NotifMailer.notif_email(self.id).deliver_later
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'action_mailer'
|
2
|
+
|
3
|
+
module UserNotif
|
4
|
+
class NotifMailer < ActionMailer::Base
|
5
|
+
def notif_email(notif_id)
|
6
|
+
notif = Notif.find(notif_id)
|
7
|
+
@target = notif.target
|
8
|
+
@user = notif.user
|
9
|
+
send_email({
|
10
|
+
to: @user.email,
|
11
|
+
template_path: 'notifs/mailer',
|
12
|
+
template_name: notif.template_name
|
13
|
+
}.merge(notif.email_options)
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def send_email(opts)
|
20
|
+
mail(opts)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails/railtie'
|
2
|
+
|
3
|
+
module UserNotif
|
4
|
+
class Railtie < Rails::Railtie
|
5
|
+
config.before_configuration do |app|
|
6
|
+
ActiveSupport::Dependencies.autoload_paths += %W(#{app.root}/app/models/notifs)
|
7
|
+
end
|
8
|
+
|
9
|
+
initializer 'user_notif.view_helpers' do
|
10
|
+
ActionView::Base.send :include, UserNotif::ViewHelpers
|
11
|
+
end
|
12
|
+
|
13
|
+
initializer :assets do
|
14
|
+
Rails.application.config.assets.precompile += %w{ user_notif.js.coffee user_notif.scss }
|
15
|
+
Rails.application.config.assets.paths << UserNotif.root + '/vendor/assets/javascripts'
|
16
|
+
Rails.application.config.assets.paths << UserNotif.root + '/vendor/assets/stylesheets'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/user_notif/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module UserNotif
|
2
|
+
module ViewHelpers
|
3
|
+
include ::ActionView::Context
|
4
|
+
include ::ActionView::Helpers
|
5
|
+
|
6
|
+
def list_user_notifs(notifs = nil, small = true)
|
7
|
+
return unless notifs
|
8
|
+
output = ''
|
9
|
+
|
10
|
+
notifs.each { |n| output << user_notif(n, small) }
|
11
|
+
|
12
|
+
wrap output
|
13
|
+
end
|
14
|
+
|
15
|
+
def user_notif(notif, small = true)
|
16
|
+
@notif = notif
|
17
|
+
render("notifs/#{small ? 'small' : 'full'}/#{notif.template_name}")
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def wrap(elem)
|
23
|
+
"<div class=\"user-notif-wrapper\">#{elem}</div>".html_safe
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/user_notif.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
require 'user_notif/version'
|
2
|
+
require 'user_notif/notif'
|
3
|
+
require 'user_notif/model_exceptions'
|
4
|
+
require 'user_notif/notif_mailer'
|
5
|
+
require 'user_notif/view_helpers'
|
6
|
+
require 'user_notif/railtie' if defined?(Rails)
|
2
7
|
|
3
8
|
module UserNotif
|
9
|
+
def self.setup
|
10
|
+
yield self
|
11
|
+
end
|
4
12
|
|
5
|
-
|
13
|
+
def self.root
|
14
|
+
File.dirname __dir__
|
15
|
+
end
|
16
|
+
|
17
|
+
mattr_accessor :mailer_sender
|
18
|
+
@@mailer_sender = 'contact@myapp.com'
|
19
|
+
|
20
|
+
mattr_accessor :app_name
|
21
|
+
@@app_name = 'My App'
|
22
|
+
|
23
|
+
mattr_accessor :mailer_bcc, :mailer_return_path, :mailer_from, :mailer_reply_to, :mailer_cc, :mailer_date
|
24
|
+
end
|
data/user_notif.gemspec
CHANGED
@@ -22,4 +22,14 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
23
23
|
spec.add_development_dependency 'rake', '~> 10.0'
|
24
24
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
25
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.0'
|
26
|
+
spec.add_development_dependency 'combustion', '~> 0.5.4'
|
27
|
+
spec.add_development_dependency 'sprockets-rails', ['>= 3.0']
|
28
|
+
|
29
|
+
spec.add_runtime_dependency 'activerecord', '>= 4.0'
|
30
|
+
spec.add_runtime_dependency 'actionmailer', '>= 4.0'
|
31
|
+
spec.add_runtime_dependency 'railties', '>= 4.0'
|
32
|
+
spec.add_runtime_dependency 'sass-rails', '~> 5.0'
|
33
|
+
spec.add_runtime_dependency 'coffee-rails', '~> 4.1.0'
|
34
|
+
spec.add_runtime_dependency 'jquery-rails', '>= 4.0.4'
|
25
35
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
.user-notif-wrapper {
|
2
|
+
.small-user-notif {
|
3
|
+
cursor: pointer;
|
4
|
+
padding: 10px;
|
5
|
+
color: #333333;
|
6
|
+
border-bottom: 1px solid lightgrey;
|
7
|
+
|
8
|
+
&:last-child {
|
9
|
+
border-bottom: none
|
10
|
+
}
|
11
|
+
|
12
|
+
&:hover {
|
13
|
+
background-color: lightgrey;
|
14
|
+
}
|
15
|
+
|
16
|
+
&:before {
|
17
|
+
display: inline-block;
|
18
|
+
vertical-align: middle;
|
19
|
+
height: 10px;
|
20
|
+
width: 10px;
|
21
|
+
border-radius: 50%;
|
22
|
+
background-color: grey;
|
23
|
+
content: ''
|
24
|
+
}
|
25
|
+
|
26
|
+
&.unread {
|
27
|
+
&:before {
|
28
|
+
background-color: #33ce74;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
.notif-body {
|
33
|
+
display: inline-block;
|
34
|
+
vertical-align: middle;
|
35
|
+
margin-left: 10px;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_notif
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Terry Raimondo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,132 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: combustion
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.5.4
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.5.4
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sprockets-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activerecord
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: actionmailer
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: railties
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '4.0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sass-rails
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '5.0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '5.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: coffee-rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 4.1.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 4.1.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: jquery-rails
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 4.0.4
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 4.0.4
|
55
181
|
description: This gem adds notifications to your app, you can display the notifications
|
56
182
|
where you want, add a dropdown on your header for example. Add views, mailer views
|
57
183
|
and go !
|
@@ -71,9 +197,27 @@ files:
|
|
71
197
|
- Rakefile
|
72
198
|
- bin/console
|
73
199
|
- bin/setup
|
200
|
+
- lib/generators/user_notif/install_generator.rb
|
201
|
+
- lib/generators/user_notif/install_templates/create_notifs.rb
|
202
|
+
- lib/generators/user_notif/install_templates/initializer.rb
|
203
|
+
- lib/generators/user_notif/install_templates/locales/en.yml
|
204
|
+
- lib/generators/user_notif/install_templates/locales/fr.yml
|
205
|
+
- lib/generators/user_notif/install_templates/notifs_controller.rb
|
206
|
+
- lib/generators/user_notif/templates/full_notif_view.html.erb
|
207
|
+
- lib/generators/user_notif/templates/notif.rb.erb
|
208
|
+
- lib/generators/user_notif/templates/notif_email.text.erb
|
209
|
+
- lib/generators/user_notif/templates/small_notif_view.html.erb
|
210
|
+
- lib/generators/user_notif/user_notif_generator.rb
|
74
211
|
- lib/user_notif.rb
|
212
|
+
- lib/user_notif/model_exceptions.rb
|
213
|
+
- lib/user_notif/notif.rb
|
214
|
+
- lib/user_notif/notif_mailer.rb
|
215
|
+
- lib/user_notif/railtie.rb
|
75
216
|
- lib/user_notif/version.rb
|
217
|
+
- lib/user_notif/view_helpers.rb
|
76
218
|
- user_notif.gemspec
|
219
|
+
- vendor/assets/javascripts/user_notif.js.coffee
|
220
|
+
- vendor/assets/stylesheets/user_notif.scss
|
77
221
|
homepage: https://github.com/terry90/user_notif
|
78
222
|
licenses:
|
79
223
|
- MIT
|