Add/apply prettier
This commit is contained in:
parent
5f920825cc
commit
b60d9f6644
@ -14,7 +14,14 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MARIADB_ROOT_PASSWORD: whatever
|
MARIADB_ROOT_PASSWORD: whatever
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized"]
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"healthcheck.sh",
|
||||||
|
"--su-mysql",
|
||||||
|
"--connect",
|
||||||
|
"--innodb_initialized",
|
||||||
|
]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup PDM
|
- name: Setup PDM
|
||||||
|
6
.prettierignore
Normal file
6
.prettierignore
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
*.dj.html
|
||||||
|
|
||||||
|
pnpm-lock.yaml
|
||||||
|
.mypy_cache/
|
||||||
|
.venv/
|
||||||
|
.pytest_cache/
|
0
.prettierrc
Normal file
0
.prettierrc
Normal file
@ -1,7 +1,8 @@
|
|||||||
import { Tooltip } from "bootstrap";
|
import { Tooltip } from "bootstrap";
|
||||||
|
|
||||||
const tooltipTriggerList = document.querySelectorAll(
|
const tooltipTriggerList = document.querySelectorAll(
|
||||||
'[data-bs-toggle="tooltip"]',
|
'[data-bs-toggle="tooltip"]',
|
||||||
);
|
);
|
||||||
for (let tooltipTriggerEl of tooltipTriggerList) {
|
for (const tooltipTriggerElement of tooltipTriggerList) {
|
||||||
new Tooltip(tooltipTriggerEl);
|
new Tooltip(tooltipTriggerElement);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import 'bootstrap/scss/bootstrap.scss';
|
import "bootstrap/scss/bootstrap.scss";
|
||||||
import 'bootstrap-icons/font/bootstrap-icons.css';
|
import "bootstrap-icons/font/bootstrap-icons.css";
|
||||||
import 'bootstrap';
|
import "bootstrap";
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='75' height='75' viewBox='0 0 75 75'><text style='font-size:13px;fill:lightgrey' x='-49' y='58' id='text1' transform='rotate(-45)'>PREVIEW</text></svg>");
|
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='75' height='75' viewBox='0 0 75 75'><text style='font-size:13px;fill:lightgrey' x='-49' y='58' id='text1' transform='rotate(-45)'>PREVIEW</text></svg>");
|
||||||
}
|
}
|
||||||
|
|
||||||
body, table * {
|
body,
|
||||||
|
table * {
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bootstrap": "^5.2.10",
|
"@types/bootstrap": "^5.2.10",
|
||||||
"@types/tabulator-tables": "^6.2.3",
|
"@types/tabulator-tables": "^6.2.3",
|
||||||
|
"prettier": "^3.3.3",
|
||||||
"sass": "^1.77.8",
|
"sass": "^1.77.8",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.5.4",
|
||||||
"vite": "^5.3.4"
|
"vite": "^5.3.4"
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
FilterModule,
|
FilterModule,
|
||||||
HtmlTableImportModule,
|
HtmlTableImportModule,
|
||||||
ResponsiveLayoutModule,
|
ResponsiveLayoutModule,
|
||||||
FilterType,
|
type FilterType,
|
||||||
} from "tabulator-tables";
|
} from "tabulator-tables";
|
||||||
import "tabulator-tables/src/scss/themes/bootstrap/tabulator_bootstrap5.scss";
|
import "tabulator-tables/src/scss/themes/bootstrap/tabulator_bootstrap5.scss";
|
||||||
|
|
||||||
@ -16,14 +16,16 @@ Tabulator.registerModule([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
Tabulator.extendModule("filter", "filters", {
|
Tabulator.extendModule("filter", "filters", {
|
||||||
"!includes": function(headerValue: string, rowValue: string){
|
"!includes"(headerValue: string, rowValue: string) {
|
||||||
return !rowValue.includes(headerValue);
|
return !rowValue.includes(headerValue);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const certification_table_el = document.querySelector("table.certifications");
|
const certification_table_element = document.querySelector(
|
||||||
if (certification_table_el instanceof HTMLTableElement) {
|
"table.certifications",
|
||||||
const certification_table = new Tabulator(certification_table_el, {
|
);
|
||||||
|
if (certification_table_element instanceof HTMLTableElement) {
|
||||||
|
const certification_table = new Tabulator(certification_table_element, {
|
||||||
layout: "fitDataFill",
|
layout: "fitDataFill",
|
||||||
responsiveLayout: "collapse",
|
responsiveLayout: "collapse",
|
||||||
pagination: true,
|
pagination: true,
|
||||||
@ -31,7 +33,7 @@ if (certification_table_el instanceof HTMLTableElement) {
|
|||||||
columnDefaults: {
|
columnDefaults: {
|
||||||
headerFilter: true,
|
headerFilter: true,
|
||||||
},
|
},
|
||||||
rowFormatter: function (row) {
|
rowFormatter(row) {
|
||||||
const data = row.getData();
|
const data = row.getData();
|
||||||
if (data.version.includes("[OUTDATED]")) {
|
if (data.version.includes("[OUTDATED]")) {
|
||||||
row.getElement().classList.add("table-warning");
|
row.getElement().classList.add("table-warning");
|
||||||
@ -80,19 +82,27 @@ if (certification_table_el instanceof HTMLTableElement) {
|
|||||||
|
|
||||||
function setOutdatedFilter(showOutdated: boolean) {
|
function setOutdatedFilter(showOutdated: boolean) {
|
||||||
if (showOutdated) {
|
if (showOutdated) {
|
||||||
certification_table.removeFilter("version", "!includes" as FilterType, "[OUTDATED]");
|
certification_table.removeFilter(
|
||||||
|
"version",
|
||||||
|
"!includes" as FilterType,
|
||||||
|
"[OUTDATED]",
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
certification_table.addFilter("version", "!includes" as FilterType, "[OUTDATED]");
|
certification_table.addFilter(
|
||||||
|
"version",
|
||||||
|
"!includes" as FilterType,
|
||||||
|
"[OUTDATED]",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
certification_table.on("tableBuilt", () => {
|
certification_table.on("tableBuilt", () => {
|
||||||
const outdatedToggle = document.getElementById("showOutdated");
|
const outdatedToggle = document.querySelector("#showOutdated");
|
||||||
if (outdatedToggle instanceof HTMLInputElement) {
|
if (outdatedToggle instanceof HTMLInputElement) {
|
||||||
setOutdatedFilter(outdatedToggle.checked);
|
setOutdatedFilter(outdatedToggle.checked);
|
||||||
outdatedToggle.addEventListener("change", () =>
|
outdatedToggle.addEventListener("change", () => {
|
||||||
setOutdatedFilter(outdatedToggle.checked),
|
setOutdatedFilter(outdatedToggle.checked);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
window.addEventListener('load', function() {
|
window.addEventListener("load", function () {
|
||||||
// Bind on certification_definition field change
|
// Bind on certification_definition field change
|
||||||
django.jQuery(':input[name$=certification_definition]').on('change', function() {
|
django
|
||||||
|
.jQuery(":input[name$=certification_definition]")
|
||||||
|
.on("change", function () {
|
||||||
// Get the field prefix, ie. if this comes from a formset form
|
// Get the field prefix, ie. if this comes from a formset form
|
||||||
var prefix = django.jQuery(this).getFormPrefix();
|
const prefix = django.jQuery(this).getFormPrefix();
|
||||||
|
|
||||||
// Clear the autocomplete with the same prefix
|
// Clear the autocomplete with the same prefix
|
||||||
django.jQuery(':input[name=' + prefix + 'certification_version]').val(null).trigger('change');
|
django
|
||||||
|
.jQuery(":input[name=" + prefix + "certification_version]")
|
||||||
|
.val(null)
|
||||||
|
.trigger("change");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#cert-data {
|
#cert-data {
|
||||||
string-set: certname attr(data-name),
|
string-set:
|
||||||
|
certname attr(data-name),
|
||||||
certversion attr(data-version),
|
certversion attr(data-version),
|
||||||
certapprovaldate attr(data-approvaldate);
|
certapprovaldate attr(data-approvaldate);
|
||||||
/* Can't be `display: none;`, as it breaks string-set */
|
/* Can't be `display: none;`, as it breaks string-set */
|
||||||
@ -18,7 +19,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
body, p, li {
|
body,
|
||||||
|
p,
|
||||||
|
li {
|
||||||
font-size: 10pt !important;
|
font-size: 10pt !important;
|
||||||
line-height: 1.2 !important;
|
line-height: 1.2 !important;
|
||||||
}
|
}
|
||||||
@ -33,7 +36,10 @@
|
|||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, h3, h4 {
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4 {
|
||||||
padding-top: 0em !important;
|
padding-top: 0em !important;
|
||||||
margin-top: 0em !important;
|
margin-top: 0em !important;
|
||||||
break-before: auto !important;
|
break-before: auto !important;
|
||||||
@ -68,7 +74,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@top-right {
|
@top-right {
|
||||||
content: '';
|
content: "";
|
||||||
background-image: url("https://claremontmakerspace.org/wp-content/uploads/2018/06/cms_logo.png");
|
background-image: url("https://claremontmakerspace.org/wp-content/uploads/2018/06/cms_logo.png");
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: bottom;
|
background-position: bottom;
|
||||||
|
@ -27,6 +27,9 @@ importers:
|
|||||||
'@types/tabulator-tables':
|
'@types/tabulator-tables':
|
||||||
specifier: ^6.2.3
|
specifier: ^6.2.3
|
||||||
version: 6.2.3
|
version: 6.2.3
|
||||||
|
prettier:
|
||||||
|
specifier: ^3.3.3
|
||||||
|
version: 3.3.3
|
||||||
sass:
|
sass:
|
||||||
specifier: ^1.77.8
|
specifier: ^1.77.8
|
||||||
version: 1.77.8
|
version: 1.77.8
|
||||||
@ -350,6 +353,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==}
|
resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
|
prettier@3.3.3:
|
||||||
|
resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==}
|
||||||
|
engines: {node: '>=14'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
readdirp@3.6.0:
|
readdirp@3.6.0:
|
||||||
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
|
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
|
||||||
engines: {node: '>=8.10.0'}
|
engines: {node: '>=8.10.0'}
|
||||||
@ -631,6 +639,8 @@ snapshots:
|
|||||||
picocolors: 1.0.1
|
picocolors: 1.0.1
|
||||||
source-map-js: 1.2.0
|
source-map-js: 1.2.0
|
||||||
|
|
||||||
|
prettier@3.3.3: {}
|
||||||
|
|
||||||
readdirp@3.6.0:
|
readdirp@3.6.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
picomatch: 2.3.1
|
picomatch: 2.3.1
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": [
|
"extends": ["config:recommended"]
|
||||||
"config:recommended"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
32
static/bootstrap-color-toggle.js
vendored
32
static/bootstrap-color-toggle.js
vendored
@ -27,9 +27,9 @@
|
|||||||
theme === "auto" &&
|
theme === "auto" &&
|
||||||
window.matchMedia("(prefers-color-scheme: dark)").matches
|
window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||||
) {
|
) {
|
||||||
document.documentElement.setAttribute("data-bs-theme", "dark");
|
document.documentElement.dataset.bsTheme = "dark";
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.setAttribute("data-bs-theme", theme);
|
document.documentElement.dataset.bsTheme = theme;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,25 +44,27 @@
|
|||||||
|
|
||||||
const themeSwitcherText = document.querySelector("#bd-theme-text");
|
const themeSwitcherText = document.querySelector("#bd-theme-text");
|
||||||
const activeThemeIcon = document.querySelector(".theme-icon-active");
|
const activeThemeIcon = document.querySelector(".theme-icon-active");
|
||||||
const btnToActive = document.querySelector(
|
const buttonToActive = document.querySelector(
|
||||||
`[data-bs-theme-value="${theme}"]`,
|
`[data-bs-theme-value="${theme}"]`,
|
||||||
);
|
);
|
||||||
const activeIcon = [
|
const activeIcon = [
|
||||||
...btnToActive.querySelector(".theme-icon").classList,
|
...buttonToActive.querySelector(".theme-icon").classList,
|
||||||
].find((c) => c.startsWith("bi-"));
|
].find((c) => c.startsWith("bi-"));
|
||||||
|
|
||||||
document.querySelectorAll("[data-bs-theme-value]").forEach((element) => {
|
for (const element of document.querySelectorAll("[data-bs-theme-value]")) {
|
||||||
element.classList.remove("active");
|
element.classList.remove("active");
|
||||||
element.setAttribute("aria-pressed", "false");
|
element.setAttribute("aria-pressed", "false");
|
||||||
});
|
}
|
||||||
|
|
||||||
btnToActive.classList.add("active");
|
buttonToActive.classList.add("active");
|
||||||
btnToActive.setAttribute("aria-pressed", "true");
|
buttonToActive.setAttribute("aria-pressed", "true");
|
||||||
[...activeThemeIcon.classList]
|
for (const icon of activeThemeIcon.classList) {
|
||||||
.filter((c) => c.startsWith("bi-"))
|
if (icon.startsWith("bi-")) {
|
||||||
.forEach((icon) => activeThemeIcon.classList.remove(icon));
|
activeThemeIcon.classList.remove(icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
activeThemeIcon.classList.add(activeIcon);
|
activeThemeIcon.classList.add(activeIcon);
|
||||||
const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`;
|
const themeSwitcherLabel = `${themeSwitcherText.textContent} (${buttonToActive.dataset.bsThemeValue})`;
|
||||||
themeSwitcher.setAttribute("aria-label", themeSwitcherLabel);
|
themeSwitcher.setAttribute("aria-label", themeSwitcherLabel);
|
||||||
|
|
||||||
if (focus) {
|
if (focus) {
|
||||||
@ -83,13 +85,13 @@
|
|||||||
console.log(getPreferredTheme());
|
console.log(getPreferredTheme());
|
||||||
showActiveTheme(getPreferredTheme());
|
showActiveTheme(getPreferredTheme());
|
||||||
|
|
||||||
document.querySelectorAll("[data-bs-theme-value]").forEach((toggle) => {
|
for (const toggle of document.querySelectorAll("[data-bs-theme-value]")) {
|
||||||
toggle.addEventListener("click", () => {
|
toggle.addEventListener("click", () => {
|
||||||
const theme = toggle.getAttribute("data-bs-theme-value");
|
const theme = toggle.dataset.bsThemeValue;
|
||||||
setStoredTheme(theme);
|
setStoredTheme(theme);
|
||||||
setTheme(theme);
|
setTheme(theme);
|
||||||
showActiveTheme(theme, true);
|
showActiveTheme(theme, true);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
import { resolve, join } from "node:path";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import { resolve, join } from "path";
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: "/static/",
|
base: "/static/",
|
||||||
|
Loading…
Reference in New Issue
Block a user