diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 5c490382..67872a73 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -53,7 +53,7 @@ class PostsController < ApplicationController :cover, :layout, :permalink, :objetivos, :duracion, :formato, :habilidades, conocimientos: [], sesiones_ejercicios_relacionados: [], - materiales_requeridos: [], lang: [], + materiales_requeridos: [], lang: {}, tags: [], categories: []) end end diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index b83cb664..8d3020fb 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -55,7 +55,7 @@ %small.text-muted.form-text= t('posts.permalink_help') .form-group = label_tag 'post_layout', t('posts.layout') - = select_tag 'post[layout][]', + = select_tag 'post[layout]', 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') @@ -66,13 +66,13 @@ %small.text-muted.form-text= t('posts.objetivos_help') .form-group = label_tag 'post_habilidades', t('posts.habilidades') - = select_tag 'post[habilidades][]', + = select_tag 'post[habilidades]', 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') - = select_tag 'post[formato][]', + = select_tag 'post[formato]', 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') @@ -94,6 +94,12 @@ 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') + - %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') :javascript $(document).on('turbolinks:load', function() { diff --git a/config/locales/en.yml b/config/locales/en.yml index 0c4d718b..a23713f8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -41,6 +41,11 @@ en: sesiones_ejercicios_relacionados_help: 'Select all related sessions/exercises' materiales_requeridos: 'Needed materials' materiales_requeridos_help: 'Select all materials needed for this session' + lang: + es: 'Slug for Spanish' + en: 'Slug for English' + ar: 'Slug for Arabic' + lang_help: 'Complete this field with the slug for the post in another language to associate them' logger: rm: 'Removed %{path}' errors: diff --git a/config/locales/es.yml b/config/locales/es.yml index 9f135d24..118ac3be 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -39,6 +39,11 @@ es: sesiones_ejercicios_relacionados_help: 'Elige todas las sesiones relacionadas con esta' materiales_requeridos: 'Materiales requeridos' materiales_requeridos_help: 'Materiales necesarios para esta sesión' + lang: + es: 'Slug castellano' + en: 'Slug en inglés' + ar: 'Slug en árabe' + lang_help: 'El mismo artículo en otro idioma, completa con su slug para poder saltar de uno a otro' logger: rm: 'Eliminado %{path}' errors: