diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index 27d1953d..da34a8dc 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -13,6 +13,8 @@ method = :patch end +- dir = t("locales.#{@locale}.dir") + -# Comienza el formulario = form_tag url, method: method, class: 'form post', multipart: true do @@ -29,6 +31,7 @@ = render("posts/attributes/#{type}", post: post, attribute: attribute, metadata: metadata, site: site, + dir: dir, locale: @locale, autofocus: (post.attributes.first == attribute)) -# Botones de guardado diff --git a/app/views/posts/attributes/_array.haml b/app/views/posts/attributes/_array.haml index 04be74a6..b96d32a1 100644 --- a/app/views/posts/attributes/_array.haml +++ b/app/views/posts/attributes/_array.haml @@ -1,7 +1,7 @@ .form-group = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - .taggable{ data: { values: metadata.value.join(','), + .taggable{ dir: dir, lang: locale, data: { values: metadata.value.to_json, name: "post[#{attribute}][]", list: id_for_datalist(attribute), remove: 'false', legend: post_label_t(attribute, post: post), button: t('posts.attributes.add'), diff --git a/app/views/posts/attributes/_content.haml b/app/views/posts/attributes/_content.haml index f5c60f29..e0707070 100644 --- a/app/views/posts/attributes/_content.haml +++ b/app/views/posts/attributes/_content.haml @@ -3,4 +3,5 @@ = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata = rich_text_area_tag "post[#{attribute}]", metadata.value, - **field_options(attribute, metadata), class: '' + **field_options(attribute, metadata), class: '', dir: dir, + lang: locale diff --git a/app/views/posts/attributes/_file.haml b/app/views/posts/attributes/_file.haml index cf2d67b4..3da9a4e4 100644 --- a/app/views/posts/attributes/_file.haml +++ b/app/views/posts/attributes/_file.haml @@ -17,6 +17,7 @@ post_label_t(attribute, :description, post: post) = text_field(*field_name_for('post', attribute, :description), value: metadata.value['description'], + dir: dir, lang: locale, **field_options(attribute, metadata)) = render 'posts/attribute_feedback', post: post, attribute: [attribute, :description], metadata: metadata diff --git a/app/views/posts/attributes/_image.haml b/app/views/posts/attributes/_image.haml index aaff171a..2accd101 100644 --- a/app/views/posts/attributes/_image.haml +++ b/app/views/posts/attributes/_image.haml @@ -25,6 +25,7 @@ post_label_t(attribute, :description, post: post) = text_field(*field_name_for('post', attribute, :description), value: metadata.value['description'], + dir: dir, lang: locale, **field_options(attribute, metadata)) = render 'posts/attribute_feedback', post: post, attribute: [attribute, :description], metadata: metadata diff --git a/app/views/posts/attributes/_locales.haml b/app/views/posts/attributes/_locales.haml index b7cc8864..e672f6cd 100644 --- a/app/views/posts/attributes/_locales.haml +++ b/app/views/posts/attributes/_locales.haml @@ -15,7 +15,8 @@ .form-group = label_tag "post_#{attribute}_#{locale}", locale_t - .mapable{ data: { values: values.to_json, + .mapable{ dir: t("locales.#{locale}.dir"), lang: locale, + data: { values: values.to_json, 'default-values': metadata.values[locale.to_sym].to_json, name: "post[#{attribute}][]", list: id_for_datalist(attribute, locale), @@ -25,6 +26,7 @@ = text_field(*field_name_for('post', attribute, '[]'), value: values.join(', '), + dir: t("locales.#{locale}.dir"), lang: locale, **field_options(attribute, metadata)) = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_markdown_content.haml b/app/views/posts/attributes/_markdown_content.haml new file mode 100644 index 00000000..55df0e22 --- /dev/null +++ b/app/views/posts/attributes/_markdown_content.haml @@ -0,0 +1,7 @@ +.form-group + = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = render 'posts/attribute_feedback', + post: post, attribute: attribute, metadata: metadata + = text_area_tag "post[#{attribute}]", metadata.value, + dir: dir, lang: locale, + **field_options(attribute, metadata), class: 'form-control' diff --git a/app/views/posts/attributes/_predefined_array.haml b/app/views/posts/attributes/_predefined_array.haml index 5926ad75..1ece3a56 100644 --- a/app/views/posts/attributes/_predefined_array.haml +++ b/app/views/posts/attributes/_predefined_array.haml @@ -10,6 +10,7 @@ = text_field(*field_name_for('post', attribute, '[]'), value: metadata.value.join(', '), + dir: dir, lang: locale, **field_options(attribute, metadata)) = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_related_posts.haml b/app/views/posts/attributes/_related_posts.haml index 5926ad75..13439fa4 100644 --- a/app/views/posts/attributes/_related_posts.haml +++ b/app/views/posts/attributes/_related_posts.haml @@ -1,7 +1,8 @@ .form-group = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - .mapable{ data: { values: metadata.value.to_json, + .mapable{ dir: dir, lang: locale, + data: { values: metadata.value.to_json, 'default-values': metadata.values.to_json, name: "post[#{attribute}][]", list: id_for_datalist(attribute), remove: 'false', legend: post_label_t(attribute, post: post), @@ -10,6 +11,7 @@ = text_field(*field_name_for('post', attribute, '[]'), value: metadata.value.join(', '), + dir: dir, lang: locale, **field_options(attribute, metadata)) = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_slug.haml b/app/views/posts/attributes/_slug.haml index 831ac63f..8cbd92cc 100644 --- a/app/views/posts/attributes/_slug.haml +++ b/app/views/posts/attributes/_slug.haml @@ -1,6 +1,7 @@ .form-group = label_tag "post_#{attribute}", post_label_t(attribute, post: post) = text_field 'post', attribute, value: metadata.value, + dir: dir, lang: locale, **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/attributes/_string.haml b/app/views/posts/attributes/_string.haml index 831ac63f..8cbd92cc 100644 --- a/app/views/posts/attributes/_string.haml +++ b/app/views/posts/attributes/_string.haml @@ -1,6 +1,7 @@ .form-group = label_tag "post_#{attribute}", post_label_t(attribute, post: post) = text_field 'post', attribute, value: metadata.value, + dir: dir, lang: locale, **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/attributes/_text.haml b/app/views/posts/attributes/_text.haml index 9633d223..f356bf8f 100644 --- a/app/views/posts/attributes/_text.haml +++ b/app/views/posts/attributes/_text.haml @@ -1,6 +1,7 @@ .form-group = label_tag "post_#{attribute}", post_label_t(attribute, post: post) = text_area_tag "post[#{attribute}]", metadata.value, + dir: dir, lang: locale, **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 80b12ee0..d0892515 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -29,6 +29,7 @@ metadata: metadata, site: @site, tags: all_html_tags, + locale: @locale, dir: dir) -# Mostrar todo lo que no va en el front_matter (el contenido) diff --git a/yarn.lock b/yarn.lock index e0efd90b..db6ceae5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3413,8 +3413,8 @@ ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: resolved "https://0xacab.org/sutty/input-map.git#e2a356c63e4e956f74dc26527bacb2c7c82c8773" "input-tag@https://0xacab.org/sutty/input-tag.git": - version "0.0.6" - resolved "https://0xacab.org/sutty/input-tag.git#5bfcbcb83abd941caadab09f80cc684909f12a37" + version "0.0.7" + resolved "https://0xacab.org/sutty/input-tag.git#7e76b7646c4a3dbccae8b840dde43daa5c71e99d" internal-ip@^4.3.0: version "4.3.0"