Merge branch 'main' into refactor/settings-tabs-locales

This commit is contained in:
Andreas Nedbal 2022-02-20 21:36:31 +01:00 committed by GitHub
commit 56af98294a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 115 additions and 130 deletions

View File

@ -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

View File

@ -1,159 +1,104 @@
.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
.col-md-6.col-sm-6.col-xs-12.mb-3
%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
= current_user.profile.display_name.presence || t(".none")
%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
= current_user.profile.description.presence || t(".none")
%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
= current_user.profile.location.presence || t(".none")
%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
.media
= 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")
.media.mb-3
.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
%img{ src: current_user.profile_header.url(:mobile), style: 'width: 100%' }
%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
%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 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 IP
%p.font-weight-bold.mb-0 Current Sign In
.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 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
.col-md-6.col-sm-6.col-xs-12.mb-3
%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
= current_user.locale.presence || t(".none")
%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.text-muted= current_user.current_sign_in_at ? localize(current_user.current_sign_in_at) : 'Not set'
%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) : t(".none")
%p.font-weight-bold.mb-0 Last Sign In
%p.text-muted= current_user.last_sign_in_at ? localize(current_user.last_sign_in_at) : 'Not set'
%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) : t(".none")
%p.font-weight-bold.mb-0 Remember me set at
%p.text-muted= current_user.remember_created_at ? localize(current_user.remember_created_at) : 'Not set'
%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) : t(".none")
.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)
= " (#{time_ago_in_words(current_user.created_at)} ago)"
= " (#{t('time.distance_ago', time: time_ago_in_words(current_user.created_at))})"
- else
Not set
= t(".none")
%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)
= " (#{time_ago_in_words(current_user.updated_at)} ago)"
= " (#{t('time.distance_ago', time: time_ago_in_words(current_user.updated_at))})"
- else
Not set
= t(".none")

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -42,15 +42,27 @@ 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"
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"
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!"

View File

@ -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

View File

@ -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."
@ -360,10 +356,6 @@ en:
create: "Create an account"
another: "Ask another question"
join: "Join %{app_title} today! You'll be able to follow and ask people you know and a lot more."
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"

View File

@ -43,6 +43,34 @@ 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."
none: "None set!"
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: |
@ -158,10 +186,14 @@ en:
data: "Your Data"
export: "Export"
user:
data:
title: "Your Data"
edit:
title: "Profile Settings"
edit_mute:
title: "Muted Words"
edit_privacy:
title: "Privacy Settings"
edit_security:
title: "Security Settings"
edit_theme:

View File

@ -12,3 +12,5 @@ en:
update: "Update"
messages:
noauth: "You must be signed in to do this."
time:
distance_ago: "%{time} ago"