From 911a834e4bff8a5adfe3554095334e93f781f27f Mon Sep 17 00:00:00 2001 From: Maksim Veynberg Date: Mon, 1 May 2023 09:32:54 +0500 Subject: [PATCH 1/2] Improve UI; Add blank settings pages with sidebar navigation --- .../stylesheets/application.tailwind.css | 56 +++++++++++++++++-- app/controllers/settings/base_controller.rb | 8 +++ app/controllers/settings/keys_controller.rb | 5 ++ .../settings/profile_controller.rb | 5 ++ app/views/application/_header.html.slim | 12 ++-- app/views/application/_main.html.slim | 3 + app/views/layouts/application.html.erb | 26 --------- app/views/layouts/application.html.slim | 16 ++++++ app/views/layouts/settings/base.html.slim | 17 ++++++ app/views/settings/keys/show.html.slim | 1 + app/views/settings/profile/show.html.slim | 1 + app/views/svg/_fa_book.html.slim | 2 + app/views/svg/_fa_key.html.slim | 2 + app/views/svg/_fa_user.html.slim | 2 + config/routes.rb | 3 + 15 files changed, 122 insertions(+), 37 deletions(-) create mode 100644 app/controllers/settings/base_controller.rb create mode 100644 app/controllers/settings/keys_controller.rb create mode 100644 app/controllers/settings/profile_controller.rb create mode 100644 app/views/application/_main.html.slim delete mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/layouts/application.html.slim create mode 100644 app/views/layouts/settings/base.html.slim create mode 100644 app/views/settings/keys/show.html.slim create mode 100644 app/views/settings/profile/show.html.slim create mode 100644 app/views/svg/_fa_book.html.slim create mode 100644 app/views/svg/_fa_key.html.slim create mode 100644 app/views/svg/_fa_user.html.slim diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index 105e5dd..e57ce1a 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -45,31 +45,75 @@ } @layer components { - p.alert, p.notice { - @apply border my-5; - } + /* header */ body > header { @apply relative w-full flex flex-wrap items-center py-4 bg-gray-100 text-gray-900 shadow-lg mb-4; } - header > nav { + header > nav.bar { @apply container mx-auto flex flex-wrap items-center justify-between; } - nav > a.logo { + header > nav.bar ul { + @apply flex space-x-3; + } + + nav.bar > a.logo { @apply text-lg font-bold hover:no-underline space-x-3 flex; } a.logo > svg { + @apply text-cyan-700; width: 23px; height: 27px; } - body > main { + /* notifications */ + + p.alert, p.notice { + @apply border my-5; + } + + /* bodyer */ + + body .bodyer { @apply container mx-auto flex-col; } + .with-sidebar { + @apply flex flex-row; + } + + .with-sidebar aside { + @apply w-1/4 px-2; + } + + .with-sidebar main { + @apply w-3/4 pt-4 px-2; + } + + .with-sidebar aside .sticky-menu { + @apply sticky top-0 p-4 w-full; + } + + .sticky-menu ul { + @apply flex flex-col overflow-hidden; + } + + .sticky-menu svg { + width: 14px; + heigth: 16px; + } + + .sticky-menu li > a { + @apply items-center flex space-x-2 p-3 text-black hover:no-underline; + } + + .sticky-menu li > a.active { + @apply bg-sky-200; + } + form, .form { @apply flex flex-col space-y-4 mb-4; } diff --git a/app/controllers/settings/base_controller.rb b/app/controllers/settings/base_controller.rb new file mode 100644 index 0000000..2b18770 --- /dev/null +++ b/app/controllers/settings/base_controller.rb @@ -0,0 +1,8 @@ +class Settings::BaseController < ApplicationController + before_action :require_login + + def active?(name) + name == controller_name ? :active : nil + end + helper_method :active? +end diff --git a/app/controllers/settings/keys_controller.rb b/app/controllers/settings/keys_controller.rb new file mode 100644 index 0000000..22954f9 --- /dev/null +++ b/app/controllers/settings/keys_controller.rb @@ -0,0 +1,5 @@ +class Settings::KeysController < Settings::BaseController + def show + nil + end +end diff --git a/app/controllers/settings/profile_controller.rb b/app/controllers/settings/profile_controller.rb new file mode 100644 index 0000000..c6cdbfe --- /dev/null +++ b/app/controllers/settings/profile_controller.rb @@ -0,0 +1,5 @@ +class Settings::ProfileController < Settings::BaseController + def show + nil + end +end diff --git a/app/views/application/_header.html.slim b/app/views/application/_header.html.slim index b77f34b..235c22f 100644 --- a/app/views/application/_header.html.slim +++ b/app/views/application/_header.html.slim @@ -1,9 +1,11 @@ header - nav + nav.bar a.logo href=root_path - svg.svg-inline--fal.fa-xl.text-cyan-700[aria-hidden="true" focusable="false" data-prefix="fas" data-icon="book" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 448 512" data-fa-i2svg=""] - path[fill="currentColor" d="M96 0C43 0 0 43 0 96V416c0 53 43 96 96 96H384h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V384c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32H384 96zm0 384H352v64H96c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16zm16 48H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16s7.2-16 16-16z"] + = render 'svg/fa_book' span Book - if current_user.present? - a href=user_path(current_user) Profile - = link_to 'Logout', destroy_user_session_path, method: :delete + ul + li + a href=settings_profile_path Profile + li + = link_to 'Logout', destroy_user_session_path, method: :delete diff --git a/app/views/application/_main.html.slim b/app/views/application/_main.html.slim new file mode 100644 index 0000000..1c54ca1 --- /dev/null +++ b/app/views/application/_main.html.slim @@ -0,0 +1,3 @@ +main + = yield + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 4905de4..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,26 +0,0 @@ - - - - Book - - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> - <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> - - - - <%= render "header" %> - -
- <%= render "notifications" %> - -
- <%= yield %> -
-
- - <%= render "footer" %> - - diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim new file mode 100644 index 0000000..b7ff974 --- /dev/null +++ b/app/views/layouts/application.html.slim @@ -0,0 +1,16 @@ +doctype html +html + head + title Book + meta[name="viewport" content="width=device-width,initial-scale=1"] + = csrf_meta_tags + = csp_meta_tag + = stylesheet_link_tag "application", "data-turbo-track": "reload" + = stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" + = javascript_importmap_tags + body + = render "header" + .bodyer + = render "notifications" + = content_for?(:bodyer) ? yield(:bodyer) : render('main') + = render "footer" diff --git a/app/views/layouts/settings/base.html.slim b/app/views/layouts/settings/base.html.slim new file mode 100644 index 0000000..112398d --- /dev/null +++ b/app/views/layouts/settings/base.html.slim @@ -0,0 +1,17 @@ +- content_for :bodyer do + .with-sidebar + aside + .sticky-menu + ul + li + = link_to settings_profile_path, class: active?('profile') + = render 'svg/fa_user' + span Profile + li + = link_to settings_keys_path, class: active?('keys') + = render 'svg/fa_key' + span Key management + main + = yield + += render template: 'layouts/application' diff --git a/app/views/settings/keys/show.html.slim b/app/views/settings/keys/show.html.slim new file mode 100644 index 0000000..4889e49 --- /dev/null +++ b/app/views/settings/keys/show.html.slim @@ -0,0 +1 @@ +h1 Keys diff --git a/app/views/settings/profile/show.html.slim b/app/views/settings/profile/show.html.slim new file mode 100644 index 0000000..f00e67c --- /dev/null +++ b/app/views/settings/profile/show.html.slim @@ -0,0 +1 @@ +h1 Profile diff --git a/app/views/svg/_fa_book.html.slim b/app/views/svg/_fa_book.html.slim new file mode 100644 index 0000000..f4c8bd9 --- /dev/null +++ b/app/views/svg/_fa_book.html.slim @@ -0,0 +1,2 @@ +svg.svg-inline--fa[aria-hidden="true" focusable="false" data-prefix="fas" data-icon="book" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 448 512" data-fa-i2svg=""] + path[fill="currentColor" d="M96 0C43 0 0 43 0 96V416c0 53 43 96 96 96H384h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V384c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32H384 96zm0 384H352v64H96c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16zm16 48H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16s7.2-16 16-16z"] diff --git a/app/views/svg/_fa_key.html.slim b/app/views/svg/_fa_key.html.slim new file mode 100644 index 0000000..e51142e --- /dev/null +++ b/app/views/svg/_fa_key.html.slim @@ -0,0 +1,2 @@ +svg.svg-inline--fa[aria-hidden="true" focusable="false" data-prefix="fas" data-icon="key" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 512" data-fa-i2svg=""] + path[fill="currentColor" d="M336 352c97.2 0 176-78.8 176-176S433.2 0 336 0S160 78.8 160 176c0 18.7 2.9 36.8 8.3 53.7L7 391c-4.5 4.5-7 10.6-7 17v80c0 13.3 10.7 24 24 24h80c13.3 0 24-10.7 24-24V448h40c13.3 0 24-10.7 24-24V384h40c6.4 0 12.5-2.5 17-7l33.3-33.3c16.9 5.4 35 8.3 53.7 8.3zM376 96a40 40 0 1 1 0 80 40 40 0 1 1 0-80z"] diff --git a/app/views/svg/_fa_user.html.slim b/app/views/svg/_fa_user.html.slim new file mode 100644 index 0000000..74c9783 --- /dev/null +++ b/app/views/svg/_fa_user.html.slim @@ -0,0 +1,2 @@ +svg.svg-inline--fa[aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 448 512" data-fa-i2svg=""] + path[fill="currentColor" d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z"] diff --git a/config/routes.rb b/config/routes.rb index 7c2f2e7..fb6fb5c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,9 @@ end resources :users, only: %i[show update] + get '/settings/profile', to: 'settings/profile#show' + get '/settings/keys', to: 'settings/keys#show' + get '/records/introduction/new', as: 'new_introduction' post '/records/introduction', to: 'records/introduction#create', as: 'create_introduction' post '/records/signature', to: 'records/signature#create', as: 'sign_record' From d49d29c352616b48a3c581b9cee51d4d885bcf33 Mon Sep 17 00:00:00 2001 From: Maksim Veynberg Date: Sat, 2 Dec 2023 08:56:01 +0500 Subject: [PATCH 2/2] bundle update; i18n interface --- Gemfile.lock | 354 +++++++++++----------- app/views/application/_header.html.slim | 6 +- app/views/layouts/application.html.slim | 2 +- app/views/layouts/settings/base.html.slim | 4 +- app/views/settings/keys/show.html.slim | 44 ++- app/views/settings/profile/show.html.slim | 7 +- config/locales/en.yml | 10 +- config/locales/ru.yml | 10 +- 8 files changed, 252 insertions(+), 185 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 43a8140..138dd14 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,83 +1,83 @@ GEM remote: https://rubygems.org/ specs: - accept_language (2.0.3) - actioncable (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + accept_language (2.0.4) + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.3) - actionpack (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4.3) - actionview (= 7.0.4.3) - activesupport (= 7.0.4.3) - rack (~> 2.0, >= 2.2.0) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.3) - actionpack (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.3) - activesupport (= 7.0.4.3) + actionview (7.0.8) + activesupport (= 7.0.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4.3) - activesupport (= 7.0.4.3) + activejob (7.0.8) + activesupport (= 7.0.8) globalid (>= 0.3.6) - activemodel (7.0.4.3) - activesupport (= 7.0.4.3) - activerecord (7.0.4.3) - activemodel (= 7.0.4.3) - activesupport (= 7.0.4.3) - activestorage (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activesupport (= 7.0.4.3) + activemodel (7.0.8) + activesupport (= 7.0.8) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4.3) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.4) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) backport (1.2.0) - bcrypt (3.1.18) - benchmark (0.2.1) + bcrypt (3.1.20) + benchmark (0.3.0) bindex (0.8.1) - bootsnap (1.16.0) + bootsnap (1.17.0) msgpack (~> 1.2) builder (3.2.4) - capybara (3.39.0) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -88,90 +88,89 @@ GEM xpath (~> 3.2) concurrent-ruby (1.2.2) crass (1.0.6) - cucumber (8.0.0) + cucumber (9.1.0) builder (~> 3.2, >= 3.2.4) - cucumber-ci-environment (~> 9.0, >= 9.0.4) - cucumber-core (~> 11.0, >= 11.0.0) - cucumber-cucumber-expressions (~> 15.1, >= 15.1.1) - cucumber-gherkin (~> 23.0, >= 23.0.1) - cucumber-html-formatter (~> 19.1, >= 19.1.0) - cucumber-messages (~> 18.0, >= 18.0.0) + cucumber-ci-environment (~> 9.2, >= 9.2.0) + cucumber-core (~> 12.0) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (>= 24, < 27) + cucumber-html-formatter (~> 20.4, >= 20.4.0) + cucumber-messages (>= 19, < 23) diff-lcs (~> 1.5, >= 1.5.0) - mime-types (~> 3.4, >= 3.4.1) + mini_mime (~> 1.1, >= 1.1.5) multi_test (~> 1.1, >= 1.1.0) - sys-uname (~> 1.2, >= 1.2.2) - cucumber-ci-environment (9.1.0) - cucumber-core (11.0.0) - cucumber-gherkin (~> 23.0, >= 23.0.1) - cucumber-messages (~> 18.0, >= 18.0.0) - cucumber-tag-expressions (~> 4.1, >= 4.1.0) - cucumber-cucumber-expressions (15.2.0) - cucumber-gherkin (23.0.1) - cucumber-messages (~> 18.0, >= 18.0.0) - cucumber-html-formatter (19.2.0) - cucumber-messages (~> 18.0, >= 18.0.0) - cucumber-messages (18.0.0) - cucumber-rails (2.6.1) - capybara (>= 2.18, < 4) - cucumber (>= 3.2, < 9) - mime-types (~> 3.3) - nokogiri (~> 1.10) - railties (>= 5.0, < 8) - rexml (~> 3.0) - webrick (~> 1.7) - cucumber-tag-expressions (4.1.0) + sys-uname (~> 1.2, >= 1.2.3) + cucumber-ci-environment (9.2.0) + cucumber-core (12.0.0) + cucumber-gherkin (>= 25, < 27) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (~> 5.0, >= 5.0.4) + cucumber-cucumber-expressions (17.0.1) + cucumber-gherkin (26.2.0) + cucumber-messages (>= 19.1.4, < 22.1) + cucumber-html-formatter (20.4.0) + cucumber-messages (>= 18.0, < 22.1) + cucumber-messages (22.0.0) + cucumber-rails (3.0.0) + capybara (>= 3.11, < 4) + cucumber (>= 5, < 10) + railties (>= 5.2, < 8) + cucumber-tag-expressions (5.0.6) database_cleaner (2.0.2) database_cleaner-active_record (>= 2, < 3) database_cleaner-active_record (2.1.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - date (3.3.3) - debug (1.7.2) + date (3.3.4) + debug (1.8.0) irb (>= 1.5.0) reline (>= 0.3.1) - devise (4.9.2) + devise (4.9.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.11.0) + devise-i18n (1.12.0) devise (>= 4.9.0) diff-lcs (1.5.0) docile (1.4.0) e2mmap (0.1.0) erubi (1.12.0) - factory_bot (6.2.1) + factory_bot (6.4.2) activesupport (>= 5.0.0) - factory_bot_rails (6.2.0) - factory_bot (~> 6.2.0) + factory_bot_rails (6.4.2) + factory_bot (~> 6.4) railties (>= 5.0.0) - faker (3.2.0) + faker (3.2.2) i18n (>= 1.8.11, < 2) - ffi (1.15.5) - globalid (1.1.0) - activesupport (>= 5.0) - i18n (1.12.0) + ffi (1.16.3) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.1) concurrent-ruby (~> 1.0) - importmap-rails (1.1.5) + importmap-rails (1.2.3) actionpack (>= 6.0.0) + activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.6.0) - irb (1.6.4) - reline (>= 0.3.0) - jaro_winkler (1.5.4) + irb (1.9.1) + rdoc + reline (>= 0.3.8) + jaro_winkler (1.5.6) jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.6.3) + json (2.7.0) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - loofah (2.20.0) + language_server-protocol (3.17.0.3) + loofah (2.22.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -180,115 +179,120 @@ GEM marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2023.0218.1) - mini_mime (1.1.2) - mini_portile2 (2.8.1) - minitest (5.18.0) - msgpack (1.7.0) + mini_mime (1.1.5) + mini_portile2 (2.8.5) + minitest (5.20.0) + msgpack (1.7.2) multi_test (1.1.0) - net-imap (0.3.4) + net-imap (0.4.7) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout - net-smtp (0.3.3) + net-smtp (0.4.0) net-protocol - nio4r (2.5.9) - nokogiri (1.14.3) - mini_portile2 (~> 2.8.0) + nio4r (2.7.0) + nokogiri (1.15.5) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.14.3-x86_64-linux) + nokogiri (1.15.5-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - parallel (1.22.1) - parser (3.2.2.0) + parallel (1.23.0) + parser (3.2.2.4) ast (~> 2.4.1) - pg (1.4.6) - public_suffix (5.0.1) - puma (5.6.5) + racc + pg (1.5.4) + psych (5.1.1.1) + stringio + public_suffix (5.0.4) + puma (5.6.7) nio4r (~> 2.0) - racc (1.6.2) - rack (2.2.6.4) + racc (1.7.3) + rack (2.2.8) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.4.3) - actioncable (= 7.0.4.3) - actionmailbox (= 7.0.4.3) - actionmailer (= 7.0.4.3) - actionpack (= 7.0.4.3) - actiontext (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activemodel (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) bundler (>= 1.15.0) - railties (= 7.0.4.3) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + railties (= 7.0.8) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) - rails-i18n (7.0.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + rails-i18n (7.0.8) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rbs (2.8.4) - regexp_parser (2.7.0) - reline (0.3.3) + rdoc (6.6.0) + psych (>= 4.0.0) + regexp_parser (2.8.2) + reline (0.4.1) io-console (~> 0.5) - responders (3.1.0) + responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) reverse_markdown (2.1.1) nokogiri - rexml (3.2.5) - rspec-core (3.12.1) + rexml (3.2.6) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.2) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.5) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (6.0.1) + rspec-rails (6.1.0) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.11) - rspec-expectations (~> 3.11) - rspec-mocks (~> 3.11) - rspec-support (~> 3.11) - rspec-support (3.12.0) - rubocop (1.50.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) + rubocop (1.58.0) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) ruby-progressbar (1.13.0) rubyzip (2.3.2) safe_shell (1.1.0) - selenium-webdriver (4.8.6) + selenium-webdriver (4.10.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -299,10 +303,10 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - slim (5.1.0) + slim (5.2.0) temple (~> 0.10.0) - tilt (>= 2.0.6, < 2.2) - slim-rails (3.6.2) + tilt (>= 2.1.0) + slim-rails (3.6.3) actionpack (>= 3.1) railties (>= 3.1) slim (>= 3.0, < 6.0, != 5.0.0) @@ -325,55 +329,55 @@ GEM solargraph-rails (1.1.0) activesupport solargraph - sprockets (4.2.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.6.2) + sqlite3 (1.6.9) mini_portile2 (~> 2.8.0) - sqlite3 (1.6.2-x86_64-linux) - stimulus-rails (1.2.1) + sqlite3 (1.6.9-x86_64-linux) + stimulus-rails (1.3.0) railties (>= 6.0.0) + stringio (3.1.0) sys-uname (1.2.3) ffi (~> 1.1) - tailwindcss-rails (2.0.27) + tailwindcss-rails (2.0.32) railties (>= 6.0.0) - tailwindcss-rails (2.0.27-x86_64-linux) + tailwindcss-rails (2.0.32-x86_64-linux) railties (>= 6.0.0) - temple (0.10.0) - thor (1.2.1) - tilt (2.1.0) - timeout (0.3.2) - turbo-rails (1.4.0) + temple (0.10.3) + thor (1.3.0) + tilt (2.3.0) + timeout (0.4.1) + turbo-rails (1.5.0) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) warden (1.2.9) rack (>= 2.0.9) - web-console (4.2.0) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webdrivers (5.2.0) + webdrivers (5.3.1) nokogiri (~> 1.6) rubyzip (>= 1.3.0) - selenium-webdriver (~> 4.0) - webrick (1.8.1) - websocket (1.2.9) - websocket-driver (0.7.5) + selenium-webdriver (~> 4.0, < 4.11) + websocket (1.2.10) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.34) - zeitwerk (2.6.7) + zeitwerk (2.6.12) PLATFORMS ruby diff --git a/app/views/application/_header.html.slim b/app/views/application/_header.html.slim index 235c22f..aaf0445 100644 --- a/app/views/application/_header.html.slim +++ b/app/views/application/_header.html.slim @@ -2,10 +2,10 @@ header nav.bar a.logo href=root_path = render 'svg/fa_book' - span Book + span = t('book') - if current_user.present? ul li - a href=settings_profile_path Profile + a href=settings_profile_path = t('profile') li - = link_to 'Logout', destroy_user_session_path, method: :delete + = link_to t('logout'), destroy_user_session_path, method: :delete diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index b7ff974..5bb9849 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -1,7 +1,7 @@ doctype html html head - title Book + title = t('book') meta[name="viewport" content="width=device-width,initial-scale=1"] = csrf_meta_tags = csp_meta_tag diff --git a/app/views/layouts/settings/base.html.slim b/app/views/layouts/settings/base.html.slim index 112398d..a52f278 100644 --- a/app/views/layouts/settings/base.html.slim +++ b/app/views/layouts/settings/base.html.slim @@ -6,11 +6,11 @@ li = link_to settings_profile_path, class: active?('profile') = render 'svg/fa_user' - span Profile + span = t('profile') li = link_to settings_keys_path, class: active?('keys') = render 'svg/fa_key' - span Key management + span = t('keys') main = yield diff --git a/app/views/settings/keys/show.html.slim b/app/views/settings/keys/show.html.slim index 4889e49..d59a6c1 100644 --- a/app/views/settings/keys/show.html.slim +++ b/app/views/settings/keys/show.html.slim @@ -1 +1,43 @@ -h1 Keys +h1 = t('key_management') + +.info + - if current_user.public_key.present? + h3 = t('your_public_key') + pre.mb-4 = current_user.public_key + +div data-controller="keys" + .form + .field + label for="full_name" Full name + br + input id="full_name" type="text" data-keys-target="username" + + .field + label for="passphrase" Passphrase + br + input id="passphrase" type="password" data-keys-target="passphrase" + + = form_with model: current_user do |f| + = f.hidden_field :email, name: nil, value: current_user.email, data: { keys_target: "email" } + + .button + button data-action="click->keys#generate" Generate Key Pair + + .field + = f.label :public_key + br + = f.text_area :public_key, required: true, data: { keys_target: "publicKey", action: "input->keys#publicKeyInput" } + + .field + = f.label :private_key + br + = f.text_area :private_key, name: nil, data: { keys_target: "privateKey", action: "input->keys#privateKeyInput" } + + .field + = f.label :fingerprint + br + = f.text_field :fingerprint, data: { keys_target: "fingerprint" }, readonly: true + + .button + = f.submit "Update Keys", data: { action: "click->keys#register" } + diff --git a/app/views/settings/profile/show.html.slim b/app/views/settings/profile/show.html.slim index f00e67c..835d0a1 100644 --- a/app/views/settings/profile/show.html.slim +++ b/app/views/settings/profile/show.html.slim @@ -1 +1,6 @@ -h1 Profile +h1 = t('user_details') + +.controller[data-controller="user_details"] + .form + .field + label for="first_name" = t('settings.user.first_name') diff --git a/config/locales/en.yml b/config/locales/en.yml index 0106b4a..6c598ca 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,4 +1,12 @@ en: - hello: Hello + book: Book + profile: Profile + logout: Logout + + keys: Keys + key_management: Key Management your_public_key: Your public key + user_details: User Details + + first_name: First Name diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 191536f..55525f2 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1,4 +1,12 @@ ru: - hello: Привет + book: Книга + profile: Профиль + logout: Выйти + + keys: Ключи + key_management: Управление ключами your_public_key: Ваш публичный ключ + user_details: Данные пользователя + + first_name: Имя