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
|
|
|
|
end
|
|
|
|
|
|
|
|
def unseen_notification
|
|
|
|
@number = UserNotification.unseen_notification(current_user)
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.json do
|
|
|
|
render json: {
|
|
|
|
notificationNmber: @number
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2016-09-28 22:03:52 +08:00
|
|
|
end
|
|
|
|
end
|