From cbd7ab7179afdaf6d3aed35b95723d48def4967d Mon Sep 17 00:00:00 2001 From: taitus Date: Fri, 25 Jan 2019 16:12:59 +0100 Subject: [PATCH] Add remote translation button - Create partial to render remote translation button. This button will send remote_translations as json to remote translations controller. - Add locales - Add styles Co-Authored-By: alessandro --- app/assets/stylesheets/layout.scss | 20 +++++++++++++++++++ .../_remote_translations_button.html.erb | 11 ++++++++++ config/locales/en/general.yml | 2 ++ config/locales/es/general.yml | 2 ++ 4 files changed, 35 insertions(+) create mode 100644 app/views/shared/_remote_translations_button.html.erb diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 8e7334935..24b97f9e1 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -474,6 +474,26 @@ header { } } + .remote-translations-button { + + .callout { + margin: 0; + padding: rem-calc(6); + + [type="submit"] { + background: none; + border: 0; + cursor: pointer; + font-weight: bold; + color: $brand; + + &:hover { + text-decoration: underline; + } + } + } + } + .external-links { float: none; padding: rem-calc(6) 0; diff --git a/app/views/shared/_remote_translations_button.html.erb b/app/views/shared/_remote_translations_button.html.erb new file mode 100644 index 000000000..83f805fce --- /dev/null +++ b/app/views/shared/_remote_translations_button.html.erb @@ -0,0 +1,11 @@ +
+ <% if display_remote_translation_button?(remote_translations) %> + <%= form_tag remote_translations_path do %> + <%= hidden_field_tag :remote_translations, remote_translations.to_json %> + <%= t("remote_translations.text") %> + <%= submit_tag t("remote_translations.button") %> + <% end %> + <% else %> + <%= t("remote_translations.all_remote_translations_enqueued_text") %> + <% end %> +
diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 650849ca3..472fd60f8 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -1034,5 +1034,7 @@ en: borda: Borda votation dowdall: Dowdall votation remote_translations: + text: The content of this page is not available in your language create: enqueue_remote_translation: Translations have been correctly requested. + button: Translate page diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 435ce7a10..f2776a5c9 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -1031,5 +1031,7 @@ es: borda: Votación con recuento Borda dowdall: Votación con recuento Dowdall remote_translations: + text: El contenido de esta página no está disponible en tu idioma create: enqueue_remote_translation: Se han solicitado correctamente las traducciones. + button: Traducir página