Files
growstuff/app/controllers/notifications_controller.rb
Skud d3d0ff42b2 Show unread notifications as bold
The view here isn't as DRY as we'd like, but all the options were kind
of ugly, and this one was easiest.
2013-02-22 16:37:23 +11:00

39 lines
935 B
Ruby

class NotificationsController < ApplicationController
load_and_authorize_resource
# GET /notifications
# GET /notifications.json
def index
@notifications = Notification.find_all_by_recipient_id(current_member)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @notifications }
end
end
# GET /notifications/1
# GET /notifications/1.json
def show
@notification = Notification.find(params[:id])
@notification.read = true
@notification.save
respond_to do |format|
format.html # show.html.erb
format.json { render json: @notification }
end
end
# DELETE /notifications/1
# DELETE /notifications/1.json
def destroy
@notification = Notification.find(params[:id])
@notification.destroy
respond_to do |format|
format.html { redirect_to notifications_url }
format.json { head :no_content }
end
end
end