programandoarg/pg_rails

View on GitHub
pg_scaffold/lib/generators/pg_slim/templates/index.html.slim

Summary

Maintainability
Test Coverage
- content_for(:title, @clase_modelo.nombre_plural)
- content_for :actions do
  button.btn.btn-sm.btn-primary[type="button" data-bs-toggle="collapse"
                                data-bs-target="#filtros" aria-expanded="false"
                                aria-controls="filtros"]
    span.bi.bi-funnel-fill
    span.d-none.d-sm-inline  Filtrar
  .ms-1
  = @clase_modelo.new.decorate.new_link
  .ms-1
  = @clase_modelo.new.decorate.export_link(request.url)
.collapse.p-2.border-bottom#filtros class="#{ 'show' if any_filter? }"
  .d-flex.align-items-center
    .px-2.d-none.d-sm-inline-block
      span.bi.bi-funnel-fill
    = form_tag nil, class: '', method: :get do
      .row.g-1
        = @filtros.filtros_html
        .col-auto
          = button_tag class: 'btn btn-sm btn-primary col-auto' do
            span.bi.bi-search
        .col-auto
          = link_to <%= plural_route_name %>_path(clean: true),
                    class: 'btn btn-sm btn-secondary col-auto' do
            | Limpiar

div
  - if @collection.any?
    .table-responsive
      table.table.table-sm.listado.xpg-revert-width.xborder-end
        caption.ps-3 = page_entries_info @collection
        thead.table-light
          tr
            - atributos_para_listar.each do |att|
              th = encabezado att, ordenable: true
            th
        tbody
          - @collection.each do |object|
            - object = object.decorate
            tr id="#{dom_id(object)}"
              - atributos_para_listar.each do |att|
                th = object.send(att)
              td.text-nowrap.text-end.ps-5
                = object.show_link
                = object.edit_link(text: '', klass: 'btn-light')
                = object.destroy_link

    .ps-3.justify-content-center
      = paginate(@collection)
  - else
    p.m-3 No hay #{@clase_modelo.nombre_plural.downcase} que mostrar