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*/ /*block present technology*/
.a_block_present_technology{
text-decoration: none;
}
.txt_block_present_technology{ .txt_block_present_technology{
width: 100%; width: 100%;
display: block; display: block;

View File

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

View File

@@ -2,27 +2,11 @@
<div {% include "block_settings/blocks_settings.html" %}> <div {% include "block_settings/blocks_settings.html" %}>
<div class="cut-width"> <div class="cut-width">
{% if block.url %} {% if block.url %}
<a href="{{ block.url }}"> <a class="a_block_present_technology" href="{{ block.url }}">
<div class="content_block_present_technology"> {% include 'widgets/w_technology_item.html' %}
<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> </a>
{% else %} {% else %}
<div class="content_block_present_technology"> {% include 'widgets/w_technology_item.html' %}
<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>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@@ -1,5 +1,5 @@
{% if widget.but_title %} {% 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 }} {{ widget.but_title }}
</a> </a>
{% endif %} {% 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>