From 1f9d9b308b848fd8789648647e3ed668dd2d17c8 Mon Sep 17 00:00:00 2001 From: maki Date: Fri, 8 Mar 2024 13:58:10 -0300 Subject: [PATCH] feat: agregar contenido como details --- app/views/layouts/_details.haml | 9 ++++++--- app/views/posts/index.haml | 10 ++++------ app/views/schemas/_row.haml | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/views/layouts/_details.haml b/app/views/layouts/_details.haml index a679541a..ca906818 100644 --- a/app/views/layouts/_details.haml +++ b/app/views/layouts/_details.haml @@ -6,10 +6,13 @@ @param :summary_class [String] Clases para el summary - local_assigns[:summary_class] ||= 'h3' +- local_assigns[:closed] ||= '▶'.html_safe; +- local_assigns[:open] ||= '▼'.html_safe; -%details.details.py-2{ id: local_assigns[:id], data: { controller: 'details', action: 'toggle->details#store' } } + +%details.details.py-2{ id: local_assigns[:id], data: { controller: 'details', action: 'toggle->details#store' }, class: local_assigns[:details_class] } %summary.d-flex.flex-row.align-items-center.justify-content-between{ class: local_assigns[:summary_class] } %span= summary - %span.hide-when-open ▶ - %span.show-when-open ▼ + %span.hide-when-open{ class: local_assigns[:open_class] }= local_assigns[:closed] + %span.show-when-open{ class: local_assigns[:closed_class] }= local_assigns[:open] = yield diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index ba0ede1f..afe28a7f 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -17,17 +17,15 @@ %input.custom-control-input.magenta{ type: 'checkbox', id: schema, name: "layouts", class: "" } %label.custom-control-label.font-weight-normal{ for: schema }= schema.humanized_name %button.btn.btn-secondary.mt-3{ type: 'submit' }= t('.filters.submit') - .caja - .d-flex.border.border-magenta.p-2.justify-content-between.align-items-center.w-100 - %h3.magenta.font-weight-bold.m-0= t('posts.new') - %p.h1.magenta.font-weight-bold.m-0= '+' - %table.table-sm.mb-3.w-100 + = render 'layouts/details', summary: t('posts.new'), summary_class: "h3 magenta font-weight-bold m-0 p-2", details_class: "d-flex border border-magenta justify-content-between align-items-center w-100 mb-3", open: "+", closed: "+", open_class: "h1 magenta font-weight-bold m-0", closed_class: "h1 magenta font-weight-bold m-0" do + %table.table-sm.w-100 %tbody - @site.schema_organization.each do |schema, _| - schema = @site.layouts[schema] - next if schema.hidden? = render 'schemas/row', site: @site, schema: schema, filter: @filter_params - + + - if policy(@site_stat).index? = link_to t('stats.index.title'), site_stats_path(@site), class: 'btn btn-secondary' diff --git a/app/views/schemas/_row.haml b/app/views/schemas/_row.haml index 9b727f97..78558dc0 100644 --- a/app/views/schemas/_row.haml +++ b/app/views/schemas/_row.haml @@ -1,4 +1,4 @@ -%tr.border-left.border-right.border-bottom.border-magenta +%tr.border-top.border-magenta %th.font-weight-normal.w-100{ scope: 'row' } - if local_assigns[:parent_schema] %span.text-muted —