Commit 580add69 authored by Tugce Nur Tas's avatar Tugce Nur Tas

add sorting options to performance reports index

parent da5ed23b
Pipeline #34520 passed with stage
in 40 minutes and 38 seconds
......@@ -2,8 +2,10 @@ class PerformanceReportsController < ApplicationController
before_action :set_performance_report, only: [:show, :edit, :update, :destroy]
def index
@performance_reports = PerformanceReport.all
authorize PerformanceReport
@q = PerformanceReport.all.ransack(params[:q])
@q.sorts = ['created_at desc'] if @q.sorts.empty?
@performance_reports = @q.result
end
def show
......
......@@ -11,13 +11,14 @@ nav.navbar.section-navigation
thead
tr
th.hidden-print Aktionen
th= sort_link @q, :title
th= t_attr(:period)
th= t_attr(:created_at)
th= sort_link @q, :created_at
tbody
- @performance_reports.each do |performance_report|
tr
td.index-action-cell.hidden-print
td.index-action-cell.hidden-print.fixed-width-md
= button_link icon_span(:show), performance_report, title: 'Anzeigen'
= button_link icon_span(:edit), edit_performance_report_path(performance_report),
title: 'Bearbeiten'
......@@ -26,6 +27,7 @@ nav.navbar.section-navigation
= button_link icon_span(:xlsx),
performance_report_path(performance_report, format: :xlsx),
title: 'Excel herunterladen'
td= performance_report.title if performance_report.title?
td
- if performance_report.year.present?
= performance_report.year
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment