summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbie <bie@blekksprut.net>2017-08-04 07:05:12 +0000
committerbie <bie@blekksprut.net>2017-08-04 07:05:12 +0000
commit23b87b2cf914115bfdd7dea7fbea31588964cd79 (patch)
tree2b378e5b0b61635c771359fc81c74735c85b7b07
parent8171e8677431b360c83e69d383e367386e132f32 (diff)
parente1e6b653051119212c4c951096204160f3514f83 (diff)
downloadtears-23b87b2cf914115bfdd7dea7fbea31588964cd79.tar.xz
-rw-r--r--.gitignore1
-rw-r--r--blueprints/anmeldelse.lua6
-rw-r--r--blueprints/artikkel.lua4
-rw-r--r--tears.js36
4 files changed, 43 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index f7dcdea..a164470 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+embed.db
todo
vis
spökvåningen
diff --git a/blueprints/anmeldelse.lua b/blueprints/anmeldelse.lua
index 6df45d7..9f63745 100644
--- a/blueprints/anmeldelse.lua
+++ b/blueprints/anmeldelse.lua
@@ -48,10 +48,10 @@ function artikkel.html(body, data)
if data.portrait then
html.print("<img class='headshot' src='%s'>", data.portrait)
end
- html.print("</aside>")
+ html.dl(data.info)
html.print("<section class=body>")
- html.marxup(data.lead or "")
+ html.print("<p><b>" .. data.lead .. "</b>")
html.marxup(body)
html.print("</section>")
@@ -70,7 +70,7 @@ function artikkel.form(body, data)
html.label{text="Inline-bilde:"}
html.orz{inline = true}
- html.p{}
+ html.print("<p id=lol>")
html.textarea{name='lead', value=data.lead, rows=3}
html.p{}
diff --git a/blueprints/artikkel.lua b/blueprints/artikkel.lua
index 506c701..a4c6de7 100644
--- a/blueprints/artikkel.lua
+++ b/blueprints/artikkel.lua
@@ -19,7 +19,7 @@ function artikkel.html(body, data)
end
html.print("<p class=figure>")
- html.img(data.image)
+ html.img{src = data.image}
html.h2(data.title)
@@ -56,6 +56,8 @@ function artikkel.form(body, data)
html.label{text="Bilde:"}
html.orz{name = "image", value = data.image}
html.p{}
+ html.orz{inline = true}
+ html.print("<p id=lol>")
html.textarea{name='lead', value=data.lead, rows=3}
html.p{}
html.textarea{name='text', value=body}
diff --git a/tears.js b/tears.js
index e4789bf..8cec70f 100644
--- a/tears.js
+++ b/tears.js
@@ -121,6 +121,7 @@ function button(node, html, fun) {
a.innerHTML = html;
a.href = "#";
a.onclick = fun;
+ node.parentNode.insertBefore(document.createTextNode(" "), node.nextSibling);
node.parentNode.insertBefore(a, node.nextSibling);
}
@@ -219,6 +220,41 @@ document.addEventListener("DOMContentLoaded", function(e) {
}
}
}
+
+ var form = document.getElementById('update-article');
+ if(form) {
+ form.onsubmit = function(e) {
+ var stikkord = document.getElementsByName('stikkord');
+ if(stikkord && stikkord[0] && !stikkord[0].value) {
+ stikkord[0].className = "error";
+ return false;
+ }
+ }
+ }
+
+ var infoboxes = document.getElementsByClassName("infobox");
+ for(var i = 0; i < infoboxes.length; i++) {
+ Sortable.create(infoboxes[i]);
+ var items = infoboxes[i].getElementsByTagName('li');
+ for(var j = 0; j < items.length; j++) {
+ if(items[j].className == "last") {
+ var add = document.createElement("a");
+ add.textContent = "+";
+ add.href = "#";
+ add.onclick = additem;
+ items[j].appendChild(add);
+ } else {
+ var del = document.createElement("a");
+ del.textContent = "x";
+ del.href = "#";
+ del.onclick = function(e) {
+ e.target.parentNode.remove();
+ return false;
+ }
+ items[j].appendChild(del);
+ }
+ }
+ }
});