mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-21 13:43:20 +00:00
use spaces for indentation
This commit is contained in:
parent
24925f7726
commit
20bea62542
11
biome.json
11
biome.json
@ -7,25 +7,20 @@
|
|||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignoreUnknown": false,
|
"ignoreUnknown": false,
|
||||||
"ignore": ["core/static/vendored", "*.min.js", "staticfiles/generated"]
|
"ignore": ["core/static/vendored", "*.min.*", "staticfiles/generated"]
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"indentStyle": "tab"
|
"indentStyle": "space",
|
||||||
|
"lineWidth": 88
|
||||||
},
|
},
|
||||||
"organizeImports": {
|
"organizeImports": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"ignore": ["core/static/vendored", "*.min.js", "staticfiles/generated"],
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"recommended": true
|
"recommended": true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"javascript": {
|
|
||||||
"formatter": {
|
|
||||||
"quoteStyle": "double"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,7 @@ $(document).ready(() => {
|
|||||||
function start_progress_bar(display_time) {
|
function start_progress_bar(display_time) {
|
||||||
$("#slideshow #progress_bar").removeClass("init");
|
$("#slideshow #progress_bar").removeClass("init");
|
||||||
$("#slideshow #progress_bar").addClass("progress");
|
$("#slideshow #progress_bar").addClass("progress");
|
||||||
$("#slideshow #progress_bar").css(
|
$("#slideshow #progress_bar").css("transition", `width ${display_time}s linear`);
|
||||||
"transition",
|
|
||||||
`width ${display_time}s linear`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function next() {
|
function next() {
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
"pk": 1,
|
"pk": 1,
|
||||||
"fields": {
|
"fields": {
|
||||||
"permissions": [
|
"permissions": [
|
||||||
1, 2, 3, 7, 8, 9, 4, 5, 6, 10, 11, 12, 19, 20, 21, 22, 25, 23, 24, 16,
|
1, 2, 3, 7, 8, 9, 4, 5, 6, 10, 11, 12, 19, 20, 21, 22, 25, 23, 24, 16, 17, 18,
|
||||||
17, 18, 13, 14, 15
|
13, 14, 15
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"model": "core.group"
|
"model": "core.group"
|
||||||
|
@ -142,9 +142,7 @@ async function fetch_paginated(url) {
|
|||||||
for (let i = 2; i <= nb_pages; i++) {
|
for (let i = 2; i <= nb_pages; i++) {
|
||||||
paginated_url.searchParams.set("page", i.toString());
|
paginated_url.searchParams.set("page", i.toString());
|
||||||
promises.push(
|
promises.push(
|
||||||
fetch(paginated_url).then((res) =>
|
fetch(paginated_url).then((res) => res.json().then((json) => json.results)),
|
||||||
res.json().then((json) => json.results),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
results.push(...(await Promise.all(promises)).flat());
|
results.push(...(await Promise.all(promises)).flat());
|
||||||
|
@ -243,8 +243,7 @@ function item_formatter(user) {
|
|||||||
*/
|
*/
|
||||||
function select_item_builder(picture_getter) {
|
function select_item_builder(picture_getter) {
|
||||||
return (item) => {
|
return (item) => {
|
||||||
const picture =
|
const picture = typeof picture_getter === "function" ? picture_getter(item) : null;
|
||||||
typeof picture_getter === "function" ? picture_getter(item) : null;
|
|
||||||
const img_html = picture
|
const img_html = picture
|
||||||
? `<img
|
? `<img
|
||||||
src="${picture_getter(item)}"
|
src="${picture_getter(item)}"
|
||||||
|
@ -83,9 +83,7 @@ function create_graph(container, data, active_user_id) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const active_user = cy
|
const active_user = cy.getElementById(active_user_id).style("shape", "rectangle");
|
||||||
.getElementById(active_user_id)
|
|
||||||
.style("shape", "rectangle");
|
|
||||||
/* Reset graph */
|
/* Reset graph */
|
||||||
const reset_graph = () => {
|
const reset_graph = () => {
|
||||||
cy.elements((element) => {
|
cy.elements((element) => {
|
||||||
@ -124,9 +122,7 @@ function create_graph(container, data, active_user_id) {
|
|||||||
|
|
||||||
/* Add context menu */
|
/* Add context menu */
|
||||||
if (cy.cxtmenu === undefined) {
|
if (cy.cxtmenu === undefined) {
|
||||||
console.error(
|
console.error("ctxmenu isn't loaded, context menu won't be available on graphs");
|
||||||
"ctxmenu isn't loaded, context menu won't be available on graphs",
|
|
||||||
);
|
|
||||||
return cy;
|
return cy;
|
||||||
}
|
}
|
||||||
cy.cxtmenu({
|
cy.cxtmenu({
|
||||||
@ -261,11 +257,7 @@ document.addEventListener("alpine:init", () => {
|
|||||||
|
|
||||||
async generate_graph() {
|
async generate_graph() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.graph = create_graph(
|
this.graph = create_graph($(this.$refs.graph), this.graph_data, active_user);
|
||||||
$(this.$refs.graph),
|
|
||||||
this.graph_data,
|
|
||||||
active_user,
|
|
||||||
);
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
function alpine_webcam_builder(
|
function alpine_webcam_builder(default_picture, delete_url, can_delete_picture) {
|
||||||
default_picture,
|
|
||||||
delete_url,
|
|
||||||
can_delete_picture,
|
|
||||||
) {
|
|
||||||
return () => ({
|
return () => ({
|
||||||
can_edit_picture: false,
|
can_edit_picture: false,
|
||||||
|
|
||||||
|
@ -155,9 +155,7 @@ function easymdeFactory(textarea, markdownApiURL) {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const submits = textarea
|
const submits = textarea.closest("form").querySelectorAll('input[type="submit"]');
|
||||||
.closest("form")
|
|
||||||
.querySelectorAll('input[type="submit"]');
|
|
||||||
const parentDiv = textarea.parentElement;
|
const parentDiv = textarea.parentElement;
|
||||||
let submitPressed = false;
|
let submitPressed = false;
|
||||||
|
|
||||||
|
@ -21,9 +21,7 @@ function getCookie(name) {
|
|||||||
.map((c) => c.trim())
|
.map((c) => c.trim())
|
||||||
.find((c) => c.startsWith(`${name}=`));
|
.find((c) => c.startsWith(`${name}=`));
|
||||||
|
|
||||||
return found === undefined
|
return found === undefined ? undefined : decodeURIComponent(found.split("=")[1]);
|
||||||
? undefined
|
|
||||||
: decodeURIComponent(found.split("=")[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,10 +52,7 @@ document.addEventListener("alpine:init", () => {
|
|||||||
* @returns {number} The total price of the basket
|
* @returns {number} The total price of the basket
|
||||||
*/
|
*/
|
||||||
get_total() {
|
get_total() {
|
||||||
return this.items.reduce(
|
return this.items.reduce((acc, item) => acc + item.quantity * item.unit_price, 0);
|
||||||
(acc, item) => acc + item.quantity * item.unit_price,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,8 +44,8 @@ document.addEventListener("alpine:init", () => {
|
|||||||
: BillingInfoReqState.FAILURE;
|
: BillingInfoReqState.FAILURE;
|
||||||
if (res.status === 422) {
|
if (res.status === 422) {
|
||||||
const errors = (await res.json()).detail.flatMap((err) => err.loc);
|
const errors = (await res.json()).detail.flatMap((err) => err.loc);
|
||||||
for (const elem of Array.from(form.querySelectorAll("input")).filter(
|
for (const elem of Array.from(form.querySelectorAll("input")).filter((elem) =>
|
||||||
(elem) => errors.includes(elem.name),
|
errors.includes(elem.name),
|
||||||
)) {
|
)) {
|
||||||
elem.setCustomValidity(gettext("Incorrect value"));
|
elem.setCustomValidity(gettext("Incorrect value"));
|
||||||
elem.reportValidity();
|
elem.reportValidity();
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "webpack --mode production",
|
"compile": "webpack --mode production",
|
||||||
"compile-dev": "webpack --mode development",
|
"compile-dev": "webpack --mode development",
|
||||||
"serve": "webpack --mode development --watch"
|
"serve": "webpack --mode development --watch",
|
||||||
|
"check": "biome check --write"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
@ -127,17 +127,13 @@ document.addEventListener("alpine:init", () => {
|
|||||||
element: $(this.$refs.search),
|
element: $(this.$refs.search),
|
||||||
data_source: remote_data_source("/api/user/search", {
|
data_source: remote_data_source("/api/user/search", {
|
||||||
excluded: () => [
|
excluded: () => [
|
||||||
...(this.current_picture.identifications || []).map(
|
...(this.current_picture.identifications || []).map((i) => i.user.id),
|
||||||
(i) => i.user.id,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
result_converter: (obj) => Object({ ...obj, text: obj.display_name }),
|
result_converter: (obj) => Object({ ...obj, text: obj.display_name }),
|
||||||
}),
|
}),
|
||||||
picture_getter: (user) => user.profile_pict,
|
picture_getter: (user) => user.profile_pict,
|
||||||
});
|
});
|
||||||
this.current_picture = this.pictures.find(
|
this.current_picture = this.pictures.find((i) => i.id === first_picture_id);
|
||||||
(i) => i.id === first_picture_id,
|
|
||||||
);
|
|
||||||
this.$watch("current_picture", (current, previous) => {
|
this.$watch("current_picture", (current, previous) => {
|
||||||
if (current === previous) {
|
if (current === previous) {
|
||||||
/* Avoid recursive updates */
|
/* Avoid recursive updates */
|
||||||
@ -193,12 +189,9 @@ document.addEventListener("alpine:init", () => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async moderate_picture() {
|
async moderate_picture() {
|
||||||
const res = await fetch(
|
const res = await fetch(`/api/sas/picture/${this.current_picture.id}/moderate`, {
|
||||||
`/api/sas/picture/${this.current_picture.id}/moderate`,
|
|
||||||
{
|
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
},
|
});
|
||||||
);
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
this.moderation_error = `${gettext("Couldn't moderate picture")} : ${res.statusText}`;
|
this.moderation_error = `${gettext("Couldn't moderate picture")} : ${res.statusText}`;
|
||||||
return;
|
return;
|
||||||
@ -231,9 +224,7 @@ document.addEventListener("alpine:init", () => {
|
|||||||
const url = `/api/sas/picture/${this.current_picture.id}/identified`;
|
const url = `/api/sas/picture/${this.current_picture.id}/identified`;
|
||||||
await fetch(url, {
|
await fetch(url, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
body: JSON.stringify(
|
body: JSON.stringify(this.selector.val().map((i) => Number.parseInt(i))),
|
||||||
this.selector.val().map((i) => Number.parseInt(i)),
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
// refresh the identified users list
|
// refresh the identified users list
|
||||||
await this.current_picture.load_identifications({ force_reload: true });
|
await this.current_picture.load_identifications({ force_reload: true });
|
||||||
|
@ -5,9 +5,7 @@ const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: glob
|
entry: glob.sync("./!(static)/static/webpack/**?(-)index.js").reduce((obj, el) => {
|
||||||
.sync("./!(static)/static/webpack/**?(-)index.js")
|
|
||||||
.reduce((obj, el) => {
|
|
||||||
obj[path.parse(el).name] = `./${el}`;
|
obj[path.parse(el).name] = `./${el}`;
|
||||||
return obj;
|
return obj;
|
||||||
}, {}),
|
}, {}),
|
||||||
|
Loading…
Reference in New Issue
Block a user