cambiar la direccion del texto en el momento

This commit is contained in:
f 2018-02-10 13:30:06 -03:00
parent ff24960510
commit 67d1327532
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
2 changed files with 14 additions and 5 deletions

View file

@ -0,0 +1,8 @@
$(document).on('turbolinks:load', function() {
$('#post_dir').change(function(e) {
var dir = $(this).val();
var rid = (dir == 'rtl') ? 'ltr' : 'rtl';
$('.'+rid).removeClass(rid).addClass(dir);
});
});

View file

@ -16,6 +16,12 @@
= form_tag url, method: method, class: 'form' do
.form-group
= submit_tag t('posts.save'), class: 'btn btn-success'
.form-group
= label_tag 'post_dir', t('posts.dir')
= select_tag 'post[dir]',
options_for_select([[t('posts.ltr'), 'ltr'], [t('posts.rtl'), 'rtl']],
@post.get_front_matter(:dir)),
{ class: 'form-control' }
.form-group
= text_field 'post', 'title', value: @post.title, class: field_class,
placeholder: t('posts.title')
@ -112,11 +118,6 @@
= 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')
.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
= submit_tag t('posts.save'), class: 'btn btn-success'