mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 00:36:21 +00:00
feat: mostrar la lista de artículos organizada #13072
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
a94eaceef5
commit
264c52a53f
6 changed files with 34 additions and 16 deletions
|
@ -6,16 +6,12 @@
|
||||||
= render 'sites/status', site: @site
|
= render 'sites/status', site: @site
|
||||||
|
|
||||||
%h3= t('posts.new')
|
%h3= t('posts.new')
|
||||||
%table.mb-3
|
%table.table.table-sm.mb-3
|
||||||
- @site.layouts.sort_by(&:humanized_name).each do |layout|
|
%tbody
|
||||||
- next if layout.hidden?
|
- @site.schema_organization.each do |schema, _|
|
||||||
%tr
|
- schema = @site.layouts[schema]
|
||||||
%th= layout.humanized_name
|
- next if schema.hidden?
|
||||||
%td.pl-3= link_to t('posts.add'), new_site_post_path(@site, layout: layout.value), class: 'btn btn-secondary btn-sm'
|
= render 'schemas/row', site: @site, schema: schema, filter: @filter_params
|
||||||
- if @filter_params[:layout] == layout.name.to_s
|
|
||||||
%td= link_to t('posts.remove_filter'), site_posts_path(@site, **@filter_params.merge(layout: nil)), class: 'btn btn-primary btn-sm'
|
|
||||||
- else
|
|
||||||
%td= link_to t('posts.filter'), site_posts_path(@site, **@filter_params.merge(layout: layout.value)), class: 'btn btn-secondary btn-sm'
|
|
||||||
|
|
||||||
- if policy(@site_stat).index?
|
- if policy(@site_stat).index?
|
||||||
= link_to t('stats.index.title'), site_stats_path(@site), class: 'btn'
|
= link_to t('stats.index.title'), site_stats_path(@site), class: 'btn'
|
||||||
|
|
1
app/views/schemas/_add.haml
Normal file
1
app/views/schemas/_add.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
= link_to t('.add'), new_site_post_path(site, layout: schema.value), class: 'btn btn-secondary btn-sm m-0'
|
4
app/views/schemas/_filter.haml
Normal file
4
app/views/schemas/_filter.haml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
- 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'
|
12
app/views/schemas/_row.haml
Normal file
12
app/views/schemas/_row.haml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
%tr
|
||||||
|
%th{ scope: 'row' }
|
||||||
|
- if local_assigns[:parent_schema]
|
||||||
|
%span.text-muted —
|
||||||
|
= schema.humanized_name
|
||||||
|
%td.px-0= render 'schemas/add', **local_assigns
|
||||||
|
%td.px-0= render 'schemas/filter', **local_assigns
|
||||||
|
|
||||||
|
-# XXX: Solo un nivel de recursividad
|
||||||
|
- unless local_assigns[:parent_schema]
|
||||||
|
- schema.schemas.each do |s|
|
||||||
|
= render 'schemas/row', schema: s, site: site, filter: filter, parent_schema: schema
|
|
@ -538,9 +538,6 @@ en:
|
||||||
order: 'Order'
|
order: 'Order'
|
||||||
content: 'Text'
|
content: 'Text'
|
||||||
new: 'Post types'
|
new: 'Post types'
|
||||||
add: 'Add'
|
|
||||||
filter: 'Filter'
|
|
||||||
remove_filter: 'Back'
|
|
||||||
remove_filter_help: 'Remove the filter: %{filter}'
|
remove_filter_help: 'Remove the filter: %{filter}'
|
||||||
categories: 'Everything'
|
categories: 'Everything'
|
||||||
index: 'Posts'
|
index: 'Posts'
|
||||||
|
@ -699,3 +696,8 @@ en:
|
||||||
build_stats:
|
build_stats:
|
||||||
index:
|
index:
|
||||||
title: "Publications"
|
title: "Publications"
|
||||||
|
schemas:
|
||||||
|
add: 'Add'
|
||||||
|
filter:
|
||||||
|
filter: 'Filter'
|
||||||
|
remove: 'Back'
|
||||||
|
|
|
@ -547,9 +547,6 @@ es:
|
||||||
content: 'Cuerpo del artículo'
|
content: 'Cuerpo del artículo'
|
||||||
categories: 'Todos'
|
categories: 'Todos'
|
||||||
new: 'Tipos de artículos'
|
new: 'Tipos de artículos'
|
||||||
add: 'Agregar'
|
|
||||||
filter: 'Filtrar'
|
|
||||||
remove_filter: 'Volver'
|
|
||||||
remove_filter_help: 'Quitar este filtro: %{filter}'
|
remove_filter_help: 'Quitar este filtro: %{filter}'
|
||||||
index: 'Artículos'
|
index: 'Artículos'
|
||||||
edit: 'Editar'
|
edit: 'Editar'
|
||||||
|
@ -707,3 +704,9 @@ es:
|
||||||
build_stats:
|
build_stats:
|
||||||
index:
|
index:
|
||||||
title: "Publicaciones"
|
title: "Publicaciones"
|
||||||
|
schemas:
|
||||||
|
add:
|
||||||
|
add: 'Agregar'
|
||||||
|
filter:
|
||||||
|
filter: 'Filtrar'
|
||||||
|
remove: 'Volver'
|
||||||
|
|
Loading…
Reference in a new issue