master
km0 3 years ago
parent 847224d00b
commit 330cf88089

@ -13,12 +13,23 @@ export default {
return [title, overview, overview, categories].some((input) => input.value == ""); 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 () { const submit = function () {
if (link.value == "") {
link.value = newPad();
}
fetch("https://hub.xpub.nl/soupboat/padliography/", { fetch("https://hub.xpub.nl/soupboat/padliography/", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({
title: title.value, title: title.value.trim(),
link: link.value, link: link.value,
overview: overview.value, overview: overview.value,
categories: categories.value, categories: categories.value,
@ -34,7 +45,7 @@ export default {
date.value = null; date.value = null;
}; };
return { title, link, overview, categories, date, submit, sent, disabled }; return { title, link, overview, categories, date, submit, newPad, sent, disabled };
}, },
template: ` template: `

@ -77,14 +77,14 @@ export default {
return { return {
pads, pads,
columns, columns,
sortedPads,
filteredPads,
currentPage, currentPage,
currentSort,
currentSortDir,
loaded, loaded,
filteredPads,
categories, categories,
selected, selected,
sortedPads,
currentSort,
currentSortDir,
toggle, toggle,
sort, sort,
formatDate, formatDate,
@ -92,8 +92,6 @@ export default {
}, },
template: ` template: `
<div v-if="!loaded" class='loading grow'> <div v-if="!loaded" class='loading grow'>
Loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading etc Loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading etc
</div> </div>

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" /> <link rel="stylesheet" href="style.css" />
<script src="https://unpkg.com/vue@3"></script> <script src="https://unpkg.com/vue@3"></script>
<title>Padliography Bis</title> <title>Padliography</title>
</head> </head>
<body> <body>
<div id="app"> <div id="app">

@ -54,6 +54,7 @@ button.add {
width: 2em; width: 2em;
height: 2em; height: 2em;
font-size: 1em; font-size: 1em;
margin-left: 8px;
} }
button.submit { button.submit {
@ -239,6 +240,6 @@ td.categories {
transform: scale(100%); transform: scale(100%);
} }
to { to {
transform: scale(0, 1000%); transform: scale(0, 1000%) rotate(1turn);
} }
} }

@ -16,7 +16,6 @@ from pathlib import Path
# datetime to work with dates # datetime to work with dates
from datetime import datetime from datetime import datetime
import dateutil.parser
# load the mediawiki credentials from the shared folder # load the mediawiki credentials from the shared folder
@ -70,9 +69,6 @@ def add_pad(link, title, overview, categories, date):
page = site.pages[padliography] page = site.pages[padliography]
text = page.text() 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' + '|}' new_row = f'|-\n| {link} || {title} || {overview} || {categories} || {date} \n|-\n' + '|}'
text = text.replace('|}', new_row) text = text.replace('|}', new_row)
@ -125,4 +121,4 @@ def home():
return jsonify(response) return jsonify(response)
app.run(port=3147, debug=True) app.run(port=3147)

Loading…
Cancel
Save