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