From 33eacbbc58b81fcd0aca4cdaa27ffeb6870dbd72 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 14 Dec 2018 12:27:50 -0300 Subject: [PATCH] mostrar los articulos para revision o incompletos --- app/models/post.rb | 8 ++++++++ app/views/posts/index.haml | 18 +++++++++++++----- config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index 5fd8ba8..8710aed 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -81,6 +81,14 @@ class Post @post.nil? || !File.exist?(@post.try(:path)) end + def draft? + fetch_front_matter('draft', false) + end + + def incomplete? + fetch_front_matter('incomplete', false) + end + # El número de orden del artículo, si no tiene uno, se le asigna la # posición en la colección de artículos def order diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 5472fb4..77803d0 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -94,11 +94,19 @@ %td{class: direction} = link_to post.title, site_post_path(@site, post, lang: @lang) - %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') + - 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') + %td - if post.translations %small diff --git a/config/locales/en.yml b/config/locales/en.yml index cf2b21b..a6d2d7b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -174,6 +174,8 @@ en: edit: 'Edit' save: 'Save' save_incomplete: 'Save for later' + draft: revision + incomplete: draft author: 'Author' author_help: 'You can change the authorship of the post. If your site accepts guests, changing the authorship to an e-mail address will allow them to edit the post.' date: 'Publication date' diff --git a/config/locales/es.yml b/config/locales/es.yml index 3593f7e..de6fae3 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -177,6 +177,8 @@ es: new: 'Empezar un artículo nuevo' index: 'Artículos' edit: 'Editar' + draft: en revisión + incomplete: borrador save: 'Guardar' save_incomplete: 'Guardar para después' author: 'Autorx'