From eccb51eab007bf01e51cf2dc070be1e31adea0cc Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Tue, 10 Jan 2023 15:48:56 +0100 Subject: [PATCH] Add formatting help markup/translations --- app/views/layouts/base.html.haml | 1 + app/views/shared/_format_link.html.haml | 3 +++ app/views/shared/_formatting.html.haml | 4 ++++ config/locales/views.en.yml | 7 +++++++ config/locales/voc.en.yml | 1 + 5 files changed, 16 insertions(+) create mode 100644 app/views/shared/_format_link.html.haml create mode 100644 app/views/shared/_formatting.html.haml diff --git a/app/views/layouts/base.html.haml b/app/views/layouts/base.html.haml index 6791f897..8b05a3b8 100644 --- a/app/views/layouts/base.html.haml +++ b/app/views/layouts/base.html.haml @@ -30,6 +30,7 @@ = render 'navigation/guest' = render 'shared/announcements' = yield + = render "shared/formatting" - if Rails.env.development? #debug %hr diff --git a/app/views/shared/_format_link.html.haml b/app/views/shared/_format_link.html.haml new file mode 100644 index 00000000..023cbfe5 --- /dev/null +++ b/app/views/shared/_format_link.html.haml @@ -0,0 +1,3 @@ +%a.text-muted.text-decoration-none.fs-7{ href: "#", data: { controller: "format-popup" }, tabindex: "0" } + %i.fab.fa-markdown + = t("voc.format_markdown") diff --git a/app/views/shared/_formatting.html.haml b/app/views/shared/_formatting.html.haml new file mode 100644 index 00000000..d185fc17 --- /dev/null +++ b/app/views/shared/_formatting.html.haml @@ -0,0 +1,4 @@ +#formatting-options.d-none{ aria: { hidden: true } } + = t(".body_html", app_name: APP_CONFIG["site_name"]) + + diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index efe4373a..72e526a3 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -550,6 +550,13 @@ en: unsubscribe_all: "Disable on all devices" description: "Here you can set up or disable push notifications for new questions in your inbox." shared: + formatting: + body_html: | +

%{app_name} uses Markdown for formatting

+

Add two new lines for a new paragraph to start

+

*italic text* for italic text

+

**bold text** for bold text

+

[link](https://example.com) for link

links: about: "About" source: "Source code" diff --git a/config/locales/voc.en.yml b/config/locales/voc.en.yml index 232d5500..7f674a7e 100644 --- a/config/locales/voc.en.yml +++ b/config/locales/voc.en.yml @@ -10,6 +10,7 @@ en: delete: "Delete" edit: "Edit" follow: "Follow" + format_markdown: "Styling with Markdown is supported" load: "Load more" login: "Sign in" logout: "Sign out"