From a80ecaa47367b427150d5c00e90145b22b7aea3c Mon Sep 17 00:00:00 2001 From: ArtemB Date: Wed, 9 Aug 2023 13:41:56 +0300 Subject: [PATCH] 0.0.76 add btn profile --- static/css/styles.css | 68 +++++++++++++++++------ static/js/authorization.js | 11 ++++ templates/blocks/b_header.html | 26 ++++++++- templates/blocks/profile/b_new_route.html | 17 ++++-- 4 files changed, 98 insertions(+), 24 deletions(-) diff --git a/static/css/styles.css b/static/css/styles.css index 0aedda5..c9df626 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -633,22 +633,22 @@ input.deactive { border-color: #b3d7ff; } -.custom-checkbox:focus+label::before { - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); +.custom-checkbox:hover+label::before { + box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.12); } -.custom-checkbox:focus:not(:checked)+label::before { - border-color: #80bdff; -} + .custom-checkbox:checked+label::before { - border-color: #0b76ef; - background-color: #0b76ef; - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e"); + + background-color:#FF613A; + box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.12); } -.custom-checkbox:disabled+label::before { - background-color: #e9ecef; + + +.custom-checkbox:disabled+label::before:hover { + box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.12); } section.login { @@ -1139,17 +1139,51 @@ input#id_extra_phone /* font-weight: 500;*/ /* line-height: 22px;*/ /*}*/ -.checkbox_cargo_type{ - display: block; - /*flex-wrap: wrap;*/ +/*.checkbox_cargo_type{*/ +/* display: block;*/ +/* !*flex-wrap: wrap;*!*/ +/*}*/ +/*.checkbox_cargo_type>div{*/ +/* column-count: 2;*/ +/* max-width: 330px;*/ +/* width: 100%;*/ +/* margin-bottom: 10px;*/ +/*}*/ +/*.checkbox_cargo_type>div>input{*/ +/* display: block;*/ +/*}*/ +/*.checkbox_cargo_type>div>label{*/ +/* display: block;*/ +/*}*/ + +.real-checkbox{ + } -.checkbox_cargo_type>input{ - display: block; + +.custom-checkbox-w{ + display: inline-block; + width: 30px; + height: 30px; + /*background: white;*/ + border-radius: 10px; + border: 1px solid #E6E6E6; + vertical-align: sub; } -.checkbox_cargo_type>label{ - display: block; + +.custom-checkbox-w::before{ + /*content: '';*/ + background: #FF613A; + transition: 0.2s ease-in; + } +.real-checkbox:checked + .custom-checkbox-w::before{ + + +} + + + /*input#id_cargo_type{*/ /* width: 50%;*/ /*}*/ diff --git a/static/js/authorization.js b/static/js/authorization.js index 70c8b05..4d31993 100644 --- a/static/js/authorization.js +++ b/static/js/authorization.js @@ -1,8 +1,12 @@ function SendLoginForm(el){ + event.preventDefault() let form = el.form; let formData = new FormData(form); + + + $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, url: '/ru/user_account/login/', @@ -16,6 +20,13 @@ function SendLoginForm(el){ success: function(data){ location.href = '/profile' + // let profile_btn = document.createElement("a"); + // profile_btn.classList.add("profile_button"); + // profile_btn.innerText = "Профиль"; + // let reg_btn = document.querySelector(".registration_button"); + // let replace_btn = reg_btn.parentNode; + // replace_btn.replaceChild(profile_btn, reg_btn); + }, error: function (data, exception){ document.querySelector(".login").innerHTML = data.responseJSON.html diff --git a/templates/blocks/b_header.html b/templates/blocks/b_header.html index 60825e6..7b35d1b 100644 --- a/templates/blocks/b_header.html +++ b/templates/blocks/b_header.html @@ -9,7 +9,29 @@
Служба поддержки
- Регистрация - Войти + {% if user.is_authenticated %} + + Профиль + + + {% endif %} + + {% if not user.is_authenticated %} + + Регистрация + + + + Войти + + + {% endif %} +
\ No newline at end of file diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index 1002853..720c0c0 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -182,8 +182,11 @@
+ {% for item in form.fields.cargo_type.choices %} - + - + {% endif %} + /> + + +
{% endfor %} + {# #} {##} {# #}