django-smartbase-admin 0.2.47__py3-none-any.whl → 1.0.38__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_smartbase_admin/actions/admin_action_list.py +80 -51
- django_smartbase_admin/actions/advanced_filters.py +55 -20
- django_smartbase_admin/admin/admin_base.py +477 -89
- django_smartbase_admin/admin/site.py +104 -34
- django_smartbase_admin/admin/widgets.py +598 -26
- django_smartbase_admin/apps.py +2 -0
- django_smartbase_admin/engine/actions.py +34 -16
- django_smartbase_admin/engine/admin_base_view.py +253 -115
- django_smartbase_admin/engine/configuration.py +186 -4
- django_smartbase_admin/engine/const.py +7 -0
- django_smartbase_admin/engine/dashboard.py +44 -23
- django_smartbase_admin/engine/fake_inline.py +44 -7
- django_smartbase_admin/engine/field.py +54 -10
- django_smartbase_admin/engine/field_formatter.py +32 -9
- django_smartbase_admin/engine/filter_widgets.py +356 -21
- django_smartbase_admin/engine/menu_item.py +8 -5
- django_smartbase_admin/engine/modal_view.py +12 -7
- django_smartbase_admin/engine/request.py +2 -0
- django_smartbase_admin/integration/__init__.py +0 -0
- django_smartbase_admin/integration/django_cms.py +43 -0
- django_smartbase_admin/locale/sk/LC_MESSAGES/django.mo +0 -0
- django_smartbase_admin/locale/sk/LC_MESSAGES/django.po +268 -37
- django_smartbase_admin/migrations/0005_sbadminuserconfiguration.py +26 -0
- django_smartbase_admin/migrations/0006_alter_sbadminuserconfiguration_color_scheme.py +18 -0
- django_smartbase_admin/models.py +22 -0
- django_smartbase_admin/monkeypatch/admin_readonly_field_monkeypatch.py +96 -0
- django_smartbase_admin/monkeypatch/fake_inline_monkeypatch.py +1 -1
- django_smartbase_admin/querysets.py +3 -0
- django_smartbase_admin/services/configuration.py +30 -0
- django_smartbase_admin/services/thread_local.py +6 -19
- django_smartbase_admin/services/views.py +82 -27
- django_smartbase_admin/services/xlsx_export.py +6 -0
- django_smartbase_admin/static/sb_admin/build/tailwind.config.js +1 -0
- django_smartbase_admin/static/sb_admin/build/tailwind_config_partials/colors.js +4 -0
- django_smartbase_admin/static/sb_admin/build/tailwind_config_partials/spacing.js +1 -0
- django_smartbase_admin/static/sb_admin/build/webpack.common.js +11 -8
- django_smartbase_admin/static/sb_admin/css/ckeditor/ckeditor_content_dark.css +208 -0
- django_smartbase_admin/static/sb_admin/css/coloris/coloris.min.css +1 -0
- django_smartbase_admin/static/sb_admin/dist/calendar.js +1 -0
- django_smartbase_admin/static/sb_admin/dist/calendar_style.css +1 -0
- django_smartbase_admin/static/sb_admin/dist/calendar_style.js +0 -0
- django_smartbase_admin/static/sb_admin/dist/chart.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/main.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/main_style.css +1 -1
- django_smartbase_admin/static/sb_admin/dist/table.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/table.js.LICENSE.txt +9 -0
- django_smartbase_admin/static/sb_admin/dist/tree_widget.js +1 -0
- django_smartbase_admin/static/sb_admin/dist/tree_widget_style.css +1 -0
- django_smartbase_admin/static/sb_admin/dist/tree_widget_style.js +0 -0
- django_smartbase_admin/static/sb_admin/fancytree/jquery.fancytree-all-deps.min.js +1 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-csv.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-doc.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-docx.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-other.svg +13 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-pdf.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-ppt.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-xls.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-xlsx.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-zip.svg +18 -0
- django_smartbase_admin/static/sb_admin/images/flags/de-at.png +0 -0
- django_smartbase_admin/static/sb_admin/images/flags/de-ch.png +0 -0
- django_smartbase_admin/static/sb_admin/images/logo_light.svg +21 -0
- django_smartbase_admin/static/sb_admin/js/coloris/coloris.min.js +6 -0
- django_smartbase_admin/static/sb_admin/js/fullcalendar.min.js +14804 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Bolt-one.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Calendar.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Caution.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Electric-drill.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Fire-extinguisher.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Gas.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Lightning-fill.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Moon.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Phone-telephone.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Printer.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Pull.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Sun-one.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Time.svg +3 -0
- django_smartbase_admin/static/sb_admin/src/css/_base.css +5 -1
- django_smartbase_admin/static/sb_admin/src/css/_colors.css +257 -82
- django_smartbase_admin/static/sb_admin/src/css/_components.css +66 -13
- django_smartbase_admin/static/sb_admin/src/css/_datepicker.css +8 -1
- django_smartbase_admin/static/sb_admin/src/css/_filer.css +60 -0
- django_smartbase_admin/static/sb_admin/src/css/_inlines.css +51 -10
- django_smartbase_admin/static/sb_admin/src/css/_tabulator.css +8 -2
- django_smartbase_admin/static/sb_admin/src/css/calendar.css +162 -0
- django_smartbase_admin/static/sb_admin/src/css/components/_button.css +41 -1
- django_smartbase_admin/static/sb_admin/src/css/components/_dropdown.css +26 -8
- django_smartbase_admin/static/sb_admin/src/css/components/_input.css +62 -20
- django_smartbase_admin/static/sb_admin/src/css/components/_modal.css +1 -1
- django_smartbase_admin/static/sb_admin/src/css/components/_query-builder.css +21 -2
- django_smartbase_admin/static/sb_admin/src/css/components/_toggle.css +12 -1
- django_smartbase_admin/static/sb_admin/src/css/components/_tooltip.css +8 -22
- django_smartbase_admin/static/sb_admin/src/css/style.css +17 -0
- django_smartbase_admin/static/sb_admin/src/css/tree_widget.css +411 -0
- django_smartbase_admin/static/sb_admin/src/js/autocomplete.js +63 -5
- django_smartbase_admin/static/sb_admin/src/js/calendar.js +56 -0
- django_smartbase_admin/static/sb_admin/src/js/chart.js +8 -22
- django_smartbase_admin/static/sb_admin/src/js/choices.js +18 -8
- django_smartbase_admin/static/sb_admin/src/js/datepicker.js +97 -336
- django_smartbase_admin/static/sb_admin/src/js/datepicker_plugins.js +357 -0
- django_smartbase_admin/static/sb_admin/src/js/main.js +307 -26
- django_smartbase_admin/static/sb_admin/src/js/multiselect.js +50 -41
- django_smartbase_admin/static/sb_admin/src/js/range.js +3 -2
- django_smartbase_admin/static/sb_admin/src/js/sb_ajax_params_tabulator_modifier.js +21 -0
- django_smartbase_admin/static/sb_admin/src/js/table.js +38 -13
- django_smartbase_admin/static/sb_admin/src/js/table_modules/advanced_filter_module.js +43 -20
- django_smartbase_admin/static/sb_admin/src/js/table_modules/data_edit_module.js +8 -10
- django_smartbase_admin/static/sb_admin/src/js/table_modules/filter_module.js +3 -3
- django_smartbase_admin/static/sb_admin/src/js/table_modules/header_tabs_module.js +11 -11
- django_smartbase_admin/static/sb_admin/src/js/table_modules/selection_module.js +28 -8
- django_smartbase_admin/static/sb_admin/src/js/table_modules/table_params_module.js +6 -0
- django_smartbase_admin/static/sb_admin/src/js/table_modules/views_module.js +19 -3
- django_smartbase_admin/static/sb_admin/src/js/tree_widget.js +406 -0
- django_smartbase_admin/static/sb_admin/src/js/utils.js +56 -21
- django_smartbase_admin/templates/sb_admin/actions/change_form.html +169 -117
- django_smartbase_admin/templates/sb_admin/actions/dashboard.html +2 -2
- django_smartbase_admin/templates/sb_admin/actions/delete_selected_confirmation.html +56 -32
- django_smartbase_admin/templates/sb_admin/actions/list.html +79 -42
- django_smartbase_admin/templates/sb_admin/actions/object_history.html +2 -2
- django_smartbase_admin/templates/sb_admin/actions/partials/action_link.html +14 -0
- django_smartbase_admin/templates/sb_admin/actions/partials/selected_rows_actions.html +2 -2
- django_smartbase_admin/templates/sb_admin/actions/partials/tabulator_header_v2.html +2 -2
- django_smartbase_admin/templates/sb_admin/actions/tree_list.html +63 -0
- django_smartbase_admin/templates/sb_admin/authentification/login_base.html +5 -1
- django_smartbase_admin/templates/sb_admin/components/columns.html +1 -1
- django_smartbase_admin/templates/sb_admin/components/filters_v2.html +99 -85
- django_smartbase_admin/templates/sb_admin/config/view.html +0 -1
- django_smartbase_admin/templates/sb_admin/dashboard/calendar_widget.html +69 -0
- django_smartbase_admin/templates/sb_admin/dashboard/chart_widget.html +21 -2
- django_smartbase_admin/templates/sb_admin/dashboard/list_widget.html +6 -0
- django_smartbase_admin/templates/sb_admin/dashboard/widget_base.html +1 -1
- django_smartbase_admin/templates/sb_admin/filter_widgets/advanced_filters/date_field.html +18 -8
- django_smartbase_admin/templates/sb_admin/filter_widgets/advanced_filters/multiple_choice_field.html +1 -1
- django_smartbase_admin/templates/sb_admin/filter_widgets/advanced_filters/tree_select_filter.html +2 -0
- django_smartbase_admin/templates/sb_admin/filter_widgets/date_field.html +18 -4
- django_smartbase_admin/templates/sb_admin/filter_widgets/multiple_choice_field.html +14 -0
- django_smartbase_admin/templates/sb_admin/filter_widgets/partials/clear.html +10 -5
- django_smartbase_admin/templates/sb_admin/filter_widgets/radio_choice_field.html +2 -2
- django_smartbase_admin/templates/sb_admin/filter_widgets/tree_select_filter.html +16 -0
- django_smartbase_admin/templates/sb_admin/includes/change_form_title.html +3 -1
- django_smartbase_admin/templates/sb_admin/includes/components.html +5 -1
- django_smartbase_admin/templates/sb_admin/includes/inline_fieldset.html +48 -39
- django_smartbase_admin/templates/sb_admin/includes/notifications.html +2 -1
- django_smartbase_admin/templates/sb_admin/includes/readonly_boolean_field.html +9 -0
- django_smartbase_admin/templates/sb_admin/includes/readonly_field.html +12 -0
- django_smartbase_admin/templates/sb_admin/includes/table_inline_delete_button.html +4 -5
- django_smartbase_admin/templates/sb_admin/inlines/stacked_inline.html +68 -40
- django_smartbase_admin/templates/sb_admin/inlines/table_inline.html +78 -36
- django_smartbase_admin/templates/sb_admin/integrations/filer/folder_list.html +18 -0
- django_smartbase_admin/templates/sb_admin/navigation.html +166 -158
- django_smartbase_admin/templates/sb_admin/partials/modal/modal_content.html +2 -6
- django_smartbase_admin/templates/sb_admin/sb_admin_base.html +49 -4
- django_smartbase_admin/templates/sb_admin/sb_admin_base_no_sidebar.html +35 -11
- django_smartbase_admin/templates/sb_admin/sb_admin_js_trans.html +3 -0
- django_smartbase_admin/templates/sb_admin/sprites/sb_admin.svg +1 -1
- django_smartbase_admin/templates/sb_admin/tailwind_whitelist.html +6 -3
- django_smartbase_admin/templates/sb_admin/widgets/array.html +0 -1
- django_smartbase_admin/templates/sb_admin/widgets/attributes.html +68 -0
- django_smartbase_admin/templates/sb_admin/widgets/autocomplete.html +13 -2
- django_smartbase_admin/templates/sb_admin/widgets/{checkbox_select.html → checkbox_dropdown.html} +2 -2
- django_smartbase_admin/templates/sb_admin/widgets/checkbox_group.html +15 -0
- django_smartbase_admin/templates/sb_admin/widgets/clearable_file_input.html +2 -2
- django_smartbase_admin/templates/sb_admin/widgets/color_field.html +30 -0
- django_smartbase_admin/templates/sb_admin/widgets/date.html +8 -1
- django_smartbase_admin/templates/sb_admin/widgets/filer_file.html +84 -0
- django_smartbase_admin/templates/sb_admin/widgets/html_read_only.html +1 -0
- django_smartbase_admin/templates/sb_admin/widgets/includes/related_item_buttons.html +38 -0
- django_smartbase_admin/templates/sb_admin/widgets/multiwidget.html +1 -1
- django_smartbase_admin/templates/sb_admin/widgets/radio.html +3 -2
- django_smartbase_admin/templates/sb_admin/widgets/radio_dropdown.html +30 -0
- django_smartbase_admin/templates/sb_admin/widgets/read_only_password_hash.html +3 -0
- django_smartbase_admin/templates/sb_admin/widgets/time.html +8 -1
- django_smartbase_admin/templates/sb_admin/widgets/toggle.html +1 -1
- django_smartbase_admin/templates/sb_admin/widgets/tree_base.html +59 -0
- django_smartbase_admin/templates/sb_admin/widgets/tree_select.html +24 -0
- django_smartbase_admin/templates/sb_admin/widgets/tree_select_inline.html +12 -0
- django_smartbase_admin/templatetags/sb_admin_tags.py +163 -4
- django_smartbase_admin/utils.py +22 -3
- django_smartbase_admin/views/dashboard_view.py +6 -0
- django_smartbase_admin/views/global_filter_view.py +8 -2
- django_smartbase_admin/views/translations_view.py +12 -5
- django_smartbase_admin/views/user_config_view.py +52 -0
- django_smartbase_admin-1.0.38.dist-info/METADATA +166 -0
- {django_smartbase_admin-0.2.47.dist-info → django_smartbase_admin-1.0.38.dist-info}/RECORD +186 -121
- {django_smartbase_admin-0.2.47.dist-info → django_smartbase_admin-1.0.38.dist-info}/WHEEL +1 -1
- django_smartbase_admin/templates/sb_admin/integrations/sorting/change_list.html +0 -401
- django_smartbase_admin-0.2.47.dist-info/METADATA +0 -25
- {django_smartbase_admin-0.2.47.dist-info → django_smartbase_admin-1.0.38.dist-info}/LICENSE.md +0 -0
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
{% extends list_base_template|default:"sb_admin/actions/list.html" %}
|
|
2
|
-
{% load static i18n thumbnail admin_list smartshop_tags %}
|
|
3
|
-
|
|
4
|
-
{% block tabulator_custom_header %}
|
|
5
|
-
{% include 'sb_admin/components/filters.html' with filters=content_context.filters all_filters_visible=True %}
|
|
6
|
-
{% endblock %}
|
|
7
|
-
{% block tabulator_body %}
|
|
8
|
-
{{ block.super }}
|
|
9
|
-
{% if category_id and alias_id %}
|
|
10
|
-
<div id="sortable-items" class="flex flex-wrap pt-10 pl-10">
|
|
11
|
-
{% for item in data.data %}
|
|
12
|
-
{% block promo_card %}
|
|
13
|
-
{% if promo_cards and forloop.counter in promo_cards %}
|
|
14
|
-
{% for promo_card in promo_cards|get_attr_from_dict:forloop.counter %}
|
|
15
|
-
<div class="item-card-wrapper border-2 border-solid border-black mr-10 mb-10"
|
|
16
|
-
data-group-key="null"
|
|
17
|
-
data-order="-{{ promo_card.id }}"
|
|
18
|
-
style="{{ promo_card.styles }}">
|
|
19
|
-
<div class="promo-card item">
|
|
20
|
-
{{ promo_card.id }} - {{ promo_card.name }}
|
|
21
|
-
P: <span class="counter"></span><br>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
{% endfor %}
|
|
25
|
-
{% endif %}
|
|
26
|
-
{% endblock %}
|
|
27
|
-
{% block item %}
|
|
28
|
-
<div class="item-wrapper visible cursor-pointer border-2 border-solid border-black mr-10 mb-10" data-group-key="{{ item.group_by_catalog_value }}"
|
|
29
|
-
data-order="{{ item.product_category_order_by }}" data-simple-order="{{ forloop.counter }}">
|
|
30
|
-
<div class="item">
|
|
31
|
-
<img height="76" width="57" class="lazyload" src="{{ LAZY_LOAD_DEFAULT_IMAGE }}" data-src="{% thumbnail item.product_image '76x57' crop=True replace_alpha='#fff' %}" alt="">
|
|
32
|
-
{% block sorting_product_attributes %}
|
|
33
|
-
P: <span class="counter"></span><input type="checkbox" class="ml-10" name="item-selection" value="{{ item.product_category_order_by }}"><br>
|
|
34
|
-
{{ item.product_name }}<br>
|
|
35
|
-
{{ item.sorting_identifier|default_if_none:'' }}<br>
|
|
36
|
-
{% endblock %}
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
{% endblock %}
|
|
40
|
-
{% endfor %}
|
|
41
|
-
</div>
|
|
42
|
-
{% else %}
|
|
43
|
-
<div class="flex-center m-10 mb-30 text-dark-900 text-20">
|
|
44
|
-
{% trans "Please select a category and domain(in bottom left corner) to sort." %}
|
|
45
|
-
</div>
|
|
46
|
-
{% endif %}
|
|
47
|
-
{% endblock %}
|
|
48
|
-
|
|
49
|
-
{% block content %}
|
|
50
|
-
{{ block.super }}
|
|
51
|
-
<div class="detail-view-action-bar hidden">
|
|
52
|
-
<div>
|
|
53
|
-
<h2 class="text-dark-900 font-semibold text-18 mr-16 line-clamp-1">
|
|
54
|
-
{% trans 'Operations' %}
|
|
55
|
-
</h2>
|
|
56
|
-
<div id="sorting-controls" class="flex ml-auto gap-8 items-end">
|
|
57
|
-
<button type="button" id="to_first" class="btn btn-secondary">{% trans 'Move to first' %}</button>
|
|
58
|
-
<div>
|
|
59
|
-
<input type="number" placeholder="{% trans 'Position' %}" name="position" class="input" id="position">
|
|
60
|
-
</div>
|
|
61
|
-
<button type="button" id="to_position" class="btn btn-secondary">{% trans 'Set' %}</button>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
{% endblock %}
|
|
66
|
-
|
|
67
|
-
{% block style_init %}
|
|
68
|
-
<style>
|
|
69
|
-
.tabulator, .tabulator-custom-footer {
|
|
70
|
-
display: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.sortable-selected .item {
|
|
74
|
-
border: 1px solid rgba(27, 33, 255, 0.5) !important;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
#sortable-items {
|
|
78
|
-
height: calc(100vh - 365px);
|
|
79
|
-
overflow: auto;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
#sortable-items .item {
|
|
83
|
-
padding: 10px;
|
|
84
|
-
display: none;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
#sortable-items .item-card-wrapper .item {
|
|
88
|
-
display: block;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
#sortable-items .item-wrapper {
|
|
92
|
-
width: calc(12.5% - 14px) !important;
|
|
93
|
-
height: 130px;
|
|
94
|
-
position: relative;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
#sortable-items .item-wrapper.visible .item {
|
|
98
|
-
display: block;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
#sortable-items .item-wrapper.visible .item img {
|
|
102
|
-
padding-right: 5px;
|
|
103
|
-
float: left;
|
|
104
|
-
width: auto;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
#sortable-items .item-wrapper.page-end::after {
|
|
108
|
-
content: " ";
|
|
109
|
-
position: absolute;
|
|
110
|
-
display: block;
|
|
111
|
-
height: 100%;
|
|
112
|
-
width: 10px;
|
|
113
|
-
background: red;
|
|
114
|
-
margin-left: 100%;
|
|
115
|
-
top: 0;
|
|
116
|
-
right: -10px;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
#clipboard {
|
|
120
|
-
display: flex;
|
|
121
|
-
flex-wrap: wrap;
|
|
122
|
-
width: 100%;
|
|
123
|
-
height: 30px;
|
|
124
|
-
border: 1px solid red;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
#clipboard .product-name {
|
|
128
|
-
display: none;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
#clipboard img {
|
|
132
|
-
height: 30px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.paginator .item-wrapper {
|
|
136
|
-
display: none;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
#reorder-overlay {
|
|
140
|
-
background: #ffffff8f;
|
|
141
|
-
position: absolute;
|
|
142
|
-
top: 0;
|
|
143
|
-
left: 0;
|
|
144
|
-
right: 0;
|
|
145
|
-
bottom: 0;
|
|
146
|
-
z-index: 9999;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
#reorder-overlay:after {
|
|
150
|
-
content: '{% trans 'Reordering please wait' %}';
|
|
151
|
-
position: absolute;
|
|
152
|
-
top: 50%;
|
|
153
|
-
left: 50%;
|
|
154
|
-
transform: translate(-50%, -50%);
|
|
155
|
-
font-size: 32px;
|
|
156
|
-
font-weight: bold;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
form input[type=checkbox] {
|
|
160
|
-
width: 18px !important;
|
|
161
|
-
cursor: pointer;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
html, body {
|
|
165
|
-
overflow: auto;
|
|
166
|
-
}
|
|
167
|
-
</style>
|
|
168
|
-
{% endblock %}
|
|
169
|
-
|
|
170
|
-
{% block additional_js %}
|
|
171
|
-
{{ block.super }}
|
|
172
|
-
<script>
|
|
173
|
-
document.addEventListener('SBAdminTableNewURL', () => {
|
|
174
|
-
setTimeout(() => {
|
|
175
|
-
window.location.reload()
|
|
176
|
-
}, 1)
|
|
177
|
-
})
|
|
178
|
-
</script>
|
|
179
|
-
<script src="{% static 'components/tiles/js/lodash.min.js' %}"></script>
|
|
180
|
-
<script src="{% static 'js/sortable.min.js' %}"></script>
|
|
181
|
-
<script src="{% static 'sb_admin/js/lazysizes.min.js' %}"></script>
|
|
182
|
-
<script>
|
|
183
|
-
const mainSorting = () => {
|
|
184
|
-
const requestQueue = [];
|
|
185
|
-
const perPage = {{ content_context.tabulator_definition.tableInitialPageSize }};
|
|
186
|
-
const reorderUrl = '{{ reorder_url }}';
|
|
187
|
-
const pageSize = 24;
|
|
188
|
-
const numberingFrom = 0;
|
|
189
|
-
const overlayId = 'reorder-overlay';
|
|
190
|
-
let overlayEl = document.createElement('div');
|
|
191
|
-
overlayEl.setAttribute("id", overlayId);
|
|
192
|
-
let isRequested = false;
|
|
193
|
-
|
|
194
|
-
function toggleActionbar() {
|
|
195
|
-
const lenChecked = document.querySelectorAll('[name="item-selection"]:checked').length;
|
|
196
|
-
if (lenChecked > 0) {
|
|
197
|
-
document.querySelector('.detail-view-action-bar').classList.remove('hidden')
|
|
198
|
-
} else {
|
|
199
|
-
document.querySelector('.detail-view-action-bar').classList.add('hidden')
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
document.querySelectorAll('[name="item-selection"]').forEach(el => {
|
|
204
|
-
el.addEventListener('change', (e) => {
|
|
205
|
-
toggleActionbar();
|
|
206
|
-
})
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
function processQueue() {
|
|
210
|
-
if (!isRequested) {
|
|
211
|
-
const formData = requestQueue.shift();
|
|
212
|
-
if (!formData) {
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
isRequested = true;
|
|
216
|
-
fetch('', {
|
|
217
|
-
method: 'POST',
|
|
218
|
-
body: formData,
|
|
219
|
-
redirect: "manual"
|
|
220
|
-
}).then(response => {
|
|
221
|
-
return response;
|
|
222
|
-
}).then((response) => {
|
|
223
|
-
if (response.type === "opaqueredirect") {
|
|
224
|
-
addOverlay();
|
|
225
|
-
requestReorder().then((response) => {
|
|
226
|
-
requestQueue.unshift(formData);
|
|
227
|
-
isRequested = false;
|
|
228
|
-
processQueue();
|
|
229
|
-
removeOverlay();
|
|
230
|
-
}).catch((err) => {
|
|
231
|
-
window.location = response.url
|
|
232
|
-
})
|
|
233
|
-
} else {
|
|
234
|
-
isRequested = false;
|
|
235
|
-
processQueue();
|
|
236
|
-
}
|
|
237
|
-
}).catch(error => {
|
|
238
|
-
console.log(error)
|
|
239
|
-
}).finally(() => {
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function callApi(group_keys, prev_group_key, position) {
|
|
245
|
-
const formData = new FormData();
|
|
246
|
-
const promoCardsIndexed = getPromoCardIndexes();
|
|
247
|
-
changeOrders();
|
|
248
|
-
formData.append('csrfmiddlewaretoken', '{{ csrf_token }}');
|
|
249
|
-
formData.append('promo_cards_indexes', JSON.stringify(promoCardsIndexed));
|
|
250
|
-
group_keys.forEach(item => {
|
|
251
|
-
if (item) {
|
|
252
|
-
formData.append('group_keys[]', item);
|
|
253
|
-
}
|
|
254
|
-
})
|
|
255
|
-
if (prev_group_key) {
|
|
256
|
-
formData.append('prev_group_key', prev_group_key);
|
|
257
|
-
}
|
|
258
|
-
if (position) {
|
|
259
|
-
formData.append('position', position);
|
|
260
|
-
}
|
|
261
|
-
requestQueue.push(formData);
|
|
262
|
-
processQueue();
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function moveSelectedToAbsolutePosition(position) {
|
|
266
|
-
console.log(position)
|
|
267
|
-
let selectedItems = [];
|
|
268
|
-
let selectedItemsGroupKeys = [];
|
|
269
|
-
let selectedItemObjs = [];
|
|
270
|
-
let selectedItem = null;
|
|
271
|
-
|
|
272
|
-
document.querySelectorAll("input[name='item-selection']:checked").forEach(el => {
|
|
273
|
-
selectedItemObjs.push(el);
|
|
274
|
-
selectedItems.push(el.value);
|
|
275
|
-
selectedItemsGroupKeys.push(el.closest('.item-wrapper').dataset.groupKey);
|
|
276
|
-
el.checked = false;
|
|
277
|
-
})
|
|
278
|
-
toggleActionbar();
|
|
279
|
-
|
|
280
|
-
let order = window.sortable.toArray();
|
|
281
|
-
let orderWithoutSelected = order.filter(function (x) {
|
|
282
|
-
return selectedItems.indexOf(x) < 0;
|
|
283
|
-
});
|
|
284
|
-
let relativePositionOnPage = position - numberingFrom;
|
|
285
|
-
if (relativePositionOnPage < 0 || relativePositionOnPage > perPage) {
|
|
286
|
-
selectedItemObjs.forEach(elem => elem.closest('.item-wrapper').remove())
|
|
287
|
-
} else {
|
|
288
|
-
let newOrder = orderWithoutSelected.slice(0, relativePositionOnPage).concat(selectedItems.concat(orderWithoutSelected.slice(relativePositionOnPage)));
|
|
289
|
-
|
|
290
|
-
let oldAnimate = window.sortable.options.animation;
|
|
291
|
-
if (Math.abs(selectedItemObjs[0].closest('.item-wrapper').dataset.simpleOrder - position) > 40) {
|
|
292
|
-
/* disable animation if position difference is too large and animation becomes laggy */
|
|
293
|
-
window.sortable.options.animation = 0;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
window.sortable.sort(newOrder, true);
|
|
297
|
-
window.sortable.options.animation = oldAnimate;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
callApi(selectedItemsGroupKeys, null, position);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function getPromoCardIndexes() {
|
|
304
|
-
const order = window.sortable.toArray();
|
|
305
|
-
const promoCards = {};
|
|
306
|
-
order.forEach((element, index) => {
|
|
307
|
-
if (element < 0) {
|
|
308
|
-
promoCards[Math.abs(element)] = index + 1;
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
return promoCards;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function getPrevNotPromo(el) {
|
|
315
|
-
let prev = el.previousElementSibling;
|
|
316
|
-
while (prev && prev.dataset.order < 0) {
|
|
317
|
-
prev = prev.previousElementSibling;
|
|
318
|
-
}
|
|
319
|
-
return prev;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function requestReorder() {
|
|
323
|
-
return fetch(reorderUrl, {
|
|
324
|
-
method: 'GET',
|
|
325
|
-
})
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
function addOverlay() {
|
|
329
|
-
if (!document.getElementById(overlayId)) {
|
|
330
|
-
document.body.appendChild(overlayEl);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function removeOverlay() {
|
|
335
|
-
if (document.getElementById(overlayId)) {
|
|
336
|
-
document.body.removeChild(overlayEl);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function changeOrders() {
|
|
341
|
-
document.querySelectorAll('[data-order]').forEach((el, index) => {
|
|
342
|
-
el.querySelector('.counter').innerText = numberingFrom + index + 1;
|
|
343
|
-
});
|
|
344
|
-
markPageEnds();
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
function markPageEnds() {
|
|
348
|
-
document.querySelectorAll('.item-wrapper').forEach((el, index) => {
|
|
349
|
-
if ((index + 1) % pageSize === 0) {
|
|
350
|
-
el.classList.add('page-end');
|
|
351
|
-
} else if (el.classList.contains("page-end")) {
|
|
352
|
-
el.classList.remove("page-end")
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
document.getElementById('to_first').addEventListener('click', () => {
|
|
358
|
-
moveSelectedToAbsolutePosition(0);
|
|
359
|
-
});
|
|
360
|
-
document.getElementById('position').addEventListener('keypress', (event) => {
|
|
361
|
-
if (event.key === 'Enter') {
|
|
362
|
-
moveSelectedToAbsolutePosition(document.getElementById('position').value - 1);
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
document.getElementById('to_position').addEventListener('click', () => {
|
|
366
|
-
moveSelectedToAbsolutePosition(document.getElementById('position').value - 1);
|
|
367
|
-
});
|
|
368
|
-
let items = document.getElementById('sortable-items');
|
|
369
|
-
changeOrders();
|
|
370
|
-
window.sortable = Sortable.create(items, {
|
|
371
|
-
group: 'shared',
|
|
372
|
-
animation: 150,
|
|
373
|
-
selectedClass: "sortable-selected",
|
|
374
|
-
ghostClass: "sortable-ghost",
|
|
375
|
-
dragClass: "sortable-drag",
|
|
376
|
-
dataIdAttr: 'data-order',
|
|
377
|
-
scroll: true,
|
|
378
|
-
scrollSensitivity: 100,
|
|
379
|
-
bubbleScroll: true,
|
|
380
|
-
/* Called by any change to the list (add / update / remove) */
|
|
381
|
-
onSort: function (/**Event*/evt) {
|
|
382
|
-
console.log(evt)
|
|
383
|
-
const prev = getPrevNotPromo(evt.item);
|
|
384
|
-
callApi(
|
|
385
|
-
[evt.item.dataset.groupKey],
|
|
386
|
-
prev ? prev.dataset.groupKey : null,
|
|
387
|
-
null
|
|
388
|
-
)
|
|
389
|
-
},
|
|
390
|
-
});
|
|
391
|
-
const unique_length = [...new Set(window.sortable.toArray())].length;
|
|
392
|
-
const all_length = window.sortable.toArray().length;
|
|
393
|
-
if (unique_length !== all_length) {
|
|
394
|
-
alert('Something is wrong with ordering.')
|
|
395
|
-
}
|
|
396
|
-
markPageEnds();
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
mainSorting()
|
|
400
|
-
</script>
|
|
401
|
-
{% endblock %}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: django-smartbase-admin
|
|
3
|
-
Version: 0.2.47
|
|
4
|
-
Summary:
|
|
5
|
-
Author: SmartBase
|
|
6
|
-
Author-email: info@smartbase.sk
|
|
7
|
-
Requires-Python: >=3.10,<4.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Requires-Dist: django (>=4.1,<6.0)
|
|
13
|
-
Requires-Dist: django-admin-inline-paginator (>=0.4.0,<0.5.0)
|
|
14
|
-
Requires-Dist: django-ckeditor (>=6.7.1,<7.0.0)
|
|
15
|
-
Requires-Dist: django-filer (>=3.1.1,<4.0.0)
|
|
16
|
-
Requires-Dist: django-htmx (>=1.17.3,<2.0.0)
|
|
17
|
-
Requires-Dist: django-nested-admin (>=4.0.2,<5.0.0)
|
|
18
|
-
Requires-Dist: django-widget-tweaks (>=1.5.0,<2.0.0)
|
|
19
|
-
Requires-Dist: easy-thumbnails[svg] (>=2.8.5,<3.0.0)
|
|
20
|
-
Requires-Dist: xlsxwriter (>=3.2.0,<4.0.0)
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
|
|
23
|
-
# django-smartbase-admin
|
|
24
|
-
SmartBase Admin application for Django.
|
|
25
|
-
|
{django_smartbase_admin-0.2.47.dist-info → django_smartbase_admin-1.0.38.dist-info}/LICENSE.md
RENAMED
|
File without changes
|