From 88c092dc98a629d8fa77b3bddc020d5505479be2 Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Tue, 7 Jul 2020 15:59:02 +0200 Subject: [PATCH] Add i18n and constants --- .../javascripts/users/registrations/edit.js | 2 +- app/assets/stylesheets/settings/users.scss | 67 +++++++++- app/assets/stylesheets/themes/scinote.scss | 17 +-- .../users/registrations/_2fa_modal.html.erb | 8 +- .../_2fa_modal_apps_tab.html.erb | 36 +++--- .../_2fa_modal_qr_code_tab.html.erb | 6 +- .../_2fa_modal_verify_code_tab.html.erb | 8 +- app/views/users/registrations/edit.html.erb | 115 +++++++++--------- .../registrations/edit_partials/_2fa.html.erb | 19 +++ .../edit_partials/_email.html.erb | 18 ++- .../edit_partials/_password.html.erb | 22 ++-- config/initializers/constants.rb | 15 +++ config/locales/en.yml | 40 ++++-- 13 files changed, 241 insertions(+), 132 deletions(-) create mode 100644 app/views/users/registrations/edit_partials/_2fa.html.erb diff --git a/app/assets/javascripts/users/registrations/edit.js b/app/assets/javascripts/users/registrations/edit.js index 38969d9a3..c3216489c 100644 --- a/app/assets/javascripts/users/registrations/edit.js +++ b/app/assets/javascripts/users/registrations/edit.js @@ -102,5 +102,5 @@ $('#twoFactorAuthenticationModal').on('click', '.btn-next-step', function() { $('#twoFactorAuthenticationModal').find(`[href="${$(this).data('step')}"]`).tab('show'); - }) + }); }()); diff --git a/app/assets/stylesheets/settings/users.scss b/app/assets/stylesheets/settings/users.scss index 204355d72..010350d75 100644 --- a/app/assets/stylesheets/settings/users.scss +++ b/app/assets/stylesheets/settings/users.scss @@ -1,11 +1,54 @@ @import "constants"; @import "mixins"; -.user-settings-block { - display: block; - margin-bottom: 20px; +.user-settings { + .settings-row { + margin-top: 2em; + + .user-attribute { + align-items: center; + display: flex; + + .btn { + margin-left: auto; + } + } + } + + .user-settings-block { + display: block; + margin-bottom: 20px; + } + + + .two-factor-container { + border: $border-default; + column-gap: 1em; + display: grid; + grid-template-columns: auto fit-content; + margin: 1em 0; + padding: 1em; + row-gap: .5em; + + + .title { + @include font-main; + flex-basis: 100%; + grid-column: 1 / span 2; + + .enabled { + @include font-button; + color: $brand-success; + } + } + + .btn { + align-self: end; + } + } } + .two-factor-modal { .two-factor-apps { align-items: center; @@ -54,3 +97,21 @@ padding: 4em; } } + +@media (max-width: 700px) { + .user-settings { + .two-factor-container { + grid-template-columns: auto; + + .title { + grid-column: 1; + } + } + } + + .two-factor-modal { + .install-mobile { + display: none; + } + } +} diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 56f9abf8e..e504f8d67 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -469,8 +469,10 @@ a[data-toggle="tooltip"] { } .user-statistics { + margin-top: 1em; + .list-inline { - margin-left: 15px; + margin-left: 0; } .label { @@ -479,10 +481,8 @@ a[data-toggle="tooltip"] { li { height: 100px; - margin: 15px; - padding-bottom: 15px; - padding-left: 10px; - padding-right: 10px; + margin-bottom: 1em; + margin-right: 2em; width: 100px; } } @@ -1318,10 +1318,9 @@ ul.content-activities { .avatar-container { background-color: lighten($color-concrete, 2%); border-radius: 50%; - height: 100px; - margin-top: 5px; + height: 5em; position: relative; - width: 100px; + width: 5em; .avatar-edit { background-color: $color-silver-chalice; @@ -1356,6 +1355,8 @@ ul.content-activities { img { border-radius: 50%; + height: 100%; + width: 100%; } } } diff --git a/app/views/users/registrations/_2fa_modal.html.erb b/app/views/users/registrations/_2fa_modal.html.erb index ecbf62bba..16a161c56 100644 --- a/app/views/users/registrations/_2fa_modal.html.erb +++ b/app/views/users/registrations/_2fa_modal.html.erb @@ -4,18 +4,18 @@ <% if current_user.two_factor_auth_enabled? %> <%= form_with(url: users_2fa_disable_path, method: "post", class: "2fa-disable-form") do %> <% end %> <% else %> diff --git a/app/views/users/registrations/_2fa_modal_apps_tab.html.erb b/app/views/users/registrations/_2fa_modal_apps_tab.html.erb index d9806b291..51abf2198 100644 --- a/app/views/users/registrations/_2fa_modal_apps_tab.html.erb +++ b/app/views/users/registrations/_2fa_modal_apps_tab.html.erb @@ -1,10 +1,10 @@
diff --git a/app/views/users/registrations/_2fa_modal_qr_code_tab.html.erb b/app/views/users/registrations/_2fa_modal_qr_code_tab.html.erb index 056e82108..d4f421c78 100644 --- a/app/views/users/registrations/_2fa_modal_qr_code_tab.html.erb +++ b/app/views/users/registrations/_2fa_modal_qr_code_tab.html.erb @@ -1,13 +1,13 @@
diff --git a/app/views/users/registrations/_2fa_modal_verify_code_tab.html.erb b/app/views/users/registrations/_2fa_modal_verify_code_tab.html.erb index 51799c6c2..75fea64b8 100644 --- a/app/views/users/registrations/_2fa_modal_verify_code_tab.html.erb +++ b/app/views/users/registrations/_2fa_modal_verify_code_tab.html.erb @@ -1,18 +1,18 @@
<%= form_with(url: users_2fa_enable_path, method: "post", class: "2fa-enable-form") do %> <% end %>
diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb index 1357e68cc..e146d4fc1 100644 --- a/app/views/users/registrations/edit.html.erb +++ b/app/views/users/registrations/edit.html.erb @@ -2,70 +2,65 @@ <% provide(:container_class, "no-second-nav-container") %> <%= render partial: "users/settings/sidebar" %> -
-
-
-
-

<%=t "users.registrations.edit.title" %>

- - <% if not resource.errors.empty? %> -
- <%= devise_error_messages! %> -
- <% end %> -
-
- <%= render partial: 'users/registrations/edit_partials/avatar' %> -
-
-
-
- <%= render partial: 'users/registrations/edit_partials/full_name' %> - <%= render partial: 'users/registrations/edit_partials/initials' %> -
-
- <%= render partial: 'users/registrations/edit_partials/email' %> - <%= render partial: 'users/registrations/edit_partials/password' %> -
+ diff --git a/app/views/users/registrations/edit_partials/_2fa.html.erb b/app/views/users/registrations/edit_partials/_2fa.html.erb new file mode 100644 index 000000000..b9d9480e5 --- /dev/null +++ b/app/views/users/registrations/edit_partials/_2fa.html.erb @@ -0,0 +1,19 @@ +
+
+ <%= t("users.registrations.edit.2fa_title") %> + <% if current_user.two_factor_auth_enabled? %> + + + <%= t("users.registrations.edit.2fa_enabled") %> + + <% end %> +
+
+ <%= t("users.registrations.edit.2fa_description") %> +
+ <% if current_user.two_factor_auth_enabled? %> + + <% else %> + + <% end %> +
diff --git a/app/views/users/registrations/edit_partials/_email.html.erb b/app/views/users/registrations/edit_partials/_email.html.erb index 1267b30ff..50be8c942 100644 --- a/app/views/users/registrations/edit_partials/_email.html.erb +++ b/app/views/users/registrations/edit_partials/_email.html.erb @@ -6,11 +6,9 @@
<%= f.label t("users.registrations.edit.email_label") %> -
- - - <%=t "general.edit" %> - +
+ <%= @user.email %> + <%=t "general.edit" %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>