From 69693d0a373dd06f146e00f464a1eae442026290 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 26 Oct 2024 20:06:23 +0200 Subject: [PATCH] improve checks index --- app/controllers/checks_controller.rb | 2 +- app/views/checks/index.html.slim | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controllers/checks_controller.rb b/app/controllers/checks_controller.rb index 2cf6537..04ca078 100644 --- a/app/controllers/checks_controller.rb +++ b/app/controllers/checks_controller.rb @@ -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 diff --git a/app/views/checks/index.html.slim b/app/views/checks/index.html.slim index 2ef03f7..65d8225 100644 --- a/app/views/checks/index.html.slim +++ b/app/views/checks/index.html.slim @@ -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