From 330cf88089a17e81fd284ce264b5714777b5fad3 Mon Sep 17 00:00:00 2001 From: Francesco Luzzana Date: Thu, 30 Jun 2022 15:05:45 +0200 Subject: [PATCH] cleanup --- client/components/PadForm.js | 15 +++++++++++++-- client/components/PadTable.js | 10 ++++------ client/index.html | 2 +- client/style.css | 3 ++- pad-bis.py | 6 +----- static/css/js/table.js | 0 6 files changed, 21 insertions(+), 15 deletions(-) delete mode 100644 static/css/js/table.js diff --git a/client/components/PadForm.js b/client/components/PadForm.js index ebb283b..2a1eea2 100644 --- a/client/components/PadForm.js +++ b/client/components/PadForm.js @@ -13,12 +13,23 @@ export default { return [title, overview, overview, categories].some((input) => input.value == ""); }); + const newPad = function () { + let name = title.value.trim().replaceAll(" ", "_"); + let url = `https://pad.xpub.nl/p/${name}`; + window.open(url); + return url; + }; + const submit = function () { + if (link.value == "") { + link.value = newPad(); + } + fetch("https://hub.xpub.nl/soupboat/padliography/", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ - title: title.value, + title: title.value.trim(), link: link.value, overview: overview.value, categories: categories.value, @@ -34,7 +45,7 @@ export default { date.value = null; }; - return { title, link, overview, categories, date, submit, sent, disabled }; + return { title, link, overview, categories, date, submit, newPad, sent, disabled }; }, template: ` diff --git a/client/components/PadTable.js b/client/components/PadTable.js index bd1d1b3..400bac5 100644 --- a/client/components/PadTable.js +++ b/client/components/PadTable.js @@ -77,14 +77,14 @@ export default { return { pads, columns, - sortedPads, - filteredPads, currentPage, - currentSort, - currentSortDir, loaded, + filteredPads, categories, selected, + sortedPads, + currentSort, + currentSortDir, toggle, sort, formatDate, @@ -92,8 +92,6 @@ export default { }, template: ` - -
Loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading etc
diff --git a/client/index.html b/client/index.html index 996b6c8..cc67b68 100644 --- a/client/index.html +++ b/client/index.html @@ -6,7 +6,7 @@ - Padliography Bis + Padliography
diff --git a/client/style.css b/client/style.css index 532d562..ead13bd 100644 --- a/client/style.css +++ b/client/style.css @@ -54,6 +54,7 @@ button.add { width: 2em; height: 2em; font-size: 1em; + margin-left: 8px; } button.submit { @@ -239,6 +240,6 @@ td.categories { transform: scale(100%); } to { - transform: scale(0, 1000%); + transform: scale(0, 1000%) rotate(1turn); } } diff --git a/pad-bis.py b/pad-bis.py index 9268ff2..5ef4b87 100644 --- a/pad-bis.py +++ b/pad-bis.py @@ -16,7 +16,6 @@ from pathlib import Path # datetime to work with dates from datetime import datetime -import dateutil.parser # load the mediawiki credentials from the shared folder @@ -70,9 +69,6 @@ def add_pad(link, title, overview, categories, date): page = site.pages[padliography] text = page.text() - # parsed_date = dateutil.parser.parse(date) - # date = datetime.strftime(parsed_date, 'yyyy-mm-yyyy') - new_row = f'|-\n| {link} || {title} || {overview} || {categories} || {date} \n|-\n' + '|}' text = text.replace('|}', new_row) @@ -125,4 +121,4 @@ def home(): return jsonify(response) -app.run(port=3147, debug=True) +app.run(port=3147) diff --git a/static/css/js/table.js b/static/css/js/table.js deleted file mode 100644 index e69de29..0000000