2019-09-04 16:50:27 +00:00
|
|
|
= render 'layouts/breadcrumb',
|
2019-09-12 16:57:25 +00:00
|
|
|
crumbs: [link_to(t('sites.index.title'), sites_path),
|
2019-09-04 16:50:27 +00:00
|
|
|
@site.name,
|
|
|
|
link_to(t('posts.index'),
|
|
|
|
site_posts_path(@site)),
|
|
|
|
@category]
|
|
|
|
|
2019-09-12 18:10:01 +00:00
|
|
|
%main.row
|
2019-11-14 17:46:59 +00:00
|
|
|
%aside.menu.col-md-3
|
2019-09-12 18:10:01 +00:00
|
|
|
%h1
|
|
|
|
= link_to @site.title, @site.url
|
|
|
|
%p.lead= @site.description
|
2018-01-29 22:19:10 +00:00
|
|
|
|
2019-11-14 17:46:59 +00:00
|
|
|
%h3= t('posts.new')
|
|
|
|
%ul
|
2020-02-13 15:38:53 +00:00
|
|
|
- @site.layouts.to_h.keys.each do |layout|
|
2020-03-31 20:20:34 +00:00
|
|
|
%li= link_to @site.i18n.dig('layouts', layout.to_s) || layout.to_s.humanize,
|
2019-11-14 17:46:59 +00:00
|
|
|
new_site_post_path(@site, layout: layout)
|
2018-02-03 22:37:09 +00:00
|
|
|
|
2019-09-12 18:10:01 +00:00
|
|
|
- if policy(@site).edit?
|
|
|
|
= link_to t('sites.edit.btn', site: @site.title),
|
|
|
|
edit_site_path(@site), class: 'btn'
|
|
|
|
|
|
|
|
= render 'sites/build', site: @site
|
|
|
|
|
|
|
|
%section.col
|
2018-04-30 18:51:39 +00:00
|
|
|
= render 'layouts/flash'
|
2019-12-11 20:05:31 +00:00
|
|
|
- if @posts.empty?
|
|
|
|
%h2= t('posts.none')
|
|
|
|
- else
|
|
|
|
= form_tag site_posts_reorder_path, method: :post do
|
|
|
|
= submit_tag t('posts.reorder'), class: 'btn submit-reorder'
|
|
|
|
-# TODO: Permitir cambiar el idioma
|
|
|
|
%table.table.table-condensed.table-draggable
|
|
|
|
%tbody
|
|
|
|
- @posts.each_with_index do |post, i|
|
|
|
|
-#
|
|
|
|
saltearse el post a menos que esté en la categoría por
|
|
|
|
la que estamos filtrando
|
|
|
|
- if @category
|
|
|
|
- next unless post.attributes.include? :categories
|
|
|
|
- next unless post.categories.value.include?(@category)
|
|
|
|
- if @layout
|
|
|
|
- next unless post.layout.name == @layout
|
2020-01-02 18:05:28 +00:00
|
|
|
- next unless @usuarie || policy(post).show?
|
2019-12-11 20:05:31 +00:00
|
|
|
%tr
|
|
|
|
%td
|
|
|
|
.handle
|
|
|
|
= image_tag 'arrows-alt-v.svg'
|
|
|
|
-# Orden más alto es mayor prioridad
|
2020-01-02 23:29:04 +00:00
|
|
|
= hidden_field 'post[reorder]', post.uuid.value,
|
2019-12-11 20:05:31 +00:00
|
|
|
value: @posts.length - i, class: 'reorder'
|
|
|
|
%td
|
|
|
|
%small
|
|
|
|
= link_to post.layout.name.to_s.humanize,
|
|
|
|
site_posts_path(@site, layout: post.layout.name)
|
|
|
|
%br/
|
|
|
|
= link_to post.title.value,
|
|
|
|
site_post_path(@site, post.id)
|
|
|
|
- if post.attributes.include? :draft
|
|
|
|
- if post.draft.value
|
|
|
|
%span.badge.badge-primary
|
|
|
|
= post_label_t(:draft, post: post)
|
|
|
|
- if post.attributes.include? :categories
|
|
|
|
- unless post.categories.value.empty?
|
|
|
|
%br
|
2019-11-07 16:06:40 +00:00
|
|
|
%small
|
2019-12-11 20:05:31 +00:00
|
|
|
- post.categories.value.each do |c|
|
|
|
|
= link_to c, site_posts_path(@site, category: c)
|
2018-04-27 20:24:28 +00:00
|
|
|
|
2019-12-11 20:05:31 +00:00
|
|
|
%td
|
|
|
|
= post.date.value.strftime('%F')
|
|
|
|
%br/
|
|
|
|
= post.try(:order).try(:value)
|
|
|
|
%td
|
2020-01-02 18:05:28 +00:00
|
|
|
- if @usuarie || policy(post).edit?
|
2019-12-11 20:05:31 +00:00
|
|
|
= link_to t('posts.edit'),
|
|
|
|
edit_site_post_path(@site, post.id),
|
|
|
|
class: 'btn'
|
2020-01-02 18:05:28 +00:00
|
|
|
- if @usuarie || policy(post).destroy?
|
2019-12-11 20:05:31 +00:00
|
|
|
= link_to t('posts.destroy'),
|
|
|
|
site_post_path(@site, post.id),
|
|
|
|
class: 'btn',
|
|
|
|
method: :delete,
|
|
|
|
data: { confirm: t('posts.confirm_destroy') }
|