traducir slugs y enviar algunos campos como strings

This commit is contained in:
f 2018-02-08 13:02:20 -03:00
parent 62a74befdc
commit b87eb4e052
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
4 changed files with 20 additions and 4 deletions

View file

@ -53,7 +53,7 @@ class PostsController < ApplicationController
:cover, :layout, :permalink, :objetivos, :cover, :layout, :permalink, :objetivos,
:duracion, :formato, :habilidades, :duracion, :formato, :habilidades,
conocimientos: [], sesiones_ejercicios_relacionados: [], conocimientos: [], sesiones_ejercicios_relacionados: [],
materiales_requeridos: [], lang: [], materiales_requeridos: [], lang: {},
tags: [], categories: []) tags: [], categories: [])
end end
end end

View file

@ -55,7 +55,7 @@
%small.text-muted.form-text= t('posts.permalink_help') %small.text-muted.form-text= t('posts.permalink_help')
.form-group .form-group
= label_tag 'post_layout', t('posts.layout') = 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)), options_for_select(@site.everything_of(:layout), @post.get_front_matter(:layout)),
{ class: 'form-control select2' } { class: 'form-control select2' }
%small.text-muted.form-text= t('posts.layout_help') %small.text-muted.form-text= t('posts.layout_help')
@ -66,13 +66,13 @@
%small.text-muted.form-text= t('posts.objetivos_help') %small.text-muted.form-text= t('posts.objetivos_help')
.form-group .form-group
= label_tag 'post_habilidades', t('posts.habilidades') = 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)), options_for_select(@site.everything_of(:habilidades), @post.get_front_matter(:habilidades)),
{ class: 'form-control select2' } { class: 'form-control select2' }
%small.text-muted.form-text= t('posts.habilidades_help') %small.text-muted.form-text= t('posts.habilidades_help')
.form-group .form-group
= label_tag 'post_formato', t('posts.formato') = 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)), options_for_select(@site.everything_of(:formato), @post.get_front_matter(:formato)),
{ class: 'form-control select2' } { class: 'form-control select2' }
%small.text-muted.form-text= t('posts.formato_help') %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)), options_for_select(@site.everything_of(:materiales_requeridos), @post.get_front_matter(:materiales_requeridos)),
{ class: 'form-control select2', multiple: 'multiple' } { class: 'form-control select2', multiple: 'multiple' }
%small.text-muted.form-text= t('posts.materiales_requeridos_help') %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 :javascript
$(document).on('turbolinks:load', function() { $(document).on('turbolinks:load', function() {

View file

@ -41,6 +41,11 @@ en:
sesiones_ejercicios_relacionados_help: 'Select all related sessions/exercises' sesiones_ejercicios_relacionados_help: 'Select all related sessions/exercises'
materiales_requeridos: 'Needed materials' materiales_requeridos: 'Needed materials'
materiales_requeridos_help: 'Select all materials needed for this session' 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: logger:
rm: 'Removed %{path}' rm: 'Removed %{path}'
errors: errors:

View file

@ -39,6 +39,11 @@ es:
sesiones_ejercicios_relacionados_help: 'Elige todas las sesiones relacionadas con esta' sesiones_ejercicios_relacionados_help: 'Elige todas las sesiones relacionadas con esta'
materiales_requeridos: 'Materiales requeridos' materiales_requeridos: 'Materiales requeridos'
materiales_requeridos_help: 'Materiales necesarios para esta sesión' 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: logger:
rm: 'Eliminado %{path}' rm: 'Eliminado %{path}'
errors: errors: