diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 44ce26e..33bdf3f 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -61,4 +61,8 @@ .form-label { font-size: 1.3rem; +} + +.highlight-when-nonempty:not([value=""]) { + @extend .border-primary } \ No newline at end of file diff --git a/app/views/checks/index.html.slim b/app/views/checks/index.html.slim index 126e60e..37493c1 100644 --- a/app/views/checks/index.html.slim +++ b/app/views/checks/index.html.slim @@ -10,17 +10,17 @@ h1 .me-3 = f.check_box :principle_id_in, checked: @q[:principle_id_in].include?(principle.id), label: principle.name_de, id: "principle_id_in_#{principle.id}" = f.submit - -.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" class="#{"text-bg-primary" if filter_params.present?}" +- filter_active = filter_params.to_h.any? { |_, v| v.present? } +.card.mb-3 class="#{"border-primary" if filter_active }" + .card-header.d-flex data-bs-toggle="collapse" href="#filter-form" role="button" aria-expanded="#{filter_active}" aria-controler="filter-form" class="#{"text-bg-primary" if filter_active}" span.bi.bi-funnel strong.ms-2 Filter - .card-body.collapse id="filter-form" class="#{"show" if filter_params.present?}" + .card-body.collapse id="filter-form" class="#{"show" if filter_active}" = bootstrap_form_with(url: checks_path, method: :get, scope: :filter) do |form| = form.hidden_field :page, value: params[:page] if params[:page] .row .col-lg-12 - = form.text_field(:s, placeholder: "suchen...", hide_label: true, value: filter_params[:s]) + = form.text_field(:s, placeholder: "suchen...", class: "highlight-when-nonempty", hide_label: true, value: filter_params[:s] || "") .col-lg-2 label.fw-bold = Principle.model_name.human(count: 2) - Principle.all.sort_by(&:name_de).each do |principle| @@ -49,7 +49,7 @@ h1 .row.mt-3 .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? + = link_to "Filter löschen", checks_path, class: "btn btn-primary ms-3", data: { turbo_prefetch: false } if filter_params.keys.any? table.table.table-striped thead