all repos — artbound-python @ 46af02e02321e5eeae46e8af264d3098299ade87

A client-server reimplementation of the administration panel for ArtBound.

disable button while loading
BiRabittoh birabittoh@tilde.team
Fri, 04 Aug 2023 20:07:57 +0200
commit

46af02e02321e5eeae46e8af264d3098299ade87

parent

d179901a594eda7201aa5575d250e91c282fe5c1

3 files changed, 8 insertions(+), 4 deletions(-)

jump to
M README.mdREADME.md

@@ -12,5 +12,5 @@ * Debug: `poetry run flask --app artbound_python run --port 1111 --debug`.

* Production: `poetry run waitress-serve --host 0.0.0.0 --port 1111 artbound_python:app` ## Usage (docker) -1. Generate a `token.json` file: `python get_token.py`; +1. Generate a `token.json` file: `poetry run python get_token.py`; 2. Build the image and start the container: `docker-compose up -d`.
M artbound_python/static/script.jsartbound_python/static/script.js

@@ -8,7 +8,7 @@ WATERMARK = new Image(),

date = new Date(), month_input = document.getElementById("month_input"), month_div = document.getElementById("month_div"), - authorize_button = document.getElementById("authorize_button"), + get_button = document.getElementById("get_button"), selectall_button = document.getElementById("selectall_button"), selectnone_button = document.getElementById("selectnone_button"), togglecolor_button = document.getElementById("togglecolor_button"),

@@ -108,7 +108,9 @@ }

async function updateFanartList() { main_container_div.hidden = false; - content_div.innerHTML = "" + content_div.innerHTML = ""; + get_button.disabled = false; + get_button.innerText = "Aggiungi"; let i = 0; for (fanart of fanarts) {

@@ -229,6 +231,8 @@ return response.json();

} function getArtworks() { + get_button.disabled = true; + get_button.innerText = "…" postData("/", { month: month_input.value }, "application/json").then((data) => { console.log(data); fanarts = fanarts.concat(data);
M artbound_python/templates/index.htmlartbound_python/templates/index.html

@@ -32,7 +32,7 @@ <div id="month_div">

<label for="month_input" style="margin-right: 10px;">Scegli il mese: </label><input id="month_input" type="month" value="2022-08"> <a href="#" class="btn my-2 btn-go" onclick="handleAuthClick()" id="authorize_button" hidden>Vai</a> - <a href="#" class="btn btn-secondary my-2" onclick="getArtworks()">Ottieni</a> + <button class="btn btn-secondary my-2" onclick="getArtworks()" id="get_button">Ottieni</button> </div> <div id="controls" hidden> <a href="#" class="btn btn-secondary my-2" onclick="selectAllNone(1)" id="selectall_button">✅</a>