0.0.78 update scrip for menu_user_profile
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
function writeMessage(){
|
||||
function writeMessage(el){
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/chats/',
|
||||
@@ -14,6 +14,9 @@ function writeMessage(){
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
let list_div = document.querySelectorAll('.menu_profile div');
|
||||
list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||
el.classList.add('selected')
|
||||
|
||||
},
|
||||
error: function (data, exception){
|
||||
@@ -24,7 +27,7 @@ function writeMessage(){
|
||||
}
|
||||
|
||||
|
||||
function technicalSupport(){
|
||||
function technicalSupport(el){
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/support_tickets/',
|
||||
@@ -41,6 +44,10 @@ function technicalSupport(){
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
let list_div = document.querySelectorAll('.menu_profile div');
|
||||
list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||
el.classList.add('selected')
|
||||
|
||||
|
||||
},
|
||||
error: function (data, exception){
|
||||
@@ -49,7 +56,7 @@ function technicalSupport(){
|
||||
}
|
||||
});
|
||||
}
|
||||
function mySubscription(){
|
||||
function mySubscription(el){
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/subscribe/',
|
||||
@@ -66,6 +73,10 @@ function mySubscription(){
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
let list_div = document.querySelectorAll('.menu_profile div');
|
||||
list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||
el.classList.add('selected')
|
||||
|
||||
|
||||
},
|
||||
error: function (data, exception){
|
||||
@@ -74,7 +85,7 @@ function mySubscription(){
|
||||
}
|
||||
});
|
||||
}
|
||||
function myProfile(){
|
||||
function myProfile(el){
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/change_profile/',
|
||||
@@ -91,6 +102,10 @@ function myProfile(){
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
let list_div = document.querySelectorAll('.menu_profile div');
|
||||
list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||
el.classList.add('selected')
|
||||
|
||||
|
||||
},
|
||||
error: function (data, exception){
|
||||
@@ -100,18 +115,18 @@ function myProfile(){
|
||||
});
|
||||
}
|
||||
|
||||
function selectMenuItem() {
|
||||
let list_div = document.querySelectorAll('.menu_profile div');
|
||||
|
||||
list_div.forEach(item =>{
|
||||
item.addEventListener('click', (e) =>{
|
||||
list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||
item.classList.add('selected')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// function selectMenuItem() {
|
||||
// let list_div = document.querySelectorAll('.menu_profile div');
|
||||
//
|
||||
// list_div.forEach(item =>{
|
||||
// item.addEventListener('click', (e) =>{
|
||||
// list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||
// item.classList.add('selected')
|
||||
// })
|
||||
// })
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@@ -376,7 +391,7 @@ function OnSelectionChange(el) {
|
||||
|
||||
|
||||
|
||||
function createRoute(){
|
||||
function createRoute(el){
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
@@ -394,6 +409,10 @@ function createRoute(){
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
|
||||
let list_div = document.querySelectorAll('.menu_profile div');
|
||||
list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||
el.classList.add('selected')
|
||||
|
||||
|
||||
|
||||
//get dynamic value
|
||||
@@ -413,7 +432,7 @@ function createRoute(){
|
||||
});
|
||||
}
|
||||
|
||||
function getRoute(){
|
||||
function getRoute(el){
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/routes/get_routes/',
|
||||
@@ -430,6 +449,10 @@ function getRoute(){
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
let list_div = document.querySelectorAll('.menu_profile div');
|
||||
list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||
el.classList.add('selected')
|
||||
|
||||
|
||||
},
|
||||
error: function (data, exception){
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
<section class="profile">
|
||||
{% csrf_token %}
|
||||
<div
|
||||
onclick="selectMenuItem()"
|
||||
|
||||
class="menu_profile">
|
||||
<div>
|
||||
<img class="svg" src="/static/img/svg/MagnifyingGlass.svg">
|
||||
<a href="#">Поиск посылки</a>
|
||||
</div>
|
||||
<div onclick="createRoute()">
|
||||
<div onclick="createRoute(this)">
|
||||
<img class="svg" src="/static/img/svg/PushPin.svg">
|
||||
<a href="#">Разместить объявление</a>
|
||||
</div>
|
||||
<div onclick="getRoute()">
|
||||
<div onclick="getRoute(this)">
|
||||
<img class="svg" src="/static/img/svg/Cards.svg">
|
||||
<a href="#">Мои объявления</a>
|
||||
</div>
|
||||
<div onclick="writeMessage()">
|
||||
<div onclick="writeMessage(this)">
|
||||
<img class="svg" src="/static/img/svg/ChatCircleDots.svg">
|
||||
<a href="#">Написать сообщение</a>
|
||||
</div>
|
||||
<div onclick="technicalSupport()">
|
||||
<div onclick="technicalSupport(this)">
|
||||
<img class="svg" src="/static/img/svg/Headset.svg">
|
||||
<a href="#">Тех. поддержка</a>
|
||||
</div>
|
||||
<div onclick="mySubscription()">
|
||||
<div onclick="mySubscription(this)">
|
||||
<img class="svg" src="/static/img/svg/CurrencyDollar.svg">
|
||||
<a href="#">Моя подписка</a>
|
||||
</div>
|
||||
<div onclick="myProfile()">
|
||||
<div onclick="myProfile(this)">
|
||||
<img class="svg" src="/static/img/svg/User.svg">
|
||||
<a href="#">Мой профиль</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user