scinote-web/app/controllers/user_notifications_controller.rb

29 lines
663 B
Ruby
Raw Normal View History

2016-09-29 20:49:58 +08:00
class UserNotificationsController < ApplicationController
2016-09-28 22:03:52 +08:00
def recent_notifications
2016-09-29 20:49:58 +08:00
@recent_notifications = UserNotification.recent_notifications(current_user)
respond_to do |format|
format.json do
render json: {
html: render_to_string(
partial: 'recent_notifications.html.erb'
)
}
end
end
UserNotification.seen_by_user(current_user)
2016-09-29 20:49:58 +08:00
end
def unseen_notification
2016-10-03 14:20:23 +08:00
@number = UserNotification.unseen_notification_count(current_user)
2016-09-29 20:49:58 +08:00
respond_to do |format|
format.json do
render json: {
notificationNmber: @number
}
end
end
2016-09-28 22:03:52 +08:00
end
end