From 072c86a011770a99f617e44bcd4d3a32efb9e417 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Fri, 18 Feb 2022 23:36:01 +0100 Subject: [PATCH 01/12] Add translation for data page title --- app/views/user/data.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/user/data.haml b/app/views/user/data.haml index 8672ac12..3805ba7c 100644 --- a/app/views/user/data.haml +++ b/app/views/user/data.haml @@ -1,4 +1,4 @@ -= render 'settings/data' += render "settings/data" -- provide(:title, generate_title('Your Data')) -- parent_layout 'user/settings' +- provide(:title, generate_title(t(".title"))) +- parent_layout "user/settings" From 2d63a807611da25cf2a3404db7b23a689633aae9 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Fri, 18 Feb 2022 23:36:24 +0100 Subject: [PATCH 02/12] Add translations for the data view --- app/views/settings/_data.haml | 72 +++++++++++++++++------------------ config/locales/views.en.yml | 29 ++++++++++++++ 2 files changed, 65 insertions(+), 36 deletions(-) diff --git a/app/views/settings/_data.haml b/app/views/settings/_data.haml index 0ede0262..afec6d03 100644 --- a/app/views/settings/_data.haml +++ b/app/views/settings/_data.haml @@ -1,73 +1,73 @@ .card .card-body - %h2 Your Profile Data - %p Everything we have about you! Really, not that much as you might expect. + %h2= t(".heading") + %p= t(".body") - %h3 General + %h3= t(".section.general") .row .col-md-6.col-sm-6.col-xs-12 - %h4 Profile + %h4= t(".section.profile") - %p.font-weight-bold.mb-0 User name + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.screen_name") %p.text-muted= current_user.screen_name - %p.font-weight-bold.mb-0 Display name + %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.display_name") %p.text-muted - if current_user.profile.display_name.blank? None set! - else = current_user.profile.display_name - %p.font-weight-bold.mb-0 Bio + %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.description") %p.text-muted - if current_user.profile.description.blank? None set! - else = current_user.profile.description - %p.font-weight-bold.mb-0 Location + %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.location") %p.text-muted - if current_user.profile.location.blank? None set! - else = current_user.profile.location - %p.font-weight-bold.mb-0 Website + %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.website") %p.text-muted - if current_user.profile.website.blank? None set! - else = current_user.profile.website .col-md-6.col-sm-6.col-xs-12 - %h4 Pictures - %p.font-weight-bold.mb-0 Profile picture + %h4= t(".section.pictures") + %p.font-weight-bold.mb-0= t(".pictures.profile_picture.heading") .media .pull-left %img.profile--img{ src: current_user.profile_picture.url(:medium) } .media-body %ul %li - %a{ href: current_user.profile_picture.url(:small) } Small + %a{ href: current_user.profile_picture.url(:small) }= t(".pictures.profile_picture.size.small") %li - %a{ href: current_user.profile_picture.url(:medium) } Medium + %a{ href: current_user.profile_picture.url(:medium) }= t(".pictures.profile_picture.size.medium") %li - %a{ href: current_user.profile_picture.url(:large) } Large + %a{ href: current_user.profile_picture.url(:large) }= t(".pictures.profile_picture.size.large") %li - %a{ href: current_user.profile_picture.url(:original) } Original image + %a{ href: current_user.profile_picture.url(:original) }= t(".pictures.profile_picture.size.original") - %p.font-weight-bold.mb-0 Header picture + %p.font-weight-bold.mb-0= t(".pictures.profile_header.heading") %img{ src: current_user.profile_header.url(:mobile), style: 'width: 100%' } %p - %a{ href: current_user.profile_header.url(:mobile) } Mobile + %a{ href: current_user.profile_header.url(:mobile) }= t(".pictures.profile_header.size.mobile") | - %a{ href: current_user.profile_header.url(:web) } Web + %a{ href: current_user.profile_header.url(:web) }= t(".pictures.profile_header.size.web") | - %a{ href: current_user.profile_header.url(:retina) } Retina + %a{ href: current_user.profile_header.url(:retina) }= t(".pictures.profile_header.size.retina") | - %a{ href: current_user.profile_header.url(:original) } Original image + %a{ href: current_user.profile_header.url(:original) }= t(".pictures.profile_header.size.original") .row .col-md-6.col-sm-6.col-xs-12 - %h4 Statistics + %h4= t(".section.statistics") %p.font-weight-bold.mb-0 Answers %p.text-muted= current_user.answered_count @@ -87,7 +87,7 @@ %p.font-weight-bold.mb-0 Comments %p.text-muted= current_user.commented_count .col-md-6.col-sm-6.col-xs-12 - %h4 Badges + %h4= t(".section.badges") %p.font-weight-bold.mb-0 Admin %p @@ -108,41 +108,41 @@ %i.fa.fa-fw.fa-close .row .col-md-6.col-sm-6.col-xs-12 - %h3 IP - %p.font-weight-bold.mb-0 Current Sign In + %h3= t(".section.ip") + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.current_sign_in_ip") %p.text-muted= current_user.current_sign_in_ip - %p.font-weight-bold.mb-0 Last Sign In + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.last_sign_in_ip") %p.text-muted= current_user.last_sign_in_ip .col-md-6.col-sm-6.col-xs-12 - %h3 Miscellaneous + %h3= t(".section.miscellaneous") - %p.font-weight-bold.mb-0 Locale + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.locale") %p.text-muted - if current_user.locale.blank? None set! - else = current_user.locale - %p.font-weight-bold.mb-0 Sign In count + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.sign_in_count") %p.text-muted= current_user.sign_in_count - %h3 Dates + %h3= t(".section.dates") .row .col-md-6.col-sm-6.col-xs-12 - %h4 Sign In + %h4= t(".section.sign_in") - %p.font-weight-bold.mb-0 Current Sign In + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.current_sign_in_at") %p.text-muted= current_user.current_sign_in_at ? localize(current_user.current_sign_in_at) : 'Not set' - %p.font-weight-bold.mb-0 Last Sign In + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.last_sign_in_at") %p.text-muted= current_user.last_sign_in_at ? localize(current_user.last_sign_in_at) : 'Not set' - %p.font-weight-bold.mb-0 Remember me set at + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.remember_created_at") %p.text-muted= current_user.remember_created_at ? localize(current_user.remember_created_at) : 'Not set' .col-md-6.col-sm-6.col-xs-12 - %h4 Create/Update + %h4= t(".section.create_update") - %p.font-weight-bold.mb-0 Account created + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.created_at") %p.text-muted - if current_user.created_at = localize(current_user.created_at) @@ -150,7 +150,7 @@ - else Not set - %p.font-weight-bold.mb-0 Account last updated + %p.font-weight-bold.mb-0= t("activerecord.attributes.user.updated at") %p.text-muted - if current_user.created_at = localize(current_user.updated_at) diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index ec5d32bb..5fb54440 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -43,6 +43,33 @@ en: delete: action: "Delete my account" heading: "Unsatisfied?" + data: + heading: "Your Profile Data" + body: "Everything we have about you! Really, not that much as you might expect." + section: + general: "General" + profile: "Profile" + pictures: "Pictures" + ip: "IP" + miscellaneous: "Miscellaneous" + dates: "Dates" + sign_in: "Sign In" + create_update: "Create/Update" + pictures: + profile_picture: + heading: "Profile picture" + size: + small: "Small" + medium: "Medium" + large: "Large" + original: "Original image" + profile_header: + heading: "Profile header" + size: + mobile: "Mobile" + web: "Web" + retina: "Retina" + original: "Original image" export: heading: "Export your data" body_html: | @@ -147,6 +174,8 @@ en: accent: example: "Some text on top of a accented area on a raised element!" user: + data: + title: "Your Data" edit: title: "Profile Settings" edit_mute: From b965cf54c4a506e406519c80039792c88d9dbd95 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Fri, 18 Feb 2022 23:36:59 +0100 Subject: [PATCH 03/12] Translate more user attributes --- config/locales/activerecord.en.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index e5468101..c20de781 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -42,15 +42,24 @@ en: warning_color: "Warning color" warning_text: "Warning text color" user: + created_at: "Account created at" current_password: "Current password" + current_sign_in_at: "Current sign in at" + current_sign_in_ip: "Current sign in IP" email: "Email" + last_sign_in_at: "Last sign in at" + last_sign_in_ip: "Last sign in IP" + locale: "Language" login: "Username or Email" + remember_created_at: "Remember me set at" password: "Password" password_confirmation: "Confirm your password" profile_picture: "Profile picture" profile_header: "Profile header" + sign_in_count: "Sign in count" screen_name: "Username" show_foreign_themes: "Render other user themes when visiting their profile" + updated_at: "Account updated at" help: user: email: "Don't forget to check your spam folder in case our mail might have landed there!" From 3af55329df9307d73fe0ec80a88eb8083e9b42d4 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Fri, 18 Feb 2022 23:38:34 +0100 Subject: [PATCH 04/12] Remove statistics/badges section from data view --- app/views/settings/_data.haml | 41 ----------------------------------- 1 file changed, 41 deletions(-) diff --git a/app/views/settings/_data.haml b/app/views/settings/_data.haml index afec6d03..ed87f19b 100644 --- a/app/views/settings/_data.haml +++ b/app/views/settings/_data.haml @@ -65,47 +65,6 @@ %a{ href: current_user.profile_header.url(:retina) }= t(".pictures.profile_header.size.retina") | %a{ href: current_user.profile_header.url(:original) }= t(".pictures.profile_header.size.original") - .row - .col-md-6.col-sm-6.col-xs-12 - %h4= t(".section.statistics") - - %p.font-weight-bold.mb-0 Answers - %p.text-muted= current_user.answered_count - - %p.font-weight-bold.mb-0 Questions - %p.text-muted= current_user.asked_count - - %p.font-weight-bold.mb-0 Following - %p.text-muted= current_user.followings.count - - %p.font-weight-bold.mb-0 Followers - %p.text-muted= current_user.followers.count - - %p.font-weight-bold.mb-0 Smiles - %p.text-muted= current_user.smiled_count + current_user.comment_smiled_count - - %p.font-weight-bold.mb-0 Comments - %p.text-muted= current_user.commented_count - .col-md-6.col-sm-6.col-xs-12 - %h4= t(".section.badges") - - %p.font-weight-bold.mb-0 Admin - %p - - if current_user.has_role? :administrator - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.font-weight-bold.mb-0 Moderator - %p - - if current_user.mod? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close .row .col-md-6.col-sm-6.col-xs-12 %h3= t(".section.ip") From a182f059965556e36d665c8ef154f2674d574237 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 19 Feb 2022 00:31:38 +0100 Subject: [PATCH 05/12] Increase spacing of sections on the data view --- app/views/settings/_data.haml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/settings/_data.haml b/app/views/settings/_data.haml index ed87f19b..5022ea68 100644 --- a/app/views/settings/_data.haml +++ b/app/views/settings/_data.haml @@ -5,7 +5,7 @@ %h3= t(".section.general") .row - .col-md-6.col-sm-6.col-xs-12 + .col-md-6.col-sm-6.col-xs-12.mb-3 %h4= t(".section.profile") %p.font-weight-bold.mb-0= t("activerecord.attributes.user.screen_name") @@ -38,10 +38,10 @@ None set! - else = current_user.profile.website - .col-md-6.col-sm-6.col-xs-12 + .col-md-6.col-sm-6.col-xs-12.mb-3 %h4= t(".section.pictures") %p.font-weight-bold.mb-0= t(".pictures.profile_picture.heading") - .media + .media.mb-3 .pull-left %img.profile--img{ src: current_user.profile_picture.url(:medium) } .media-body @@ -66,14 +66,14 @@ | %a{ href: current_user.profile_header.url(:original) }= t(".pictures.profile_header.size.original") .row - .col-md-6.col-sm-6.col-xs-12 + .col-md-6.col-sm-6.col-xs-12.mb-3 %h3= t(".section.ip") %p.font-weight-bold.mb-0= t("activerecord.attributes.user.current_sign_in_ip") %p.text-muted= current_user.current_sign_in_ip %p.font-weight-bold.mb-0= t("activerecord.attributes.user.last_sign_in_ip") %p.text-muted= current_user.last_sign_in_ip - .col-md-6.col-sm-6.col-xs-12 + .col-md-6.col-sm-6.col-xs-12.mb-3 %h3= t(".section.miscellaneous") %p.font-weight-bold.mb-0= t("activerecord.attributes.user.locale") From ebaa7bfa87c9c4045baf9252244cc0ef6e07e854 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 19 Feb 2022 00:36:20 +0100 Subject: [PATCH 06/12] Add translation for none-placeholder --- app/views/settings/_data.haml | 14 +++++++------- config/locales/views.en.yml | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/views/settings/_data.haml b/app/views/settings/_data.haml index 5022ea68..43baa7a0 100644 --- a/app/views/settings/_data.haml +++ b/app/views/settings/_data.haml @@ -14,28 +14,28 @@ %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.display_name") %p.text-muted - if current_user.profile.display_name.blank? - None set! + = t(".none") - else = current_user.profile.display_name %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.description") %p.text-muted - if current_user.profile.description.blank? - None set! + = t(".none") - else = current_user.profile.description %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.location") %p.text-muted - if current_user.profile.location.blank? - None set! + = t(".none") - else = current_user.profile.location %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.website") %p.text-muted - if current_user.profile.website.blank? - None set! + = t(".none") - else = current_user.profile.website .col-md-6.col-sm-6.col-xs-12.mb-3 @@ -79,7 +79,7 @@ %p.font-weight-bold.mb-0= t("activerecord.attributes.user.locale") %p.text-muted - if current_user.locale.blank? - None set! + = t(".none") - else = current_user.locale @@ -107,7 +107,7 @@ = localize(current_user.created_at) = " (#{time_ago_in_words(current_user.created_at)} ago)" - else - Not set + = t(".none") %p.font-weight-bold.mb-0= t("activerecord.attributes.user.updated at") %p.text-muted @@ -115,4 +115,4 @@ = localize(current_user.updated_at) = " (#{time_ago_in_words(current_user.updated_at)} ago)" - else - Not set + = t(".none") diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 5fb54440..91b6d33b 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -46,6 +46,7 @@ en: data: heading: "Your Profile Data" body: "Everything we have about you! Really, not that much as you might expect." + none: "None set!" section: general: "General" profile: "Profile" From edf3d3db1598e3de330724d79c7b898b5b2aad13 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 19 Feb 2022 00:40:49 +0100 Subject: [PATCH 07/12] Add translation for "time ago" wording --- app/views/settings/_data.haml | 4 ++-- config/locales/voc.en.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/settings/_data.haml b/app/views/settings/_data.haml index 43baa7a0..1cea4a7a 100644 --- a/app/views/settings/_data.haml +++ b/app/views/settings/_data.haml @@ -105,7 +105,7 @@ %p.text-muted - if current_user.created_at = localize(current_user.created_at) - = " (#{time_ago_in_words(current_user.created_at)} ago)" + = " (#{t("time.distance_ago", time: time_ago_in_words(current_user.created_at))})" - else = t(".none") @@ -113,6 +113,6 @@ %p.text-muted - if current_user.created_at = localize(current_user.updated_at) - = " (#{time_ago_in_words(current_user.updated_at)} ago)" + = " (#{t("time.distance_ago", time: time_ago_in_words(current_user.updated_at))})" - else = t(".none") diff --git a/config/locales/voc.en.yml b/config/locales/voc.en.yml index 71a118ac..b01067be 100644 --- a/config/locales/voc.en.yml +++ b/config/locales/voc.en.yml @@ -12,3 +12,5 @@ en: update: "Update" messages: noauth: "You must be signed in to do this." + time: + distance_ago: "%{time} ago" From e26d981105d69cd2b56f84c72542af41e53c3b60 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 19 Feb 2022 00:48:14 +0100 Subject: [PATCH 08/12] Fix haml-lint nits --- app/views/settings/_data.haml | 38 +++++++++++------------------------ 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/app/views/settings/_data.haml b/app/views/settings/_data.haml index 1cea4a7a..c81b5ff1 100644 --- a/app/views/settings/_data.haml +++ b/app/views/settings/_data.haml @@ -13,31 +13,20 @@ %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.display_name") %p.text-muted - - if current_user.profile.display_name.blank? - = t(".none") - - else - = current_user.profile.display_name + = current_user.profile.display_name.presence || t(".none") %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.description") %p.text-muted - - if current_user.profile.description.blank? - = t(".none") - - else - = current_user.profile.description + = current_user.profile.description.presence || t(".none") %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.location") %p.text-muted - - if current_user.profile.location.blank? - = t(".none") - - else - = current_user.profile.location + = current_user.profile.location.presence || t(".none") %p.font-weight-bold.mb-0= t("activerecord.attributes.profile.website") %p.text-muted - - if current_user.profile.website.blank? - = t(".none") - - else - = current_user.profile.website + = current_user.profile.website.presence || t(".none") + .col-md-6.col-sm-6.col-xs-12.mb-3 %h4= t(".section.pictures") %p.font-weight-bold.mb-0= t(".pictures.profile_picture.heading") @@ -56,7 +45,7 @@ %a{ href: current_user.profile_picture.url(:original) }= t(".pictures.profile_picture.size.original") %p.font-weight-bold.mb-0= t(".pictures.profile_header.heading") - %img{ src: current_user.profile_header.url(:mobile), style: 'width: 100%' } + %img{ src: current_user.profile_header.url(:mobile), style: "width: 100%" } %p %a{ href: current_user.profile_header.url(:mobile) }= t(".pictures.profile_header.size.mobile") | @@ -78,10 +67,7 @@ %p.font-weight-bold.mb-0= t("activerecord.attributes.user.locale") %p.text-muted - - if current_user.locale.blank? - = t(".none") - - else - = current_user.locale + = current_user.locale.presence || t(".none") %p.font-weight-bold.mb-0= t("activerecord.attributes.user.sign_in_count") %p.text-muted= current_user.sign_in_count @@ -91,13 +77,13 @@ %h4= t(".section.sign_in") %p.font-weight-bold.mb-0= t("activerecord.attributes.user.current_sign_in_at") - %p.text-muted= current_user.current_sign_in_at ? localize(current_user.current_sign_in_at) : 'Not set' + %p.text-muted= current_user.current_sign_in_at ? localize(current_user.current_sign_in_at) : t(".none") %p.font-weight-bold.mb-0= t("activerecord.attributes.user.last_sign_in_at") - %p.text-muted= current_user.last_sign_in_at ? localize(current_user.last_sign_in_at) : 'Not set' + %p.text-muted= current_user.last_sign_in_at ? localize(current_user.last_sign_in_at) : t(".none") %p.font-weight-bold.mb-0= t("activerecord.attributes.user.remember_created_at") - %p.text-muted= current_user.remember_created_at ? localize(current_user.remember_created_at) : 'Not set' + %p.text-muted= current_user.remember_created_at ? localize(current_user.remember_created_at) : t(".none") .col-md-6.col-sm-6.col-xs-12 %h4= t(".section.create_update") @@ -105,7 +91,7 @@ %p.text-muted - if current_user.created_at = localize(current_user.created_at) - = " (#{t("time.distance_ago", time: time_ago_in_words(current_user.created_at))})" + = " (#{t('time.distance_ago', time: time_ago_in_words(current_user.created_at))})" - else = t(".none") @@ -113,6 +99,6 @@ %p.text-muted - if current_user.created_at = localize(current_user.updated_at) - = " (#{t("time.distance_ago", time: time_ago_in_words(current_user.updated_at))})" + = " (#{t('time.distance_ago', time: time_ago_in_words(current_user.updated_at))})" - else = t(".none") From e424d5ed3844b59eb139b5fdfee1201bf0880a14 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 19 Feb 2022 17:43:57 +0100 Subject: [PATCH 09/12] Add translations for privacy settings title --- app/views/user/edit_privacy.haml | 6 +++--- config/locales/views.en.yml | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/user/edit_privacy.haml b/app/views/user/edit_privacy.haml index d806ff57..a9240a78 100644 --- a/app/views/user/edit_privacy.haml +++ b/app/views/user/edit_privacy.haml @@ -1,4 +1,4 @@ -= render 'settings/privacy' += render "settings/privacy" -- provide(:title, generate_title('Privacy Settings')) -- parent_layout 'user/settings' +- provide(:title, generate_title(t(".title"))) +- parent_layout "user/settings" diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 91b6d33b..d5e99b7b 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -181,6 +181,8 @@ en: title: "Profile Settings" edit_mute: title: "Muted Words" + edit_privacy: + title: "Privacy Settings" edit_security: title: "Security Settings" edit_theme: From 2fc4b8f4a48df84870d02584ca67525cb0c04242 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 19 Feb 2022 17:45:11 +0100 Subject: [PATCH 10/12] Add translations for privacy setting attributes --- app/views/settings/_privacy.haml | 11 +++++------ config/locales/activerecord.en.yml | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/views/settings/_privacy.haml b/app/views/settings/_privacy.haml index 7e660c66..1c3bb36b 100644 --- a/app/views/settings/_privacy.haml +++ b/app/views/settings/_privacy.haml @@ -1,9 +1,8 @@ .card .card-body - = bootstrap_form_for(current_user, url: { action: 'edit_privacy' }, method: :patch) do |f| + = bootstrap_form_for(current_user, url: { action: "edit_privacy" }, method: :patch) do |f| + = f.check_box :privacy_allow_anonymous_questions + = f.check_box :privacy_allow_public_timeline + = f.check_box :privacy_allow_stranger_answers - = f.check_box :privacy_allow_anonymous_questions, label: t('views.settings.privacy.anonymous') - = f.check_box :privacy_allow_public_timeline, label: t('views.settings.privacy.public') - = f.check_box :privacy_allow_stranger_answers, label: t('views.settings.privacy.stranger') - - = f.submit t('views.actions.save'), class: 'btn btn-primary' + = f.primary diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index c20de781..b159238c 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -54,6 +54,9 @@ en: remember_created_at: "Remember me set at" password: "Password" password_confirmation: "Confirm your password" + privacy_allow_anonymous_questions: "Allow anonymous questions" + privacy_allow_public_timeline: "Show your answers in the public timeline" + privacy_allow_stranger_answers: "Allow other people to answer your questions" profile_picture: "Profile picture" profile_header: "Profile header" sign_in_count: "Sign in count" From 6541442098c9ce51e2498c050578828a1cd08c9d Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 19 Feb 2022 17:45:34 +0100 Subject: [PATCH 11/12] Add translations for privacy settings flashes --- app/controllers/user_controller.rb | 4 ++-- config/locales/controllers.en.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index b1d02bca..c02e75b4 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -63,9 +63,9 @@ class UserController < ApplicationController :privacy_allow_stranger_answers, :privacy_show_in_search) if current_user.update(user_attributes) - flash[:success] = t('flash.user.update_privacy.success') + flash[:success] = t(".success") else - flash[:error] = t('flash.user.update_privacy.error') + flash[:error] = t(".error") end redirect_to edit_user_privacy_path end diff --git a/config/locales/controllers.en.yml b/config/locales/controllers.en.yml index bfc9cdf0..efed0466 100644 --- a/config/locales/controllers.en.yml +++ b/config/locales/controllers.en.yml @@ -51,6 +51,9 @@ en: error: :errors.invalid_otp destroy_2fa: success: "Two factor authentication has been disabled for your account." + update_privacy: + success: :user.update.success + error: :user.update.error update_profile: success: :user.update.success error: :user.update.error From 60b40a444c959773f7d141c325dadd857536527c Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 19 Feb 2022 17:46:26 +0100 Subject: [PATCH 12/12] Remove legacy privacy settings locales --- config/locales/en.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 7c09b2b9..ac52f45e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -51,10 +51,6 @@ en: error: "I'm sorry, %{name}, I'm afraid I can't do that." reason: "Ban reason: %{reason}" until: "Banned until: %{time}" - user: - update_privacy: - success: "Your privacy settings have been updated!" - error: "An error occurred. ;_;" messages: noscript: "Please activate JavaScript." error: "An error occurred." @@ -367,10 +363,6 @@ en: privacy: "Privacy" sharing: "Sharing" security: "Security" - privacy: - anonymous: "Allow anonymous questions" - public: "Show your answers in the public timeline" - stranger: "Allow other people to answer your questions" modal: ask: title: "Ask your followers"