From 3fbffd5e7a47a945041fd3baa82e113bbdf870c3 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 22 Apr 2019 16:47:30 -0300 Subject: [PATCH] poder colocar el titulo en cualquier parte de la plantilla --- app/models/post.rb | 2 +- app/views/posts/_form.haml | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index 6971f8c..3ffc107 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -23,7 +23,7 @@ class Post # datos que no tienen que terminar en el front matter REJECT_FROM_FRONT_MATTER = %w[date slug ext].freeze # datos que no traemos del template - REJECT_FROM_TEMPLATE = %w[draft categories layout title ext tags date slug post pre].freeze + REJECT_FROM_TEMPLATE = %w[draft categories layout ext tags date slug post pre].freeze DEFAULT_PARAMS = [:title, :date, :content, :slug, :cover, :layout, :permalink, :dir, { lang: {} }, { tags: [] }, { categories: [] }].freeze diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index ce0e31b..af5a120 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -49,9 +49,10 @@ options_for_select([[t('posts.ltr'), 'ltr'], [t('posts.rtl'), 'rtl']], direction), { class: 'form-control' } %small.text-muted.form-text= t('posts.dir_help') - .form-group - = label_tag 'post_title', t('posts.title') - = text_field 'post', 'title', value: @post.title, class: field_class, required: true + - if @post.has_field? :title + .form-group + = label_tag 'post_title', t('posts.title') + = text_field 'post', 'title', value: @post.title, class: field_class, required: true - if @post.content? .form-group{class: direction} = label_tag 'post_content', t('posts.content')