This commit is contained in:
SBD
2023-12-08 16:07:24 +03:00
parent 4703d883de
commit 9f12bd058d
5 changed files with 40 additions and 30 deletions

View File

@@ -857,6 +857,10 @@ body.n_scroll{
/*block present technology*/
.a_block_present_technology{
text-decoration: none;
}
.txt_block_present_technology{
width: 100%;
display: block;

View File

@@ -38,9 +38,10 @@ function renderContent (el=null) {
} else {
data['section_url'] = el.dataset['url']
}
if (window.location.href.includes("ru")){
let language = document.querySelector(".name_language").innerHTML
if (language.includes("ru")){
data['lang'] = 'ru'
} else if (window.location.href.includes("en")){
} else if (language.includes("en")){
data['lang'] = 'en'
}
$.ajax({
@@ -57,16 +58,18 @@ function renderContent (el=null) {
success: function(data){
document.querySelector(".content").innerHTML = data.html
window.scrollTo(0, 0);
let lang = getLang()
replaceHrefOnOnclick()
replace_select_language()
if (el){
history.pushState({
'section':data['section_url']
},
'',
`/section/${el.dataset['url']}/`
`/${lang}/section/${el.dataset['url']}/`
)
}
replace_select_language()
},
error: function (data){
alert(data.errors)
@@ -74,18 +77,23 @@ function renderContent (el=null) {
});
}
function getLang () {
let lang = ''
if (window.location.href.includes("/en/")){
lang = 'en'
} else if (window.location.href.includes("/ru/")){
lang = 'ru'
}
return lang
}
function replace_select_language () {
let select = document.querySelector(".name_language")
if (getInfoAboutUser()[0] === 'mobile' || getInfoAboutUser()[0] === 'laptop'){
select = document.querySelector(".name_language.curtain")
}
let lang_f_replace = ''
if (window.location.href.includes('ru')){
lang_f_replace = 'ru'
} else {
lang_f_replace = 'en'
}
let lang_f_replace = getLang()
select.innerHTML = lang_f_replace
}
@@ -136,6 +144,9 @@ function select_language (el) {
lang_f_replace = 'en'
}
window.location.href = window.location.href.replace(`${lang_f_replace}`,txt.toLowerCase())
history.pushState({
'lang':txt
},null,window.location.href.replace(`${lang_f_replace}`,txt.toLowerCase()))
open_select_language()
}

View File

@@ -2,27 +2,11 @@
<div {% include "block_settings/blocks_settings.html" %}>
<div class="cut-width">
{% if block.url %}
<a href="{{ block.url }}">
<div class="content_block_present_technology">
<div class="left_part_block_present_technology">
<div class="txt_block_present_technology semi_large_light">{{ block.description }}</div>
<div class="txt_block_present_technology large_txt">{{ block.name }}</div>
</div>
<div class="right_part_block_present_technology">
<img class="img_block_present_technology" src="{{ block.picture.url }}" alt="{{ block.name }}">
</div>
</div>
<a class="a_block_present_technology" href="{{ block.url }}">
{% include 'widgets/w_technology_item.html' %}
</a>
{% else %}
<div class="content_block_present_technology">
<div class="left_part_block_present_technology">
<div class="txt_block_present_technology semi_large_light">{{ block.description }}</div>
<div class="txt_block_present_technology large_txt">{{ block.name }}</div>
</div>
<div class="right_part_block_present_technology">
<img class="img_block_present_technology" src="{{ block.picture.url }}" alt="{{ block.name }}">
</div>
</div>
{% include 'widgets/w_technology_item.html' %}
{% endif %}
</div>
</div>

View File

@@ -1,5 +1,5 @@
{% if widget.but_title %}
<a href="{{ widget.url }}" style="border: {{ widget.but_color }} solid 2px; color: {{ widget.but_color }};text-decoration: none;">
<a href="{{ widget.url }}" style="border: {{ widget.but_color }} solid 2px; color: {{ widget.but_color }};text-decoration: none;padding: 5px;display: block;">
{{ widget.but_title }}
</a>
{% endif %}

View File

@@ -0,0 +1,11 @@
{% load static %}
<div class="content_block_present_technology">
<div class="left_part_block_present_technology">
<div class="txt_block_present_technology semi_large_light">{{ block.description }}</div>
<div class="txt_block_present_technology large_txt">{{ block.name }}</div>
</div>
<div class="right_part_block_present_technology">
<img class="img_block_present_technology" src="{{ block.picture.url }}" alt="{{ block.name }}">
</div>
</div>