cambiar la direccion del texto en el momento
This commit is contained in:
parent
ff24960510
commit
67d1327532
2 changed files with 14 additions and 5 deletions
8
app/assets/javascripts/rtl.js
Normal file
8
app/assets/javascripts/rtl.js
Normal 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);
|
||||||
|
});
|
||||||
|
});
|
|
@ -16,6 +16,12 @@
|
||||||
= form_tag url, method: method, class: 'form' do
|
= form_tag url, method: method, class: 'form' do
|
||||||
.form-group
|
.form-group
|
||||||
= submit_tag t('posts.save'), class: 'btn btn-success'
|
= 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
|
.form-group
|
||||||
= text_field 'post', 'title', value: @post.title, class: field_class,
|
= text_field 'post', 'title', value: @post.title, class: field_class,
|
||||||
placeholder: t('posts.title')
|
placeholder: t('posts.title')
|
||||||
|
@ -112,11 +118,6 @@
|
||||||
= 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'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue