master
km0 3 years ago
parent 847224d00b
commit 330cf88089

@ -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: `

@ -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: `
<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
</div>

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

@ -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);
}
}

@ -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)

Loading…
Cancel
Save