2014-12-09 13:35:11 -08:00
|
|
|
class NotificationsController < ApplicationController
|
2014-12-12 08:54:13 -08:00
|
|
|
before_filter :authenticate_user!
|
|
|
|
|
2014-12-09 13:35:11 -08:00
|
|
|
def index
|
2014-12-14 06:17:52 -08:00
|
|
|
@type = params[:type]
|
2014-12-14 06:24:59 -08:00
|
|
|
@notifications = if @type == 'all'
|
|
|
|
Notification.for(current_user)
|
|
|
|
else
|
|
|
|
Notification.for(current_user).where('LOWER(target_type) = ?', @type)
|
2015-01-08 09:22:27 -08:00
|
|
|
end.paginate(page: params[:page])
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
|
|
|
format.js
|
|
|
|
end
|
2014-12-09 13:35:11 -08:00
|
|
|
end
|
|
|
|
end
|