Add account bio to account admin view (#11473)

* Add account bio to account admin view

* Change styling to make bio fields / content more readable
remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
ThibG 2019-09-09 14:15:52 +02:00 committed by Eugen Rochko
parent 7b1b968b73
commit ec2a439a22
3 changed files with 73 additions and 2 deletions

View File

@ -716,3 +716,47 @@ a.name-tag,
text-overflow: ellipsis; text-overflow: ellipsis;
vertical-align: middle; vertical-align: middle;
} }
.admin-account-bio {
display: flex;
flex-wrap: wrap;
margin: 0 -5px;
margin-top: 20px;
> div {
box-sizing: border-box;
padding: 0 5px;
margin-bottom: 10px;
flex: 1 0 50%;
}
.account__header__fields,
.account__header__content {
background: lighten($ui-base-color, 8%);
border-radius: 4px;
height: 100%;
}
.account__header__fields {
margin: 0;
border: 0;
a {
color: lighten($ui-highlight-color, 8%);
}
dl:first-child .verified {
border-radius: 0 4px 0 0;
}
.verified a {
color: $valid-value-color;
}
}
.account__header__content {
box-sizing: border-box;
padding: 20px;
color: $primary-text-color;
}
}

View File

@ -84,8 +84,7 @@ class Formatter
end end
def format_field(account, str, **options) def format_field(account, str, **options)
return reformat(str).html_safe unless account.local? # rubocop:disable Rails/OutputSafety html = account.local? ? encode_and_link_urls(str, me: true) : reformat(str)
html = encode_and_link_urls(str, me: true)
html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if options[:custom_emojify] html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if options[:custom_emojify]
html.html_safe # rubocop:disable Rails/OutputSafety html.html_safe # rubocop:disable Rails/OutputSafety
end end

View File

@ -3,6 +3,34 @@
= render 'application/card', account: @account = render 'application/card', account: @account
- account = @account
- proofs = account.identity_proofs.active
- fields = account.fields
- unless fields.empty? && proofs.empty? && account.note.blank?
.admin-account-bio
- unless fields.empty? && proofs.empty?
%div
.account__header__fields
- proofs.each do |proof|
%dl
%dt= proof.provider.capitalize
%dd.verified
= link_to fa_icon('check'), proof.badge.proof_url, class: 'verified__mark', title: t('accounts.link_verified_on', date: l(proof.updated_at))
= link_to proof.provider_username, proof.badge.profile_url
- fields.each do |field|
%dl
%dt.emojify{ title: field.name }= Formatter.instance.format_field(account, field.name, custom_emojify: true)
%dd{ title: field.value, class: custom_field_classes(field) }
- if field.verified?
%span.verified__mark{ title: t('accounts.link_verified_on', date: l(field.verified_at)) }
= fa_icon 'check'
= Formatter.instance.format_field(account, field.value, custom_emojify: true)
- if account.note.present?
%div
.account__header__content.emojify= Formatter.instance.simplified_format(account, custom_emojify: true)
.dashboard__counters{ style: 'margin-top: 10px' } .dashboard__counters{ style: 'margin-top: 10px' }
%div %div
= link_to admin_account_statuses_path(@account.id) do = link_to admin_account_statuses_path(@account.id) do