2018-02-02 22:20:31 +00:00
|
|
|
- unless @post.errors.empty?
|
|
|
|
.alert.alert-danger
|
|
|
|
%ul
|
2018-02-03 22:37:09 +00:00
|
|
|
- @post.errors.each do |_,error|
|
2018-02-02 22:20:31 +00:00
|
|
|
%li= error
|
|
|
|
|
2018-02-10 23:45:11 +00:00
|
|
|
-# TODO seleccionar la dirección por defecto según el idioma actual
|
|
|
|
- direction = @post.get_front_matter(:dir) || 'ltr'
|
2018-02-10 16:09:42 +00:00
|
|
|
-# string para configurar la clase con direccion de texto
|
2018-02-10 23:45:11 +00:00
|
|
|
- field_class = "form-control #{direction}"
|
2018-02-03 22:37:09 +00:00
|
|
|
-# TODO habilitar form_for
|
|
|
|
- if @post.new?
|
|
|
|
- url = site_posts_path(@site)
|
|
|
|
- method = :post
|
|
|
|
- else
|
|
|
|
- url = site_post_path(@site, @post)
|
|
|
|
- method = :patch
|
|
|
|
= form_tag url, method: method, class: 'form' do
|
2018-01-31 20:29:27 +00:00
|
|
|
.form-group
|
|
|
|
= submit_tag t('posts.save'), class: 'btn btn-success'
|
2018-02-10 16:30:06 +00:00
|
|
|
.form-group
|
|
|
|
= label_tag 'post_dir', t('posts.dir')
|
|
|
|
= select_tag 'post[dir]',
|
2018-02-11 18:23:20 +00:00
|
|
|
options_for_select([[t('posts.ltr'), 'ltr'], [t('posts.rtl'), 'rtl']], direction),
|
|
|
|
{ class: 'form-control' }
|
2018-01-31 20:29:27 +00:00
|
|
|
.form-group
|
2018-02-10 16:09:42 +00:00
|
|
|
= text_field 'post', 'title', value: @post.title, class: field_class,
|
2018-01-31 20:29:27 +00:00
|
|
|
placeholder: t('posts.title')
|
2018-02-10 23:45:11 +00:00
|
|
|
.form-group{class: direction}
|
2018-01-31 20:29:27 +00:00
|
|
|
= text_area_tag 'post[content]', @post.content, autofocus: true,
|
2018-02-10 23:40:37 +00:00
|
|
|
class: 'post-content',
|
2018-02-03 22:37:09 +00:00
|
|
|
cols: 72, wrap: 'hard'
|
2018-01-31 20:29:27 +00:00
|
|
|
.form-group
|
|
|
|
= label_tag 'post_date', t('posts.date')
|
2018-02-03 22:37:09 +00:00
|
|
|
= date_field 'post', 'date', value: @post.date.try(:strftime, '%F'),
|
2018-01-31 20:29:27 +00:00
|
|
|
class: 'form-control'
|
|
|
|
%small.text-muted.form-text= t('posts.date_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_categories', t('posts.categories')
|
2018-02-03 23:41:02 +00:00
|
|
|
= select_tag 'post[categories][]',
|
|
|
|
options_for_select(@site.categories, @post.categories),
|
|
|
|
{ class: 'form-control select2', multiple: 'multiple' }
|
2018-01-31 20:29:27 +00:00
|
|
|
%small.text-muted.form-text= t('posts.tags_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_tags', t('posts.tags')
|
2018-02-03 23:41:02 +00:00
|
|
|
= select_tag 'post[tags][]',
|
|
|
|
options_for_select(@site.tags, @post.tags),
|
|
|
|
{ class: 'form-control select2', multiple: 'multiple' }
|
2018-01-31 20:29:27 +00:00
|
|
|
%small.text-muted.form-text= t('posts.tags_help')
|
2018-02-02 22:20:31 +00:00
|
|
|
.form-group
|
|
|
|
= label_tag 'post_slug', t('posts.slug')
|
|
|
|
= text_field 'post', 'slug', value: @post.slug,
|
|
|
|
class: 'form-control'
|
|
|
|
%small.text-muted.form-text= t('posts.slug_help')
|
2018-02-08 14:05:05 +00:00
|
|
|
.form-group
|
|
|
|
= label_tag 'post_cover', t('posts.cover')
|
|
|
|
= text_field 'post', 'cover', value: @post.get_front_matter(:cover),
|
|
|
|
class: 'form-control'
|
|
|
|
%small.text-muted.form-text= t('posts.cover_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_permalink', t('posts.permalink')
|
|
|
|
= text_field 'post', 'permalink', value: @post.get_front_matter(:permalink),
|
|
|
|
class: 'form-control'
|
|
|
|
%small.text-muted.form-text= t('posts.permalink_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_layout', t('posts.layout')
|
2018-02-08 16:02:20 +00:00
|
|
|
= select_tag 'post[layout]',
|
2018-02-08 14:05:05 +00:00
|
|
|
options_for_select(@site.everything_of(:layout), @post.get_front_matter(:layout)),
|
|
|
|
{ class: 'form-control select2' }
|
|
|
|
%small.text-muted.form-text= t('posts.layout_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_objetivos', t('posts.objetivos')
|
|
|
|
= text_area 'post', 'objetivos', value: @post.get_front_matter(:objetivos),
|
|
|
|
class: 'form-control'
|
|
|
|
%small.text-muted.form-text= t('posts.objetivos_help')
|
2018-02-08 19:11:53 +00:00
|
|
|
.form-group
|
|
|
|
= label_tag 'post_recomendaciones', t('posts.recomendaciones')
|
|
|
|
= text_area 'post', 'recomendaciones', value: @post.get_front_matter(:recomendaciones),
|
|
|
|
class: 'form-control'
|
|
|
|
%small.text-muted.form-text= t('posts.recomendaciones_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_duracion', t('posts.duracion')
|
|
|
|
= text_field 'post', 'duracion', value: @post.get_front_matter(:duracion),
|
|
|
|
class: 'form-control'
|
|
|
|
%small.text-muted.form-text= t('posts.duracion_help')
|
2018-02-08 14:05:05 +00:00
|
|
|
.form-group
|
|
|
|
= label_tag 'post_habilidades', t('posts.habilidades')
|
2018-02-08 16:02:20 +00:00
|
|
|
= select_tag 'post[habilidades]',
|
2018-02-08 14:05:05 +00:00
|
|
|
options_for_select(@site.everything_of(:habilidades), @post.get_front_matter(:habilidades)),
|
|
|
|
{ class: 'form-control select2' }
|
|
|
|
%small.text-muted.form-text= t('posts.habilidades_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_formato', t('posts.formato')
|
2018-02-08 16:02:20 +00:00
|
|
|
= select_tag 'post[formato]',
|
2018-02-08 14:05:05 +00:00
|
|
|
options_for_select(@site.everything_of(:formato), @post.get_front_matter(:formato)),
|
|
|
|
{ class: 'form-control select2' }
|
|
|
|
%small.text-muted.form-text= t('posts.formato_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_conocimientos', t('posts.conocimientos')
|
|
|
|
= select_tag 'post[conocimientos][]',
|
|
|
|
options_for_select(@site.everything_of(:conocimientos), @post.get_front_matter(:conocimientos)),
|
|
|
|
{ class: 'form-control select2', multiple: 'multiple' }
|
|
|
|
%small.text-muted.form-text= t('posts.conocimientos_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_sesiones_ejercicios_relacionados', t('posts.sesiones_ejercicios_relacionados')
|
|
|
|
= select_tag 'post[sesiones_ejercicios_relacionados][]',
|
|
|
|
options_for_select(@site.everything_of(:title), @post.get_front_matter(:sesiones_ejercicios_relacionados)),
|
|
|
|
{ class: 'form-control select2', multiple: 'multiple' }
|
|
|
|
%small.text-muted.form-text= t('posts.sesiones_ejercicios_relacionados_help')
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_materiales_requeridos', t('posts.materiales_requeridos')
|
|
|
|
= select_tag 'post[materiales_requeridos][]',
|
|
|
|
options_for_select(@site.everything_of(:materiales_requeridos), @post.get_front_matter(:materiales_requeridos)),
|
|
|
|
{ class: 'form-control select2', multiple: 'multiple' }
|
|
|
|
%small.text-muted.form-text= t('posts.materiales_requeridos_help')
|
2018-02-08 16:02:20 +00:00
|
|
|
- %w[es en ar].each do |lang|
|
|
|
|
.form-group
|
|
|
|
= label_tag 'post_lang', t("posts.lang.#{lang}")
|
|
|
|
= text_field 'post', "lang[#{lang}]", value: @post.get_front_matter(:lang).dig(lang),
|
|
|
|
class: 'form-control'
|
|
|
|
%small.text-muted.form-text= t('posts.lang_help')
|
2018-02-08 20:54:34 +00:00
|
|
|
.form-group
|
|
|
|
= submit_tag t('posts.save'), class: 'btn btn-success'
|