2018-02-05 17:27:12 +00:00
|
|
|
.row
|
|
|
|
.col
|
2018-02-22 19:01:11 +00:00
|
|
|
= render 'layouts/breadcrumb',
|
2019-08-13 19:09:23 +00:00
|
|
|
crumbs: [link_to(t('sites.index'), sites_path),
|
|
|
|
@site.name,
|
|
|
|
link_to(t('posts.index'),
|
|
|
|
site_posts_path(@site)),
|
|
|
|
@category]
|
2018-02-03 22:37:09 +00:00
|
|
|
.row
|
|
|
|
.col
|
2019-08-13 19:09:23 +00:00
|
|
|
%h1= @site.title
|
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
|
2019-08-13 19:09:23 +00:00
|
|
|
= link_to t('posts.new'), new_site_post_path(@site),
|
|
|
|
class: 'btn btn-success'
|
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
|
2019-08-13 19:09:23 +00:00
|
|
|
%table.table.table-condensed.table-striped
|
|
|
|
%tbody
|
|
|
|
- @posts.each do |post|
|
|
|
|
-#
|
|
|
|
saltearse el post a menos que esté en la categoría por
|
|
|
|
la que estamos filtrando
|
|
|
|
- if @category
|
2019-08-20 22:01:35 +00:00
|
|
|
- next unless post.attributes.include? :categories
|
2019-08-13 19:09:23 +00:00
|
|
|
- next unless post.categories.value.include?(@category)
|
|
|
|
%tr
|
2018-05-02 17:23:45 +00:00
|
|
|
%td
|
2019-08-13 19:09:23 +00:00
|
|
|
= link_to post.title.value,
|
|
|
|
site_post_path(@site, post.id)
|
2019-08-20 22:01:35 +00:00
|
|
|
- if post.attributes.include? :categories
|
|
|
|
- unless post.categories.value.empty?
|
|
|
|
%br
|
|
|
|
%small
|
|
|
|
- post.categories.value.each do |c|
|
|
|
|
= link_to c, site_posts_path(@site, category: c)
|
2018-04-27 20:24:28 +00:00
|
|
|
|
2019-08-13 19:09:23 +00:00
|
|
|
%td= post.date.value.strftime('%F')
|
|
|
|
%td
|
|
|
|
- if policy(post).edit?
|
|
|
|
= link_to t('posts.edit'),
|
|
|
|
edit_site_post_path(@site, post.id),
|
|
|
|
class: 'btn btn-info'
|
|
|
|
- if policy(post).destroy?
|
|
|
|
= link_to t('posts.destroy'),
|
|
|
|
site_post_path(@site, post.id),
|
|
|
|
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')
|