2018-02-05 17:27:12 +00:00
|
|
|
.row
|
|
|
|
.col
|
2018-02-22 19:01:11 +00:00
|
|
|
= render 'layouts/breadcrumb',
|
|
|
|
crumbs: [ link_to(t('sites.index'), sites_path), @site.name, link_to(t('posts.index'), site_posts_path(@site)), @category ]
|
2018-02-26 19:59:55 +00:00
|
|
|
= render 'layouts/help', help: t('help.breadcrumbs')
|
2018-02-03 22:37:09 +00:00
|
|
|
.row
|
|
|
|
.col
|
2019-02-16 16:58:12 +00:00
|
|
|
%h1= @site.config.fetch('title', @site.name_with_i18n(@lang))
|
2018-01-29 22:19:10 +00:00
|
|
|
|
2018-02-03 22:37:09 +00:00
|
|
|
.row
|
|
|
|
.col
|
2018-02-27 21:26:29 +00:00
|
|
|
.btn-group
|
2018-10-02 20:13:31 +00:00
|
|
|
- if @site.templates.empty?
|
|
|
|
= link_to t('posts.new'), new_site_post_path(@site, lang: @lang),
|
|
|
|
class: 'btn btn-success'
|
|
|
|
- else
|
2019-02-16 18:28:06 +00:00
|
|
|
= link_to t('posts.new_with_template', template: @site.templates.first.id.humanize),
|
|
|
|
new_site_post_path(@site, lang: @lang, template: @site.templates.first.id),
|
2018-10-02 20:13:31 +00:00
|
|
|
class: 'btn btn-success'
|
2019-07-04 16:23:43 +00:00
|
|
|
- if @site.usuarie? current_usuarie
|
2019-02-16 18:28:06 +00:00
|
|
|
%button.btn.btn-success.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' },
|
|
|
|
aria: { haspopup: 'true', expanded: 'false' }}
|
|
|
|
%span.sr-only= t('posts.dropdown')
|
|
|
|
.dropdown-menu
|
|
|
|
- @site.templates.each do |template|
|
|
|
|
= link_to template.id.humanize,
|
|
|
|
new_site_post_path(@site, lang: @lang, template: template.id),
|
|
|
|
class: 'dropdown-item'
|
2018-09-06 19:49:37 +00:00
|
|
|
- @site.translations.each do |l|
|
|
|
|
= link_to t("i18n.#{l}"), site_posts_path(@site, category: @category, lang: l),
|
|
|
|
class: 'btn btn-info'
|
|
|
|
.btn-group.pull-right
|
|
|
|
= link_to t('posts.categories'), site_posts_path(@site, lang: @lang), class: 'btn btn-secondary'
|
|
|
|
%button.btn.btn-secondary.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' },
|
|
|
|
aria: { haspopup: 'true', expanded: 'false' }}
|
|
|
|
%span.sr-only= t('posts.dropdown')
|
|
|
|
.dropdown-menu
|
|
|
|
- @site.categories.each do |c|
|
|
|
|
= link_to c.split(':').first,
|
|
|
|
site_posts_path(@site, lang: @lang, category: c),
|
|
|
|
class: (params[:category] == c) ? 'dropdown-item active' : 'dropdown-item'
|
2018-02-03 22:37:09 +00:00
|
|
|
|
|
|
|
.row
|
|
|
|
.col
|
2018-04-30 18:51:39 +00:00
|
|
|
= render 'layouts/flash'
|
2018-02-22 19:01:11 +00:00
|
|
|
- if @posts.present?
|
2018-04-30 20:50:29 +00:00
|
|
|
.row
|
|
|
|
.col
|
|
|
|
%small.pull-right
|
|
|
|
= t('posts.sort.by')
|
|
|
|
- %w[order date].each do |s|
|
|
|
|
= link_to t("posts.sort.#{s}"),
|
|
|
|
site_posts_path(@site,
|
|
|
|
category: @category,
|
|
|
|
lang: @lang,
|
|
|
|
sort_by: s)
|
2018-04-27 20:24:28 +00:00
|
|
|
= form_tag site_reorder_posts_path, method: :post do
|
2018-04-30 17:19:19 +00:00
|
|
|
= hidden_field 'posts', 'lang', value: @lang
|
2018-09-28 15:47:02 +00:00
|
|
|
- if policy(@site).reorder_posts?
|
|
|
|
- if @site.ordered? @lang
|
|
|
|
.reorder-posts-panel.alert.alert-info.alert-dismissible.fade.show{role: 'alert'}
|
|
|
|
= raw t('help.posts.reorder')
|
|
|
|
%br
|
|
|
|
= submit_tag t('posts.reorder_posts'), class: 'btn btn-success'
|
|
|
|
%button.close{type: 'button',
|
|
|
|
'aria-label': t('help.close') }
|
|
|
|
%span{'aria-hidden': true} ×
|
|
|
|
- else
|
|
|
|
.alert.alert-danger.alert-dismissible.fade.show{role: 'alert'}
|
|
|
|
= raw t('errors.posts.disordered')
|
|
|
|
%br
|
|
|
|
= hidden_field 'posts', 'force', value: true
|
|
|
|
= submit_tag t('errors.posts.disordered_button'), class: 'btn btn-danger'
|
|
|
|
%button.close{type: 'button',
|
|
|
|
data: { dismiss: 'alert' },
|
|
|
|
'aria-label': t('help.close') }
|
|
|
|
%span{'aria-hidden': true} ×
|
2018-05-17 18:18:59 +00:00
|
|
|
%table.table.table-condensed.table-striped{class: (@site.ordered? @lang) ? 'table-draggable' : ''}
|
2018-04-27 20:24:28 +00:00
|
|
|
%tbody
|
|
|
|
- @posts.each_with_index do |post, i|
|
|
|
|
- if @category
|
|
|
|
-# saltearse el post a menos que esté en la categoría
|
|
|
|
-# por la que estamos filtrando
|
|
|
|
- next unless post.categories.include?(@category)
|
|
|
|
-# establecer la direccion del texto
|
|
|
|
- direction = post.get_front_matter(:dir)
|
|
|
|
%tr
|
2018-09-28 15:47:02 +00:00
|
|
|
- if policy(@site).reorder_posts? && @site.ordered?(@lang)
|
2018-05-02 17:23:45 +00:00
|
|
|
%td
|
|
|
|
= fa_icon 'arrows-v', class: 'handle'
|
|
|
|
= hidden_field 'posts[order]', i, value: post.order, class: 'post_order'
|
|
|
|
%small
|
|
|
|
%br
|
|
|
|
%span.order.is= post.order
|
|
|
|
%span.order.was.d-none{data: { order: post.order }}= "(#{post.order})"
|
2018-04-27 20:24:28 +00:00
|
|
|
|
|
|
|
%td{class: direction}
|
|
|
|
= link_to post.title, site_post_path(@site, post, lang: @lang)
|
2018-12-14 15:27:50 +00:00
|
|
|
- unless post.categories.empty?
|
|
|
|
%br
|
|
|
|
%small
|
|
|
|
- post.categories.each do |c|
|
|
|
|
= link_to c, site_posts_path(@site, category: c, lang: @lang),
|
|
|
|
data: { toggle: 'tooltip' }, title: t('help.category')
|
|
|
|
- if post.draft? || post.incomplete?
|
|
|
|
%br
|
|
|
|
- if post.draft?
|
|
|
|
%span.badge.badge-info= t('posts.draft')
|
|
|
|
- if post.incomplete?
|
|
|
|
%span.badge.badge-warning= t('posts.incomplete')
|
|
|
|
|
2018-04-27 20:24:28 +00:00
|
|
|
%td
|
|
|
|
- if post.translations
|
|
|
|
%small
|
|
|
|
- post.translations.each do |pt|
|
|
|
|
= link_to pt.title, site_post_path(@site, pt, lang: pt.lang),
|
|
|
|
data: { toggle: 'tooltip' }, title: t("i18n.#{pt.lang}")
|
|
|
|
%br
|
2018-02-22 19:01:11 +00:00
|
|
|
|
2018-04-27 20:24:28 +00:00
|
|
|
%td= post.date.strftime('%F')
|
2019-05-30 17:33:51 +00:00
|
|
|
%td
|
|
|
|
- if policy(post).edit?
|
|
|
|
= link_to t('posts.edit'),
|
|
|
|
edit_site_post_path(@site, post, lang: @lang),
|
|
|
|
class: 'btn btn-info'
|
|
|
|
- if policy(post).destroy?
|
|
|
|
= link_to t('posts.destroy'),
|
|
|
|
site_post_path(@site, post, lang: @lang),
|
|
|
|
class: 'btn btn-danger',
|
|
|
|
method: :delete,
|
|
|
|
data: { confirm: t('posts.confirm_destroy') }
|
2018-02-22 19:01:11 +00:00
|
|
|
- else
|
|
|
|
%h2= t('posts.none')
|