improve checks index

This commit is contained in:
david 2024-10-26 20:06:23 +02:00
parent a0e2c7cacb
commit 69693d0a37
2 changed files with 9 additions and 4 deletions

View file

@ -7,7 +7,7 @@ class ChecksController < ApplicationController
# GET /checks or /checks.json
def index
@pagy, @checks = pagy(Check.filter_by(filter_params).order(:conformity_level))
@pagy, @checks = pagy(Check.filter_by(filter_params).order(:external_number))
end
# GET /checks/1 or /checks/1.json

View file

@ -13,7 +13,8 @@ h1
.card.mb-3
.card-header.d-flex data-bs-toggle="collapse" href="#filter-form" role="button" aria-expanded="#{filter_params.present?}" aria-controler="filter-form"
' Filter
span.bi.bi-funnel
strong.ms-2 Filter
.card-body.collapse id="filter-form" class="#{"show" if filter_params.present?}"
= bootstrap_form_with(url: checks_path, method: :get, scope: :filter) do |form|
= form.hidden_field :page, value: params[:page] if params[:page]
@ -40,15 +41,18 @@ h1
.col
= form.submit name: "", value: "Filtern"
= link_to "Filter löschen", checks_path, class: "btn btn-outline-secondary ms-3", data: { turbo_prefetch: false } if filter_params.keys.any?
table.table.table-striped
thead
tr
th
= Check.human_attribute_name(:external_number)
th
= Check.human_attribute_name(:name)
th
= Check.human_attribute_name(:standard_ids)
th
= Check.human_attribute_name(:target_disabilities)
= Check.human_attribute_name(:target_disabilities).truncate(10)
th
= Check.human_attribute_name(:applicability)
th
@ -56,8 +60,9 @@ table.table.table-striped
tbody
- @checks.each do |check|
tr
td = check.external_number
td
= link_to check.display_label&.truncate(64), check
= link_to check.t_name, check
td
= link_to check.standards.map(&:t_name).join(", "), check
td