fnschool 20250109.80500.803__py3-none-any.whl → 20251011.80531.840__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.
Potentially problematic release.
This version of fnschool might be problematic. Click here for more details.
- fnschoo1/__init__.py +52 -0
- fnschoo1/canteen/admin.py +3 -0
- fnschoo1/canteen/apps.py +6 -0
- fnschoo1/canteen/forms.py +84 -0
- fnschoo1/canteen/migrations/0001_initial.py +119 -0
- fnschoo1/canteen/migrations/0002_ingredient_is_disabled.py +20 -0
- fnschoo1/canteen/migrations/0003_consumption_is_disabled_alter_ingredient_is_disabled.py +23 -0
- fnschoo1/canteen/migrations/0004_alter_ingredient_name_category_and_more.py +66 -0
- fnschoo1/canteen/migrations/0005_alter_category_created_at_alter_category_name_and_more.py +41 -0
- fnschoo1/canteen/migrations/0006_category_is_disabled_alter_category_user_and_more.py +49 -0
- fnschoo1/canteen/migrations/0007_alter_consumption_amount_used_and_more.py +30 -0
- fnschoo1/canteen/migrations/0008_category_abbreviation_mealtype.py +67 -0
- fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py +55 -0
- fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py +215 -0
- fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py +23 -0
- fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py +18 -0
- fnschoo1/canteen/models.py +179 -0
- fnschoo1/canteen/templates/canteen/category/create.html +17 -0
- fnschoo1/canteen/templates/canteen/category/delete.html +61 -0
- fnschoo1/canteen/templates/canteen/category/list.html +63 -0
- fnschoo1/canteen/templates/canteen/category/update.html +23 -0
- fnschoo1/canteen/templates/canteen/close.html +11 -0
- fnschoo1/canteen/templates/canteen/consumption/_create.html +19 -0
- fnschoo1/canteen/templates/canteen/consumption/create.html +456 -0
- fnschoo1/canteen/templates/canteen/ingredient/close.html +11 -0
- fnschoo1/canteen/templates/canteen/ingredient/create.html +19 -0
- fnschoo1/canteen/templates/canteen/ingredient/create_one.html +17 -0
- fnschoo1/canteen/templates/canteen/ingredient/delete.html +41 -0
- fnschoo1/canteen/templates/canteen/ingredient/list.html +128 -0
- fnschoo1/canteen/templates/canteen/ingredient/update.html +23 -0
- fnschoo1/canteen/templates/canteen/meal_type/create.html +17 -0
- fnschoo1/canteen/templates/canteen/meal_type/delete.html +56 -0
- fnschoo1/canteen/templates/canteen/meal_type/list.html +59 -0
- fnschoo1/canteen/templates/canteen/meal_type/update.html +23 -0
- fnschoo1/canteen/tests.py +3 -0
- fnschoo1/canteen/urls.py +116 -0
- fnschoo1/canteen/views.py +814 -0
- fnschoo1/canteen/workbook/generate.py +2098 -0
- fnschoo1/db.sqlite3 +0 -0
- fnschoo1/fnschool/__init__.py +13 -0
- fnschoo1/fnschool/asgi.py +16 -0
- fnschoo1/fnschool/settings.py +167 -0
- fnschoo1/fnschool/templatetags/fnschool_tags.py +27 -0
- fnschoo1/fnschool/urls.py +30 -0
- fnschoo1/fnschool/views.py +9 -0
- fnschoo1/fnschool/wsgi.py +16 -0
- fnschoo1/locale/en/LC_MESSAGES/django.mo +0 -0
- fnschoo1/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
- fnschoo1/manage.py +25 -0
- fnschoo1/profiles/admin.py +27 -0
- fnschoo1/profiles/apps.py +12 -0
- fnschoo1/profiles/forms.py +67 -0
- fnschoo1/profiles/migrations/0001_initial.py +192 -0
- fnschoo1/profiles/migrations/0002_alter_profile_bio.py +20 -0
- fnschoo1/profiles/migrations/0003_alter_profile_options_alter_profile_address_and_more.py +67 -0
- fnschoo1/profiles/migrations/0004_profile_gender.py +26 -0
- fnschoo1/profiles/migrations/0005_alter_profile_gender.py +23 -0
- fnschoo1/profiles/models.py +60 -0
- fnschoo1/profiles/signals.py +20 -0
- fnschoo1/profiles/templates/profiles/create.html +16 -0
- fnschoo1/profiles/templates/profiles/detail.html +14 -0
- fnschoo1/profiles/templates/profiles/edit.html +12 -0
- fnschoo1/profiles/templates/profiles/log_in.html +20 -0
- fnschoo1/profiles/templates/profiles/log_out.html +12 -0
- fnschoo1/profiles/tests.py +3 -0
- fnschoo1/profiles/urls.py +15 -0
- fnschoo1/profiles/views.py +63 -0
- fnschoo1/static/css/bootstrap.min.css +11776 -0
- fnschoo1/static/css/fnschool.css +26 -0
- fnschoo1/static/js/bootstrap.bundle.min.js +4223 -0
- fnschoo1/static/js/bootstrap.min.js +2919 -0
- fnschoo1/static/js/fnschool.js +84 -0
- fnschoo1/static/js/jquery.min.js +5413 -0
- fnschoo1/static/js/jquery.slim.min.js +4331 -0
- fnschoo1/static/js/popper.min.js +1306 -0
- fnschoo1/static_collected/admin/css/autocomplete.css +377 -0
- fnschoo1/static_collected/admin/css/base.css +1224 -0
- fnschoo1/static_collected/admin/css/changelists.css +334 -0
- fnschoo1/static_collected/admin/css/dark_mode.css +136 -0
- fnschoo1/static_collected/admin/css/dashboard.css +30 -0
- fnschoo1/static_collected/admin/css/forms.css +546 -0
- fnschoo1/static_collected/admin/css/login.css +62 -0
- fnschoo1/static_collected/admin/css/nav_sidebar.css +145 -0
- fnschoo1/static_collected/admin/css/responsive.css +1043 -0
- fnschoo1/static_collected/admin/css/responsive_rtl.css +84 -0
- fnschoo1/static_collected/admin/css/rtl.css +311 -0
- fnschoo1/static_collected/admin/css/vendor/select2/select2.css +708 -0
- fnschoo1/static_collected/admin/css/vendor/select2/select2.min.css +1 -0
- fnschoo1/static_collected/admin/css/widgets.css +639 -0
- fnschoo1/static_collected/admin/js/SelectBox.js +128 -0
- fnschoo1/static_collected/admin/js/SelectFilter2.js +503 -0
- fnschoo1/static_collected/admin/js/actions.js +232 -0
- fnschoo1/static_collected/admin/js/admin/DateTimeShortcuts.js +496 -0
- fnschoo1/static_collected/admin/js/admin/RelatedObjectLookups.js +276 -0
- fnschoo1/static_collected/admin/js/autocomplete.js +33 -0
- fnschoo1/static_collected/admin/js/calendar.js +251 -0
- fnschoo1/static_collected/admin/js/cancel.js +29 -0
- fnschoo1/static_collected/admin/js/change_form.js +21 -0
- fnschoo1/static_collected/admin/js/collapse.js +43 -0
- fnschoo1/static_collected/admin/js/core.js +174 -0
- fnschoo1/static_collected/admin/js/filters.js +37 -0
- fnschoo1/static_collected/admin/js/inlines.js +439 -0
- fnschoo1/static_collected/admin/js/jquery.init.js +8 -0
- fnschoo1/static_collected/admin/js/nav_sidebar.js +81 -0
- fnschoo1/static_collected/admin/js/popup_response.js +24 -0
- fnschoo1/static_collected/admin/js/prepopulate.js +43 -0
- fnschoo1/static_collected/admin/js/prepopulate_init.js +20 -0
- fnschoo1/static_collected/admin/js/theme.js +57 -0
- fnschoo1/static_collected/admin/js/urlify.js +529 -0
- fnschoo1/static_collected/admin/js/vendor/jquery/jquery.js +10913 -0
- fnschoo1/static_collected/admin/js/vendor/jquery/jquery.min.js +2 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/af.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ar.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/az.js +33 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bg.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bn.js +39 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bs.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ca.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/cs.js +62 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/da.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/de.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/dsb.js +51 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/el.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/en.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/es.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/et.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/eu.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fa.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fi.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fr.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/gl.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/he.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hi.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hr.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hsb.js +51 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hu.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hy.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/id.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/is.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/it.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ja.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ka.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/km.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ko.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/lt.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/lv.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/mk.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ms.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/nb.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ne.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/nl.js +46 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pl.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ps.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt-BR.js +39 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ro.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ru.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sk.js +61 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sl.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sq.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr-Cyrl.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sv.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/th.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/tk.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/tr.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/uk.js +59 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/vi.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-CN.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-TW.js +33 -0
- fnschoo1/static_collected/admin/js/vendor/select2/select2.full.js +7115 -0
- fnschoo1/static_collected/admin/js/vendor/select2/select2.full.min.js +2 -0
- fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.js +4993 -0
- fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.min.js +160 -0
- fnschoo1/static_collected/css/bootstrap.min.css +11776 -0
- fnschoo1/static_collected/css/fnschool.css +26 -0
- fnschoo1/static_collected/js/bootstrap.bundle.min.js +4223 -0
- fnschoo1/static_collected/js/bootstrap.min.js +2919 -0
- fnschoo1/static_collected/js/fnschool.js +84 -0
- fnschoo1/static_collected/js/jquery.min.js +5413 -0
- fnschoo1/static_collected/js/jquery.slim.min.js +4331 -0
- fnschoo1/static_collected/js/popper.min.js +1306 -0
- fnschoo1/templates/base/_css.html +1 -0
- fnschoo1/templates/base/_js.html +15 -0
- fnschoo1/templates/base/content.html +30 -0
- fnschoo1/templates/base/header_content_footer.html +35 -0
- fnschoo1/templates/close.html +11 -0
- fnschoo1/templates/home.html +51 -0
- fnschoo1/templates/includes/_footer.html +39 -0
- fnschoo1/templates/includes/_header.html +77 -0
- fnschoo1/templates/includes/_navigation.html +0 -0
- fnschoo1/templates/includes/_paginator.html +27 -0
- fnschoo1/templates/registration/logged_out.html +0 -0
- fnschoo1/templates/registration/login.html +0 -0
- fnschool-20251011.80531.840.dist-info/METADATA +179 -0
- fnschool-20251011.80531.840.dist-info/RECORD +207 -0
- {fnschool-20250109.80500.803.dist-info → fnschool-20251011.80531.840.dist-info}/WHEEL +1 -1
- fnschool-20251011.80531.840.dist-info/entry_points.txt +2 -0
- fnschool-20251011.80531.840.dist-info/top_level.txt +1 -0
- fnschool/__init__.py +0 -35
- fnschool/__main__.py +0 -16
- fnschool/app.py +0 -103
- fnschool/canteen/__init__.py +0 -3
- fnschool/canteen/__main__.py +0 -3
- fnschool/canteen/bill.py +0 -253
- fnschool/canteen/canteen.py +0 -1
- fnschool/canteen/canteen.toml +0 -61
- fnschool/canteen/config.py +0 -10
- fnschool/canteen/consuming.py +0 -53
- fnschool/canteen/currency.py +0 -17
- fnschool/canteen/data/bill.i18n.xlsx +0 -0
- fnschool/canteen/data/bill.xlsx +0 -0
- fnschool/canteen/data/consuming.xlsx +0 -0
- fnschool/canteen/data/purchase_list.xlsx +0 -0
- fnschool/canteen/entry.py +0 -40
- fnschool/canteen/food.py +0 -206
- fnschool/canteen/food_classes.py +0 -33
- fnschool/canteen/food_classes.toml +0 -64
- fnschool/canteen/operator.py +0 -91
- fnschool/canteen/path.py +0 -28
- fnschool/canteen/spreadsheet/base.py +0 -212
- fnschool/canteen/spreadsheet/consuming.py +0 -310
- fnschool/canteen/spreadsheet/consumingsum.py +0 -76
- fnschool/canteen/spreadsheet/cover.py +0 -64
- fnschool/canteen/spreadsheet/ctspreadsheet.py +0 -351
- fnschool/canteen/spreadsheet/food.py +0 -680
- fnschool/canteen/spreadsheet/inventory.py +0 -375
- fnschool/canteen/spreadsheet/merging.py +0 -340
- fnschool/canteen/spreadsheet/preconsuming.py +0 -329
- fnschool/canteen/spreadsheet/purchasing.py +0 -885
- fnschool/canteen/spreadsheet/purchasingsum.py +0 -110
- fnschool/canteen/spreadsheet/spreadsheet.py +0 -363
- fnschool/canteen/spreadsheet/translating.py +0 -12
- fnschool/canteen/spreadsheet/unwarehousing.py +0 -178
- fnschool/canteen/spreadsheet/unwarehousingsum.py +0 -11
- fnschool/canteen/spreadsheet/warehousing.py +0 -360
- fnschool/canteen/spreadsheet/workbook.py +0 -17
- fnschool/canteen/test.py +0 -97
- fnschool/config.py +0 -48
- fnschool/entry.py +0 -67
- fnschool/exam/__init__.py +0 -8
- fnschool/exam/data/parental_emails.xlsx +0 -0
- fnschool/exam/data/score.xlsx +0 -0
- fnschool/exam/email.py +0 -349
- fnschool/exam/entry.py +0 -36
- fnschool/exam/language.py +0 -19
- fnschool/exam/path.py +0 -24
- fnschool/exam/score.py +0 -1191
- fnschool/exam/subject.py +0 -20
- fnschool/exam/teacher.py +0 -54
- fnschool/external.py +0 -89
- fnschool/games/__init__.py +0 -1
- fnschool/games/__main__.py +0 -1
- fnschool/games/games.py +0 -1
- fnschool/inoutput.py +0 -97
- fnschool/language.py +0 -40
- fnschool/locales/en_US/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_CN/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_HK/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_SG/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_TW/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/path.py +0 -45
- fnschool/test.py +0 -24
- fnschool/user.py +0 -262
- fnschool-20250109.80500.803.dist-info/METADATA +0 -342
- fnschool-20250109.80500.803.dist-info/RECORD +0 -78
- fnschool-20250109.80500.803.dist-info/entry_points.txt +0 -5
- fnschool-20250109.80500.803.dist-info/top_level.txt +0 -1
- /fnschool/canteen/consume.py → /fnschoo1/canteen/__init__.py +0 -0
- /fnschool/canteen/food_recount.toml → /fnschoo1/canteen/migrations/__init__.py +0 -0
- {fnschool/canteen/spreadsheet → fnschoo1/canteen/workbook}/__init__.py +0 -0
- /fnschool/exam/__main__.py → /fnschoo1/fnschool/templatetags/__init__.py +0 -0
- /fnschool/canteen/food_recounts.toml → /fnschoo1/profiles/__init__.py +0 -0
- /fnschool/canteen/warehouse.py → /fnschoo1/profiles/migrations/__init__.py +0 -0
- /fnschool/canteen/workbook.toml → /fnschoo1/templates/base/_content.html +0 -0
- {fnschool-20250109.80500.803.dist-info → fnschool-20251011.80531.840.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
{
|
|
3
|
+
const toggleNavSidebar = document.getElementById('toggle-nav-sidebar')
|
|
4
|
+
if (toggleNavSidebar !== null) {
|
|
5
|
+
const navSidebar = document.getElementById('nav-sidebar')
|
|
6
|
+
const main = document.getElementById('main')
|
|
7
|
+
let navSidebarIsOpen = localStorage.getItem('django.admin.navSidebarIsOpen')
|
|
8
|
+
if (navSidebarIsOpen === null) {
|
|
9
|
+
navSidebarIsOpen = 'true'
|
|
10
|
+
}
|
|
11
|
+
main.classList.toggle('shifted', navSidebarIsOpen === 'true')
|
|
12
|
+
navSidebar.setAttribute('aria-expanded', navSidebarIsOpen)
|
|
13
|
+
|
|
14
|
+
toggleNavSidebar.addEventListener('click', function () {
|
|
15
|
+
if (navSidebarIsOpen === 'true') {
|
|
16
|
+
navSidebarIsOpen = 'false'
|
|
17
|
+
} else {
|
|
18
|
+
navSidebarIsOpen = 'true'
|
|
19
|
+
}
|
|
20
|
+
localStorage.setItem('django.admin.navSidebarIsOpen', navSidebarIsOpen)
|
|
21
|
+
main.classList.toggle('shifted')
|
|
22
|
+
navSidebar.setAttribute('aria-expanded', navSidebarIsOpen)
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function initSidebarQuickFilter() {
|
|
27
|
+
const options = []
|
|
28
|
+
const navSidebar = document.getElementById('nav-sidebar')
|
|
29
|
+
if (!navSidebar) {
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
navSidebar.querySelectorAll('th[scope=row] a').forEach((container) => {
|
|
33
|
+
options.push({ title: container.innerHTML, node: container })
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
function checkValue(event) {
|
|
37
|
+
let filterValue = event.target.value
|
|
38
|
+
if (filterValue) {
|
|
39
|
+
filterValue = filterValue.toLowerCase()
|
|
40
|
+
}
|
|
41
|
+
if (event.key === 'Escape') {
|
|
42
|
+
filterValue = ''
|
|
43
|
+
event.target.value = '' // clear input
|
|
44
|
+
}
|
|
45
|
+
let matches = false
|
|
46
|
+
for (const o of options) {
|
|
47
|
+
let displayValue = ''
|
|
48
|
+
if (filterValue) {
|
|
49
|
+
if (o.title.toLowerCase().indexOf(filterValue) === -1) {
|
|
50
|
+
displayValue = 'none'
|
|
51
|
+
} else {
|
|
52
|
+
matches = true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// show/hide parent <TR>
|
|
56
|
+
o.node.parentNode.parentNode.style.display = displayValue
|
|
57
|
+
}
|
|
58
|
+
if (!filterValue || matches) {
|
|
59
|
+
event.target.classList.remove('no-results')
|
|
60
|
+
} else {
|
|
61
|
+
event.target.classList.add('no-results')
|
|
62
|
+
}
|
|
63
|
+
sessionStorage.setItem('django.admin.navSidebarFilterValue', filterValue)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const nav = document.getElementById('nav-filter')
|
|
67
|
+
nav.addEventListener('change', checkValue, false)
|
|
68
|
+
nav.addEventListener('input', checkValue, false)
|
|
69
|
+
nav.addEventListener('keyup', checkValue, false)
|
|
70
|
+
|
|
71
|
+
const storedValue = sessionStorage.getItem(
|
|
72
|
+
'django.admin.navSidebarFilterValue'
|
|
73
|
+
)
|
|
74
|
+
if (storedValue) {
|
|
75
|
+
nav.value = storedValue
|
|
76
|
+
checkValue({ target: nav, key: '' })
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
window.initSidebarQuickFilter = initSidebarQuickFilter
|
|
80
|
+
initSidebarQuickFilter()
|
|
81
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*global opener */
|
|
2
|
+
'use strict'
|
|
3
|
+
{
|
|
4
|
+
const initData = JSON.parse(
|
|
5
|
+
document.getElementById('django-admin-popup-response-constants').dataset
|
|
6
|
+
.popupResponse
|
|
7
|
+
)
|
|
8
|
+
switch (initData.action) {
|
|
9
|
+
case 'change':
|
|
10
|
+
opener.dismissChangeRelatedObjectPopup(
|
|
11
|
+
window,
|
|
12
|
+
initData.value,
|
|
13
|
+
initData.obj,
|
|
14
|
+
initData.new_value
|
|
15
|
+
)
|
|
16
|
+
break
|
|
17
|
+
case 'delete':
|
|
18
|
+
opener.dismissDeleteRelatedObjectPopup(window, initData.value)
|
|
19
|
+
break
|
|
20
|
+
default:
|
|
21
|
+
opener.dismissAddRelatedObjectPopup(window, initData.value, initData.obj)
|
|
22
|
+
break
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*global URLify*/
|
|
2
|
+
'use strict'
|
|
3
|
+
{
|
|
4
|
+
const $ = django.jQuery
|
|
5
|
+
$.fn.prepopulate = function (dependencies, maxLength, allowUnicode) {
|
|
6
|
+
/*
|
|
7
|
+
Depends on urlify.js
|
|
8
|
+
Populates a selected field with the values of the dependent fields,
|
|
9
|
+
URLifies and shortens the string.
|
|
10
|
+
dependencies - array of dependent fields ids
|
|
11
|
+
maxLength - maximum length of the URLify'd string
|
|
12
|
+
allowUnicode - Unicode support of the URLify'd string
|
|
13
|
+
*/
|
|
14
|
+
return this.each(function () {
|
|
15
|
+
const prepopulatedField = $(this)
|
|
16
|
+
|
|
17
|
+
const populate = function () {
|
|
18
|
+
// Bail if the field's value has been changed by the user
|
|
19
|
+
if (prepopulatedField.data('_changed')) {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const values = []
|
|
24
|
+
$.each(dependencies, function (i, field) {
|
|
25
|
+
field = $(field)
|
|
26
|
+
if (field.val().length > 0) {
|
|
27
|
+
values.push(field.val())
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
prepopulatedField.data('_changed', false)
|
|
34
|
+
prepopulatedField.on('change', function () {
|
|
35
|
+
prepopulatedField.data('_changed', true)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
if (!prepopulatedField.val()) {
|
|
39
|
+
$(dependencies.join(',')).on('keyup change focus', populate)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
{
|
|
3
|
+
const $ = django.jQuery
|
|
4
|
+
const fields = $('#django-admin-prepopulated-fields-constants').data(
|
|
5
|
+
'prepopulatedFields'
|
|
6
|
+
)
|
|
7
|
+
$.each(fields, function (index, field) {
|
|
8
|
+
$(
|
|
9
|
+
'.empty-form .form-row .field-' +
|
|
10
|
+
field.name +
|
|
11
|
+
', .empty-form.form-row .field-' +
|
|
12
|
+
field.name +
|
|
13
|
+
', .empty-form .form-row.field-' +
|
|
14
|
+
field.name
|
|
15
|
+
).addClass('prepopulated_field')
|
|
16
|
+
$(field.id)
|
|
17
|
+
.data('dependency_list', field.dependency_list)
|
|
18
|
+
.prepopulate(field.dependency_ids, field.maxLength, field.allowUnicode)
|
|
19
|
+
})
|
|
20
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
{
|
|
3
|
+
window.addEventListener('load', function (e) {
|
|
4
|
+
function setTheme(mode) {
|
|
5
|
+
if (mode !== 'light' && mode !== 'dark' && mode !== 'auto') {
|
|
6
|
+
console.error(`Got invalid theme mode: ${mode}. Resetting to auto.`)
|
|
7
|
+
mode = 'auto'
|
|
8
|
+
}
|
|
9
|
+
document.documentElement.dataset.theme = mode
|
|
10
|
+
localStorage.setItem('theme', mode)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function cycleTheme() {
|
|
14
|
+
const currentTheme = localStorage.getItem('theme') || 'auto'
|
|
15
|
+
const prefersDark = window.matchMedia(
|
|
16
|
+
'(prefers-color-scheme: dark)'
|
|
17
|
+
).matches
|
|
18
|
+
|
|
19
|
+
if (prefersDark) {
|
|
20
|
+
// Auto (dark) -> Light -> Dark
|
|
21
|
+
if (currentTheme === 'auto') {
|
|
22
|
+
setTheme('light')
|
|
23
|
+
} else if (currentTheme === 'light') {
|
|
24
|
+
setTheme('dark')
|
|
25
|
+
} else {
|
|
26
|
+
setTheme('auto')
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
// Auto (light) -> Dark -> Light
|
|
30
|
+
if (currentTheme === 'auto') {
|
|
31
|
+
setTheme('dark')
|
|
32
|
+
} else if (currentTheme === 'dark') {
|
|
33
|
+
setTheme('light')
|
|
34
|
+
} else {
|
|
35
|
+
setTheme('auto')
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function initTheme() {
|
|
41
|
+
// set theme defined in localStorage if there is one, or fallback to auto mode
|
|
42
|
+
const currentTheme = localStorage.getItem('theme')
|
|
43
|
+
currentTheme ? setTheme(currentTheme) : setTheme('auto')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function setupTheme() {
|
|
47
|
+
// Attach event handlers for toggling themes
|
|
48
|
+
const buttons = document.getElementsByClassName('theme-toggle')
|
|
49
|
+
Array.from(buttons).forEach((btn) => {
|
|
50
|
+
btn.addEventListener('click', cycleTheme)
|
|
51
|
+
})
|
|
52
|
+
initTheme()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setupTheme()
|
|
56
|
+
})
|
|
57
|
+
}
|