Class: Elabs::Member::NotificationsController

Inherits:
MemberApplicationController show all
Defined in:
app/controllers/elabs/member/notifications_controller.rb

Constant Summary collapse

MAX_ITEMS_PER_PAGE =
Elabs.max_members_items_per_page
DEFAULT_ORDER_FIELD =
'created_at'.freeze

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /notifications/1

[View source]

17
18
19
20
# File 'app/controllers/elabs/member/notifications_controller.rb', line 17

def destroy
  @notification.destroy
  redirect_to member_notifications_url, notice: _('Notification was successfully destroyed.')
end

#indexObject

GET /notifications

[View source]

10
11
12
13
14
# File 'app/controllers/elabs/member/notifications_controller.rb', line 10

def index
  order     = params['order_by'] || self.class::DEFAULT_ORDER_FIELD
  direction = params['direction'] || 'desc'
  @notifications = Notification.for_user(current_user).order(order => direction).page(params[:page]).per(self.class::MAX_ITEMS_PER_PAGE)
end