diff --git a/app/models/post.rb b/app/models/post.rb index 5fd8ba80..8710aed2 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 5472fb45..77803d05 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 cf2b21b1..a6d2d7b1 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 3593f7ec..de6fae34 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'