mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-29 15:06:22 +00:00
85 lines
3.2 KiB
Text
85 lines
3.2 KiB
Text
= render 'layouts/breadcrumb',
|
|
crumbs: [link_to(t('sites.index.title'), sites_path),
|
|
@site.name,
|
|
link_to(t('posts.index'),
|
|
site_posts_path(@site)),
|
|
@category]
|
|
|
|
%main.row
|
|
%aside.menu.col-md-3
|
|
%h1
|
|
= link_to @site.title, @site.url
|
|
%p.lead= @site.description
|
|
|
|
%h3= t('posts.new')
|
|
%ul
|
|
- @site.layouts.keys.each do |layout|
|
|
%li= link_to layout.to_s.humanize,
|
|
new_site_post_path(@site, layout: layout)
|
|
|
|
- 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
|
|
= render 'layouts/flash'
|
|
- 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
|
|
- next unless @usuarie || policy(post).show?
|
|
%tr
|
|
%td
|
|
.handle
|
|
= image_tag 'arrows-alt-v.svg'
|
|
-# Orden más alto es mayor prioridad
|
|
= hidden_field 'post[reorder]', post.uuid.value,
|
|
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
|
|
%small
|
|
- post.categories.value.each do |c|
|
|
= link_to c, site_posts_path(@site, category: c)
|
|
|
|
%td
|
|
= post.date.value.strftime('%F')
|
|
%br/
|
|
= post.try(:order).try(:value)
|
|
%td
|
|
- if @usuarie || policy(post).edit?
|
|
= link_to t('posts.edit'),
|
|
edit_site_post_path(@site, post.id),
|
|
class: 'btn'
|
|
- if @usuarie || policy(post).destroy?
|
|
= link_to t('posts.destroy'),
|
|
site_post_path(@site, post.id),
|
|
class: 'btn',
|
|
method: :delete,
|
|
data: { confirm: t('posts.confirm_destroy') }
|