Compare commits
16 Commits
2a900c2726
...
merge_dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c5ebdcfbf | |||
| 7560354677 | |||
| 2dddcab2f2 | |||
| 3a4f9e5606 | |||
| 35f03282af | |||
| 42b9925e60 | |||
| 772db778b7 | |||
| 1583da5816 | |||
| 8e12c7e515 | |||
| be06cb0ef9 | |||
| 4053d17981 | |||
| 7a95c5c3ef | |||
| c573d29eb1 | |||
| f2c3ffe87b | |||
| a28ebd1958 | |||
| 97330ad8e5 |
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1690,7 +1690,7 @@ body.n_scroll{
|
||||
.documentation_version{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 40px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.documentation_version_switcher{
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.one_item_documentation_switcher_content_part{
|
||||
font-size: 12px;
|
||||
}
|
||||
.cur_documentation_version{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user