Class: Elabs::Admin::ReportsController

Inherits:
AdminApplicationController show all
Defined in:
app/controllers/elabs/admin/reports_controller.rb

Constant Summary collapse

DEFAULT_ORDER_FIELD =
'created_at'.freeze

Constants inherited from AdminApplicationController

AdminApplicationController::MAX_ITEMS_PER_PAGE

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /reports/1 DELETE /reports/1.json



18
19
20
21
22
23
24
# File 'app/controllers/elabs/admin/reports_controller.rb', line 18

def destroy
  @report.destroy
  respond_to do |format|
    format.html { redirect_to admin_reports_url, notice: _('Report was successfully destroyed.') }
    format.json { head :no_content }
  end
end

#indexObject

GET /reports GET /reports.json



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

def index
  order     = params['order_by'] || self.class::DEFAULT_ORDER_FIELD
  direction = params['direction'] || 'desc'
  @reports = Report.order(order => direction).all
end