mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 21:46:22 +00:00
parent
f2f6656b4c
commit
ff83c97070
3 changed files with 20 additions and 19 deletions
|
@ -157,7 +157,7 @@ class PostsController < ApplicationController
|
||||||
#
|
#
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
def filter_params
|
def filter_params
|
||||||
@filter_params ||= params.permit(:q, :category, :layout, :page).to_hash.select do |_, v|
|
@filter_params ||= params.permit(:q, :category, :page, layout: []).to_hash.select do |_, v|
|
||||||
v.present?
|
v.present?
|
||||||
end.transform_keys(&:to_sym)
|
end.transform_keys(&:to_sym)
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,17 +7,17 @@
|
||||||
= render 'sites/build', site: @site, class: 'btn-block'
|
= render 'sites/build', site: @site, class: 'btn-block'
|
||||||
|
|
||||||
= render 'layouts/details', summary: t('posts.filters.title') do
|
= render 'layouts/details', summary: t('posts.filters.title') do
|
||||||
.border.border-magenta.p-1
|
%form.border.border-magenta.p-1{method: :get}
|
||||||
%legend.font-weight-bold.m-0.h6= 'Tipo de contenido'
|
%legend.font-weight-bold.m-0.h6= 'Tipo de contenido'
|
||||||
.custom-control.custom-checkbox
|
|
||||||
|
|
||||||
- @site.schema_organization.each do |schema, _|
|
- @site.schema_organization.each do |schema, _|
|
||||||
.row.no-gutters
|
.custom-control.custom-checkbox
|
||||||
- schema = @site.layouts[schema]
|
- schema = @site.layouts[schema]
|
||||||
%input.custom-control-input.magenta{ type: 'checkbox', id: schema, name: "layouts", class: "" }
|
%input.custom-control-input.magenta{ type: 'checkbox', id: schema, name: "layout[]", class: "", value: schema.name }
|
||||||
%label.custom-control-label.font-weight-normal{ for: schema }= schema.humanized_name
|
%label.custom-control-label.font-weight-normal{ for: schema }= schema.humanized_name
|
||||||
%button.btn.btn-secondary.mt-3{ type: 'submit' }= t('.filters.submit')
|
%button.btn.btn-secondary.mt-3{ type: 'submit' }= t('.filters.submit')
|
||||||
= 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
|
= render 'layouts/details', summary: t('posts.new'), summary_class: "h4 magenta font-weight-bold m-0 px-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
|
%table.table-sm.w-100
|
||||||
%tbody
|
%tbody
|
||||||
- @site.schema_organization.each do |schema, _|
|
- @site.schema_organization.each do |schema, _|
|
||||||
|
|
|
@ -13,10 +13,11 @@
|
||||||
%span.input-group-text.background-white.magenta.border.border-magenta.border-top.border-left-0.border-right.border-bottom
|
%span.input-group-text.background-white.magenta.border.border-magenta.border-top.border-left-0.border-right.border-bottom
|
||||||
%i.fa.fa-fw.fa-search
|
%i.fa.fa-fw.fa-search
|
||||||
%input.sr-only{ type: 'submit' }
|
%input.sr-only{ type: 'submit' }
|
||||||
- @filter_params.each do |param, value|
|
- @filter_params.each do |param, values|
|
||||||
- if param == 'layout'
|
- [values].flatten.each do |value|
|
||||||
|
- if param == :layout
|
||||||
- value = @site.layouts[value.to_sym].humanized_name
|
- value = @site.layouts[value.to_sym].humanized_name
|
||||||
= link_to site_posts_path(@site, **@filter_params.reject { |k, _| k == param }),
|
= link_to site_posts_path(@site, **@filter_params),
|
||||||
class: 'btn btn-secondary btn-sm',
|
class: 'btn btn-secondary btn-sm',
|
||||||
title: t('posts.remove_filter_help', filter: value),
|
title: t('posts.remove_filter_help', filter: value),
|
||||||
aria: { labelledby: "help-filter-#{param}" } do
|
aria: { labelledby: "help-filter-#{param}" } do
|
||||||
|
|
Loading…
Reference in a new issue