From 91fb82a4ddfc13fb916d1b539f6a8fcb164166f5 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 29 Apr 2018 16:30:05 +0200 Subject: [PATCH 1/2] Fix style of account fields form --- app/javascript/flavours/glitch/styles/forms.scss | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/javascript/flavours/glitch/styles/forms.scss b/app/javascript/flavours/glitch/styles/forms.scss index 2bef53cff..0a43f14b7 100644 --- a/app/javascript/flavours/glitch/styles/forms.scss +++ b/app/javascript/flavours/glitch/styles/forms.scss @@ -15,6 +15,18 @@ code { overflow: hidden; } + .row { + display: flex; + margin: 0 -5px; + + .input { + box-sizing: border-box; + flex: 1 1 auto; + width: 50%; + padding: 0 5px; + } + } + span.hint { display: block; color: $ui-primary-color; From 356d0214c93da79f0583a62a6ca748828d721326 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 29 Apr 2018 16:24:15 +0200 Subject: [PATCH 2/2] Implement tootsuite-style account fields glitch-soc-style still in backup, both sharing the same SCSS style --- .../features/account/components/header.js | 52 ++++++++++++------- .../flavours/glitch/reducers/accounts.js | 8 +++ .../glitch/styles/components/metadata.scss | 5 +- .../flavours/glitch/styles/metadata.scss | 2 +- app/views/accounts/_header.html.haml | 15 +++--- 5 files changed, 52 insertions(+), 30 deletions(-) diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index a208f1a8e..7a0a2dfa9 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -37,6 +37,7 @@ export default class Header extends ImmutablePureComponent { } let displayName = account.get('display_name_html'); + let fields = account.get('fields'); let info = ''; let mutingInfo = ''; let actionBtn = ''; @@ -100,30 +101,43 @@ export default class Header extends ImmutablePureComponent { @{account.get('acct')} {account.get('locked') ? : null}
+ {fields.size > 0 && ( + + + {fields.map((pair, i) => ( + + + ))} + +
+ +
+ )} + + {fields.size == 0 && metadata.length && ( + + + {(() => { + let data = []; + for (let i = 0; i < metadata.length; i++) { + data.push( + + + + + ); + } + return data; + })()} + +
+ ) || null} + {info} {mutingInfo} {actionBtn}
- - {metadata.length && ( - - - {(() => { - let data = []; - for (let i = 0; i < metadata.length; i++) { - data.push( - - - - - ); - } - return data; - })()} - -
- ) || null} ); } diff --git a/app/javascript/flavours/glitch/reducers/accounts.js b/app/javascript/flavours/glitch/reducers/accounts.js index 61354f2e1..23fbd999c 100644 --- a/app/javascript/flavours/glitch/reducers/accounts.js +++ b/app/javascript/flavours/glitch/reducers/accounts.js @@ -69,6 +69,14 @@ const normalizeAccount = (state, account) => { account.display_name_html = emojify(escapeTextContentForBrowser(displayName)); account.note_emojified = emojify(account.note); + if (account.fields) { + account.fields = account.fields.map(pair => ({ + ...pair, + name_emojified: emojify(escapeTextContentForBrowser(pair.name)), + value_emojified: emojify(pair.value), + })); + } + if (account.moved) { state = normalizeAccount(state, account.moved); account.moved = account.moved.id; diff --git a/app/javascript/flavours/glitch/styles/components/metadata.scss b/app/javascript/flavours/glitch/styles/components/metadata.scss index d56de19ea..9ca03fc2c 100644 --- a/app/javascript/flavours/glitch/styles/components/metadata.scss +++ b/app/javascript/flavours/glitch/styles/components/metadata.scss @@ -1,9 +1,10 @@ -.account__metadata { - width: 100%; +.account__header .account__header__fields { font-size: 15px; line-height: 20px; overflow: hidden; border-collapse: collapse; + margin: 20px -10px -20px; + border-bottom: 0; a { text-decoration: none; diff --git a/app/javascript/flavours/glitch/styles/metadata.scss b/app/javascript/flavours/glitch/styles/metadata.scss index 484410bef..b66cce3c1 100644 --- a/app/javascript/flavours/glitch/styles/metadata.scss +++ b/app/javascript/flavours/glitch/styles/metadata.scss @@ -1,4 +1,4 @@ -.metadata { +.account__header__fields { $meta-table-border: lighten($ui-base-color, 8%); border-collapse: collapse; diff --git a/app/views/accounts/_header.html.haml b/app/views/accounts/_header.html.haml index 76f29d591..af79922c2 100644 --- a/app/views/accounts/_header.html.haml +++ b/app/views/accounts/_header.html.haml @@ -21,20 +21,19 @@ = t 'accounts.roles.moderator' .bio .account__header__content.p-note.emojify!=processed_bio[:text] - - if processed_bio[:metadata].length > 0 - %table.metadata< - - processed_bio[:metadata].each do |i| - %tr.metadata-item>< - %th.emojify>!=i[0] - %td.emojify>!=i[1] - - - unless account.fields.empty? + - if !account.fields.empty? %table.account__header__fields %tbody - account.fields.each do |field| %tr %th.emojify= field.name %td.emojify= Formatter.instance.format_field(account, field.value) + - elsif processed_bio[:metadata].length > 0 + %table.account__header__fields< + - processed_bio[:metadata].each do |i| + %tr + %th.emojify>!=i[0] + %td.emojify>!=i[1] .details-counters .counter{ class: active_nav_class(short_account_url(account)) }