scinote-web/app/controllers/user_notifications_controller.rb

36 lines
856 B
Ruby
Raw Normal View History

2016-09-29 20:49:58 +08:00
class UserNotificationsController < ApplicationController
2016-10-03 20:40:15 +08:00
layout "fluid"
def index
@notifications = UserNotification.list_all(@current_user)
@notifications_by_type = { :assignment => 3, :recent_changes => 4, :system_message => 5 }
end
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