tener en cuenta la direccion del texto

This commit is contained in:
f 2018-02-10 13:09:42 -03:00
parent 74a6f320b9
commit ff24960510
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
6 changed files with 26 additions and 8 deletions

View file

@ -48,3 +48,8 @@ textarea.post-content {
font-family: monospace; font-family: monospace;
font-size: 90%; font-size: 90%;
} }
.rtl {
direction: rtl;
text-align: right;
}

View file

@ -50,7 +50,7 @@ class PostsController < ApplicationController
# Solo permitir cambiar estos atributos de cada articulo # Solo permitir cambiar estos atributos de cada articulo
def post_params def post_params
params.require(:post).permit(:title, :date, :content, :slug, params.require(:post).permit(:title, :date, :content, :slug,
:cover, :layout, :permalink, :objetivos, :cover, :layout, :permalink, :objetivos, :dir,
:duracion, :formato, :habilidades, :recomendaciones, :duracion, :formato, :habilidades, :recomendaciones,
conocimientos: [], sesiones_ejercicios_relacionados: [], conocimientos: [], sesiones_ejercicios_relacionados: [],
materiales_requeridos: [], lang: {}, materiales_requeridos: [], lang: {},

View file

@ -4,6 +4,8 @@
- @post.errors.each do |_,error| - @post.errors.each do |_,error|
%li= error %li= error
-# string para configurar la clase con direccion de texto
- field_class = "form-control #{@post.get_front_matter(:dir)}"
-# TODO habilitar form_for -# TODO habilitar form_for
- if @post.new? - if @post.new?
- url = site_posts_path(@site) - url = site_posts_path(@site)
@ -15,11 +17,11 @@
.form-group .form-group
= submit_tag t('posts.save'), class: 'btn btn-success' = submit_tag t('posts.save'), class: 'btn btn-success'
.form-group .form-group
= text_field 'post', 'title', value: @post.title, class: 'form-control', = text_field 'post', 'title', value: @post.title, class: field_class,
placeholder: t('posts.title') placeholder: t('posts.title')
.form-group .form-group{class: @post.get_front_matter(:dir)}
= text_area_tag 'post[content]', @post.content, autofocus: true, = text_area_tag 'post[content]', @post.content, autofocus: true,
class: 'form-control post-content', data: { provide: 'markdown' }, class: 'post-content', data: { provide: 'markdown' },
cols: 72, wrap: 'hard' cols: 72, wrap: 'hard'
.form-group .form-group
= label_tag 'post_date', t('posts.date') = label_tag 'post_date', t('posts.date')
@ -110,6 +112,11 @@
= text_field 'post', "lang[#{lang}]", value: @post.get_front_matter(:lang).dig(lang), = text_field 'post', "lang[#{lang}]", value: @post.get_front_matter(:lang).dig(lang),
class: 'form-control' class: 'form-control'
%small.text-muted.form-text= t('posts.lang_help') %small.text-muted.form-text= t('posts.lang_help')
.form-group
= label_tag 'post_dir', t('posts.dir')
= select_tag 'post[dir]',
options_for_select([[t('posts.ltr'), 'ltr'], [t('posts.rtl'), 'rtl']]),
{ class: 'form-control' }
.form-group .form-group
= submit_tag t('posts.save'), class: 'btn btn-success' = submit_tag t('posts.save'), class: 'btn btn-success'

View file

@ -9,7 +9,7 @@
.row .row
.col .col
%h1= @post.title %h1{class: @post.get_front_matter(:dir)}= @post.title
.row .row
.col .col
@ -18,7 +18,7 @@
.row .row
.col .col
.content .content{class: @post.get_front_matter(:dir)}
:markdown :markdown
#{@post.content} #{@post.content}

View file

@ -54,10 +54,13 @@ en:
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: lang:
es: 'Slug for Spanish' es: 'Slug for Castillian Spanish'
en: 'Slug for English' en: 'Slug for English'
ar: 'Slug for Arabic' ar: 'Slug for Arabic'
lang_help: 'Complete this field with the slug for the post in another language to associate them' lang_help: 'Complete this field with the slug for the post in another language to associate them'
rtl: 'Right to left'
ltr: 'Left to right'
dir: 'Text direction'
logger: logger:
rm: 'Removed %{path}' rm: 'Removed %{path}'
errors: errors:

View file

@ -52,10 +52,13 @@ es:
duracion: 'Duración' duracion: 'Duración'
duracion_help: '¿Cuánto dura la sesión?' duracion_help: '¿Cuánto dura la sesión?'
lang: lang:
es: 'Slug castellano' es: 'Slug en castellano'
en: 'Slug en inglés' en: 'Slug en inglés'
ar: 'Slug en árabe' ar: 'Slug en árabe'
lang_help: 'El mismo artículo en otro idioma, completa con su slug para poder saltar de uno a otro' lang_help: 'El mismo artículo en otro idioma, completa con su slug para poder saltar de uno a otro'
rtl: 'Derecha a izquierda'
ltr: 'Izquierda a derecha'
dir: 'Dirección del texto'
logger: logger:
rm: 'Eliminado %{path}' rm: 'Eliminado %{path}'
errors: errors: