https://github.com/work-design/rails_notice
notification sends with websocket, mailers, sms
https://github.com/work-design/rails_notice
engine notifications
Last synced: about 1 year ago
JSON representation
notification sends with websocket, mailers, sms
- Host: GitHub
- URL: https://github.com/work-design/rails_notice
- Owner: work-design
- Created: 2017-01-14T07:56:12.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2025-03-12T03:08:33.000Z (over 1 year ago)
- Last Synced: 2025-04-08T16:16:43.929Z (about 1 year ago)
- Topics: engine, notifications
- Language: Ruby
- Homepage:
- Size: 864 KB
- Stars: 2
- Watchers: 6
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.en.md
Awesome Lists containing this project
README
# RailsNotice
Short description and motivation.
## Usage
### Set the cable.yml
Should set adapter as redis in development
```yaml
development:
adapter: redis
url: redis://localhost:6379/1
```
### Import the js and css in the page which you want show notifications
```erb
<%= javascript_include_tag 'rails_notice/notice_channel', 'data-turbolinks-eval': 'false' %>
<%= stylesheet_link_tag 'rails_notice/cable' %>
```
### View: add link
```erb
<%= render 'notice_link' %>
```
### Model Setting
```ruby
# which model can receive notifications
class User < ApplicationRecord
include RailsNotice::Receiver
end
```
### Controller Setting
```ruby
class ApplicationController < ActionController::Base
include RailsNotice::Application
end
```
### Channel Setting
```ruby
module ApplicationCable
class Connection < ActionCable::Connection::Base
prepend RailsNoticeConnection
end
end
```
## License
License 采用 [LGPL-3.0](https://opensource.org/licenses/LGPL-3.0).