diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index e1e2c374..14462261 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -25,8 +25,7 @@ - @site.schema_organization.each do |key, _| .custom-control.custom-checkbox - schema = @site.layouts[key] - %input.custom-control-input.magenta{ type: 'checkbox', id: schema, name: "layout[]", class: "", value: schema.name, checked: @filter_params[:layout]&.include?(key.to_s) } - %label.custom-control-label.font-weight-normal{ for: schema }= schema.humanized_name + = render 'schemas/filter', site: @site, key: key, schema: schema, filter: @filter_params %button.btn.btn-secondary.mt-3{ type: 'submit' }= t('posts.filters.submit') = render 'layouts/details', summary: t('posts.new'), diff --git a/app/views/schemas/_filter.haml b/app/views/schemas/_filter.haml index c422c5b8..ca02b11a 100644 --- a/app/views/schemas/_filter.haml +++ b/app/views/schemas/_filter.haml @@ -1,4 +1,10 @@ -- if filter[:layout] == schema.name.to_s - = link_to t('.remove'), site_posts_path(site, **filter.merge(layout: nil)), class: 'btn btn-primary btn-sm m-0' -- else - = link_to t('.filter'), site_posts_path(site, **filter.merge(layout: schema.value)), class: 'btn btn-secondary btn-sm m-0' +%div + %input.custom-control-input.magenta{ type: 'checkbox', id: schema, name: "layout[]", class: "", value: schema.name, checked: @filter_params[:layout]&.include?(key.to_s) } + %label.custom-control-label.font-weight-normal{ for: schema }= schema.humanized_name + + +-# XXX: Solo un nivel de recursividad +- unless local_assigns[:parent_schema] + - schema.schemas.each do |s| + - next if s.hidden? + = render 'schemas/filter', schema: s, key: s.name, site: site, filter: filter \ No newline at end of file