mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-26 10:17:52 -05:00
The view here isn't as DRY as we'd like, but all the options were kind of ugly, and this one was easiest.
39 lines
935 B
Ruby
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
|