Compare commits

...

16 Commits

Author SHA1 Message Date
SDE
7c5ebdcfbf 0.5.28 hide support button 2024-08-03 16:18:37 +03:00
SDE
7560354677 0.5.27 check translate for support 2024-07-25 20:04:59 +03:00
SDE
2dddcab2f2 0.5.26 docs admin add actions for assign version to docs list 2024-07-20 13:42:46 +03:00
SDE
3a4f9e5606 0.5.25 change settings for files 2024-07-19 11:57:43 +03:00
SDE
35f03282af 0.5.24 change settings 2024-07-19 04:21:44 +03:00
SDE
42b9925e60 0.5.23 fix pdf font 2024-07-19 01:32:12 +03:00
SDE
772db778b7 0.5.23 fix get_options_by_opt_types 2024-07-19 01:28:50 +03:00
SDE
1583da5816 0.5.22 fix get_options_by_opt_types 2024-07-19 01:26:24 +03:00
SDE
8e12c7e515 0.5.21 fix get_options_by_opt_types 2024-07-19 01:24:18 +03:00
SDE
be06cb0ef9 0.5.21 fix CKEDITOR_RESTRICT_BY_USER 2024-07-19 01:11:23 +03:00
SDE
4053d17981 0.5.20 fix encodings 2024-07-19 01:03:31 +03:00
SBD
7a95c5c3ef documentation page 2024-07-18 14:18:42 +03:00
SBD
c573d29eb1 documentation page 2024-07-18 14:03:05 +03:00
SBD
f2c3ffe87b documentation page 2024-07-18 13:46:19 +03:00
SBD
a28ebd1958 Merge remote-tracking branch 'origin/main' 2024-07-18 13:39:09 +03:00
SBD
97330ad8e5 documentation page 2024-07-18 13:37:41 +03:00
9 changed files with 111 additions and 28 deletions

View File

@@ -7,6 +7,7 @@ from django.utils.translation import gettext as _
from django import forms
from django.utils.text import slugify
from django.db.models import Min
from django.contrib import messages
class DocArtForm(forms.ModelForm):
@@ -19,6 +20,26 @@ class DocArtForm(forms.ModelForm):
self.fields['parent'].queryset = DocArt.objects.exclude(id__exact=self.instance.id)
def make_assign_versions_action(version):
def assign_to_version(modeladmin, request, queryset):
for art in queryset:
if version not in art.versions.all():
art.versions.add(version) # Method on Order model
messages.info(request, f"Статье {art} назначена версия {version.name}")
assign_to_version.short_description = _(f"Назначить версию {version.name}")
# We need a different '__name__' for each action - Django
# uses this as a key in the drop-down box.
assign_to_version.__name__ = _(f"Назначить версию {version.name}")
return assign_to_version
class Admin_DocArt(SuperModelAdmin, Admin_Trans_BaseModelViewPage):
form = DocArtForm
@@ -93,6 +114,20 @@ class Admin_DocArt(SuperModelAdmin, Admin_Trans_BaseModelViewPage):
# inlines = [Admin_StackedInline_Block]
actions = ["create_copy_arts"]
def get_actions(self, request):
actions = super(Admin_DocArt, self).get_actions(request)
versions = DocVersion.objects.filter(enable=True)
for version in versions:
action = make_assign_versions_action(version)
actions[action.__name__] = (action,
action.__name__,
action.short_description)
return actions
@admin.action(description=_("Создать копии выбранных статей"))
def create_copy_arts(self, request, queryset):
from BaseModels.functions import create_url

View File

@@ -11,10 +11,14 @@ def get_options_by_opt_types(opt_types, only_vals=False, w_prefix=False):
opts = Option.objects.filter(**kwargs)
if opts and only_vals:
opts = opts.values('opt_type', 'value', 'prefix')
if w_prefix:
opts = {item['opt_type']: f"{item['prefix']}{item['value']}" for item in opts}
else:
opts = {item['opt_type']: item['value'] for item in opts}
res_Dict = {}
for item in opts:
val = item['value']
if w_prefix and item['prefix']:
val = item['prefix'] + val
res_Dict.update({item['opt_type']: val})
return res_Dict
return opts
def get_first_option_value_by_opt_type(opt_type):

View File

@@ -200,6 +200,10 @@ LANG_INFO = dict(django.conf.locale.LANG_INFO.items()) #+ EXTRA_LANG_INFO.items(
django.conf.locale.LANG_INFO = LANG_INFO
from filebrowser.sites import site
site.directory = ""
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
@@ -210,7 +214,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/"
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_RESTRICT_BY_DATE = False
CKEDITOR_RESTRICT_BY_USER = True
CKEDITOR_RESTRICT_BY_USER = False
CKEDITOR_BROWSE_SHOW_DIRS = True
CKEDITOR_IMAGE_BACKEND = "pillow"

View File

@@ -1690,7 +1690,7 @@ body.n_scroll{
.documentation_version{
display: flex;
align-items: center;
margin-bottom: 40px;
margin-bottom: 30px;
}
.documentation_version_switcher{

View File

@@ -22,6 +22,9 @@
}
@media (max-width: 1024px) {
.one_item_documentation_switcher_content_part{
font-size: 12px;
}
.cur_documentation_version{
font-size: 12px;
}

View File

@@ -510,22 +510,28 @@ function transitToDocumentation() {
window.location.href = window.location.origin + '/' + getLang() + '/docs/3dsd/'
}
function openVersionSwitcher(el){
let $parent = el.closest(".documentation_version_switcher")
let $content_part = $parent.querySelector(".documentation_switcher_content_part")
let $arrow = $parent.querySelector(".documentation_switcher_arrow_picture")
$content_part.classList.toggle("hidden")
if ($arrow.style.rotate === '0deg' || $arrow.style.rotate === '') {
$($arrow).css({rotate: '180deg'})
let height = $content_part.offsetHeight
$content_part.style.bottom = '-' + height + "px"
$parent.style.borderBottom = '1px solid #fff'
} else {
$($arrow).css({rotate: '0deg'})
$parent.style.borderBottom = '1px solid #CCCED1FF'
}
let switcherWorking = false
$("body")[0].setAttribute("onclick",'closeVersionSwitcherOnBody()')
function openVersionSwitcher(el){
if (!switcherWorking){
switcherWorking = true
let $parent = el.closest(".documentation_version_switcher")
let $content_part = $parent.querySelector(".documentation_switcher_content_part")
let $arrow = $parent.querySelector(".documentation_switcher_arrow_picture")
$content_part.classList.toggle("hidden")
if ($arrow.style.rotate === '0deg' || $arrow.style.rotate === '') {
$($arrow).css({rotate: '180deg'})
let height = $content_part.offsetHeight
$content_part.style.bottom = '-' + height + "px"
$parent.style.borderBottom = '1px solid #fff'
$("body")[0].setAttribute("onclick",'closeVersionSwitcherOnBody()')
} else {
$($arrow).css({rotate: '0deg'})
$parent.style.borderBottom = '1px solid #CCCED1FF'
$("body")[0].setAttribute("onclick",'')
}
switcherWorking = false
}
}
function closeVersionSwitcherOnBody () {
@@ -536,9 +542,19 @@ function closeVersionSwitcherOnBody () {
$(".documentation_version_switcher").css({borderBottom: '1px solid #CCCED1FF'})
if ($arrow.style.rotate !== '180deg'){
$($arrow).css({rotate: '180deg'})
} else {
$($arrow).css({rotate: '0deg'})
}
if ($('.documentation_switcher_arrow_picture')[1]){
let arrow1 = $('.documentation_switcher_arrow_picture')[1]
if (arrow1.style.rotate !== '180deg'){
$(arrow1).css({rotate: '180deg'})
} else {
$(arrow1).css({rotate: '0deg'})
}
}
$("body")[0].setAttribute("onclick",'')
}
}
@@ -586,9 +602,11 @@ function showContentPartTree (el) {
$($arrow).css({rotate: '0deg'})
}
let scroll = $(window)[0].scrollY
$($(".left_curtain_documentation")[1]).find(".tree_documentation_container").css({height: 'fit-content'})
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[1].offsetHeight - 172
$($(".left_curtain_documentation")[1]).find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
if ($(".left_curtain_documentation")[1]) {
$($(".left_curtain_documentation")[1]).find(".tree_documentation_container").css({height: 'fit-content'})
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[1].offsetHeight - 172
$($(".left_curtain_documentation")[1]).find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
}
}
let waitingTop = null
let maxScroll = null
@@ -602,6 +620,9 @@ function windowScrollDocPage (){
waitingTop = $(".left_curtain_documentation")[0].getBoundingClientRect().top - 172
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'fit-content'})
maxScroll = $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
if (scroll !== 0){
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
}
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
}
let $new_curtain = $($curtain[1])
@@ -618,6 +639,7 @@ function windowScrollDocPage (){
$($curtain[0]).css({opacity:0})
$($curtain[0]).find(".tree_documentation_container").css({display:'none'})
} else if (scroll < waitingTop && waitingTop) {
$curtain.find(".tree_documentation_container")[0].innerHTML = $new_curtain.find(".tree_documentation_container")[0].innerHTML
$new_curtain.remove()
$($curtain[0]).css({opacity:1})
$($curtain[0]).find(".tree_documentation_container").css({display:'block'})
@@ -625,6 +647,9 @@ function windowScrollDocPage (){
waitingTop = $(".left_curtain_documentation")[0].getBoundingClientRect().top - 172
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'fit-content'})
maxScroll = $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
if (scroll !== 0){
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
}
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
}
} else {
@@ -650,6 +675,9 @@ $(window).scroll(function (){
waitingTop = $(".left_curtain_documentation")[0].getBoundingClientRect().top - 172
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'fit-content'})
maxScroll = $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
if (scroll !== 0){
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
}
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
}
let $new_curtain = $($curtain[1])
@@ -674,6 +702,9 @@ $(window).scroll(function (){
waitingTop = $(".left_curtain_documentation")[0].getBoundingClientRect().top - 172
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'fit-content'})
maxScroll = $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
if (scroll !== 0){
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
}
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
}
} else {

View File

@@ -30,7 +30,7 @@
</div>
<div class="container_els_curtain">
{# <a class="txt_curtain_el standart_txt">{% translate "Поддержка" %}</a>#}
<a href="{% url 'docs_main' %}" class="txt_curtain_el standart_txt">{% translate "Поддержка" %}</a>
{# <a href="{% url 'docs_main' %}" class="txt_curtain_el standart_txt">{% translate "Поддержка" %}</a>#}
<a href="{% url 'contacts' %}" class="txt_curtain_el standart_txt">{% translate "Контакты" %}</a>
</div>

View File

@@ -4,8 +4,14 @@
{% if pdf_render %}
<HEAD>
<meta charset="windows-1251">
{# <meta charset="UTF-8">#}
{# <meta charset="windows-1251">#}
<meta charset="UTF-8">
{% include 'head_includes/fonts_include.html' %}
<style>
* {
font-family: -apple-system, 'Roboto', sans-serif;
}
</style>
</HEAD>
{% endif %}

View File

@@ -11,7 +11,7 @@
<div class="right_part_header">
{# <a class="standart_txt text_header pointer">Поддержка</a>#}
{% if allow_documentation %}
<a href="{% url 'docs_main' %}" class="standart_txt text_header last_left pointer">{% translate "Поддержка" %}</a>
{# <a href="{% url 'docs_main' %}" class="standart_txt text_header last_left pointer">{% trans "Поддержка" %}</a>#}
{% endif %}
<a href="{% url 'contacts' %}" class="standart_txt text_header last_left pointer">{% translate "Контакты" %}</a>
<div class="splitter_text_header"></div>