All Projects â†’ rails-engine â†’ Notifications

rails-engine / Notifications

Licence: mit
🛎 Notifications Center engine like GitHub or other application for any Rails applications.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Notifications

Notiflix
Notiflix is a JavaScript library for client-side non-blocking notifications, popup boxes, loading indicators, and more that makes your web projects much better.
Stars: ✭ 172 (-52.09%)
Mutual labels:  notifications, notification
Graphical notifications Zabbix
No description or website provided.
Stars: ✭ 77 (-78.55%)
Mutual labels:  notifications, notification
Django Webpush
Web Push Notification Package for Django
Stars: ✭ 217 (-39.55%)
Mutual labels:  notifications, notification
Reapop
📮 A simple and customizable React notifications system
Stars: ✭ 1,155 (+221.73%)
Mutual labels:  notifications, notification
AndroidProjects
个人总结归纳Android知识点。1.Data Binding框架MVVM;2. BaseView;3.CollapseView;4.Notification;5.MultiChannelBuild;6.SwipeBack;7.CustomTabs;8.HandlerCourse;9.VolleyStudy;10.OkHttpStudy;11.PermissionManage;12.InterView;13.KotlinLearning
Stars: ✭ 32 (-91.09%)
Mutual labels:  notifications, notification
Xnotify
read notifications from stdin and pop them up on the screen
Stars: ✭ 97 (-72.98%)
Mutual labels:  notifications, notification
flasher
A powerful and flexible flash notifications system for PHP
Stars: ✭ 46 (-87.19%)
Mutual labels:  notifications, notification
Notie
🔔 a clean and simple notification, input, and selection suite for javascript, with no dependencies
Stars: ✭ 6,170 (+1618.66%)
Mutual labels:  notifications, notification
react-awesome-notifications
A beautiful fully customizable React + Redux notification system built with styled-components
Stars: ✭ 29 (-91.92%)
Mutual labels:  notifications, notification
PushMeBaby
iOS Push Notification Debug App. You can use this app during iOS Push Notification (development or production) to push notifications on your device from your Mac.
Stars: ✭ 47 (-86.91%)
Mutual labels:  notifications, notification
React Notie
Simple notifications for react
Stars: ✭ 27 (-92.48%)
Mutual labels:  notifications, notification
notifyme
react-notification-timeline is a react based component helps in managing the notification in time-based manner.
Stars: ✭ 94 (-73.82%)
Mutual labels:  notifications, notification
Yii2 Slack Log
Pretty Slack log target for Yii 2
Stars: ✭ 24 (-93.31%)
Mutual labels:  notifications, notification
Telegram Bot Github
Allows to you receive GitHub notifications right in the Telegram
Stars: ✭ 103 (-71.31%)
Mutual labels:  notifications, notification
Yii2 Telegram Log
Telegram log target for Yii 2
Stars: ✭ 24 (-93.31%)
Mutual labels:  notifications, notification
React Materialui Notifications
Spec compliant notifications for react and material ui users
Stars: ✭ 252 (-29.81%)
Mutual labels:  notifications, notification
Monitor Table Change With Sqltabledependency
Get SQL Server notification on record table change
Stars: ✭ 459 (+27.86%)
Mutual labels:  notifications, notification
spontit-api-python-wrapper
Send functional, flexible push notifications to iOS, Android, and desktop devices (without your own app or website).
Stars: ✭ 35 (-90.25%)
Mutual labels:  notifications, notification
react-notify
Tiny React's module that shows notifications.
Stars: ✭ 55 (-84.68%)
Mutual labels:  notifications, notification
vue-notification-bell
Vue.js notification bell component.
Stars: ✭ 64 (-82.17%)
Mutual labels:  notifications, notification

Notifications

Mountable notifications for any Rails applications.

Gem Version Build Status codecov.io

Example:

2016-03-29 10 48 16

Installation

$ bundle add notifications

You now have a notifications generator in your Rails application:

$ rails g notifications:install

You can generate views, controllers if you need to customize them:

$ rails g notifications:views
$ rails g notifications:controllers

Usage

Create a Notification

class User
  def follow(user)
    Notification.create(notify_type: 'follow', actor: self, user: user)
  end
end

class Comment
  belongs_to :post
  belongs_to :user

  after_commit :create_notifications, on: [:create]
  def create_notifications
    Notification.create(
      notify_type: 'comment',
      actor: self.user,
      user: self.post.user,
      target: self)
  end
end

Get unread notifications count for a user:

# unread count
unread_count = Notification.unread_count(current_user)

# read count
read_count = Notification.read_count(current_user)

# for non-user class
Notifications.config.user_class = 'Member'

#or change

Notifications.configure do
  # Class name of you User model, default: 'User'
  self.user_class = 'User'

  # Method of user name in User model, default: 'name'
  # self.user_name_method = 'name'

  # Method of user avatar in User model, default: nil
  # self.user_avatar_url_method = nil

  # Method name of user profile page path, in User model, default: nil
  # self.user_profile_url_method = 'profile_url'

  # authenticate_user method in your Controller, default: nil
  # If you use Devise, authenticate_user! is correct
  # self.authenticate_user_method = 'authenticate_user!'

  # current_user method name in your Controller, default: 'current_user'
  # If you use Devise, current_user is correct
  # self.current_user_method = 'current_user'
end


Write your custom Notification partial view for notify_types:

If you create a notify_type, you need to add a partial view in app/views/notifications/ path, for example:

# There have two notify_type
Notification.create(notify_type: 'follow' ....)
Notification.create(notify_type: 'mention', target: @reply, second_target: @topic, ....)

Your app must have:

  • app/views/notifications/_follow.html.erb
  • app/views/notifications/_mention.html.erb
# app/views/notifications/_follow.html.erb
<div class="media-heading">
  <%= link_to notification.actor.title, main_app.user_path(notification.actor) %> just followed you.
</div>
# app/views/notifications/_mention.html.erb
<div class="media-heading">
  <%= link_to notification.actor.title, main_app.user_path(notification.actor) %> has mentioned you in
  <%= link_to notification.second_target.title, main_app.topic_path(notification.second_target) %>
</div>
<div class="media-content">
  <%= notification.target.body %>
</div>

NOTE: When you want use Rails route path name in notification views, you must use main_app prefix. etc: main_app.user_path(user)

About Notification template N+1 performance

It is recommended that you use second_level_cache for solving N+1 performance issues.

Contributing

Testing for multiple Rails versions:

make test_51
# or test all
make test

Site Used

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].