From 5cc0f94f80fa399623206ef31cb8f296abeaf47c Mon Sep 17 00:00:00 2001 From: f Date: Sat, 23 May 2020 16:34:45 -0300 Subject: [PATCH] =?UTF-8?q?traducciones:=20ver=20valores=20en=20su=20idiom?= =?UTF-8?q?a=20y=20direcci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/_form.haml | 3 +++ app/views/posts/attributes/_array.haml | 2 +- app/views/posts/attributes/_content.haml | 3 ++- app/views/posts/attributes/_file.haml | 1 + app/views/posts/attributes/_image.haml | 1 + app/views/posts/attributes/_locales.haml | 4 +++- app/views/posts/attributes/_markdown_content.haml | 7 +++++++ app/views/posts/attributes/_predefined_array.haml | 1 + app/views/posts/attributes/_related_posts.haml | 4 +++- app/views/posts/attributes/_slug.haml | 1 + app/views/posts/attributes/_string.haml | 1 + app/views/posts/attributes/_text.haml | 1 + app/views/posts/show.haml | 1 + yarn.lock | 4 ++-- 14 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 app/views/posts/attributes/_markdown_content.haml diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index 27d1953..da34a8d 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 04be74a..b96d32a 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 f5c60f2..e070707 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 cf2d67b..3da9a4e 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 aaff171..2accd10 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 b7cc886..e672f6c 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 0000000..55df0e2 --- /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 5926ad7..1ece3a5 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 5926ad7..13439fa 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 831ac63..8cbd92c 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 831ac63..8cbd92c 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 9633d22..f356bf8 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 80b12ee..d089251 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 e0efd90..db6ceae 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"