Skip to content
Snippets Groups Projects
Commit 9ccd4e3f authored by Thomas Schneider's avatar Thomas Schneider
Browse files

Merge branch 'layout-index' into 'main'

apply layout of "template preview" for index page "schilder preview"

Closes #1

See merge request !6
parents 9a6b64bd 6c951e16
No related branches found
No related tags found
1 merge request!6apply layout of "template preview" for index page "schilder preview"
Pipeline #6394 passed
...@@ -87,9 +87,11 @@ a { ...@@ -87,9 +87,11 @@ a {
} }
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
&, label {
cursor: pointer; cursor: pointer;
} }
} }
}
nav { nav {
&, #nav-links { &, #nav-links {
...@@ -289,15 +291,19 @@ main { ...@@ -289,15 +291,19 @@ main {
} }
} }
&:hover .option-border {
border-color: var(--accent2);
}
input[type = "radio"] { input[type = "radio"] {
display: none; display: none;
&:checked + .option-border { &:checked + .option-border {
border-color: var(--accent2); border-color: var(--accent);
} }
} }
label { .preview-label {
flex-grow: 1; flex-grow: 1;
// firefox hat hier lack gesoffen und erfindet 5px wenn das hier block oder // firefox hat hier lack gesoffen und erfindet 5px wenn das hier block oder
// inline ist // inline ist
...@@ -305,6 +311,14 @@ main { ...@@ -305,6 +311,14 @@ main {
} }
} }
a.option:hover {
text-decoration: none;
.option-border {
border-color: var(--accent2);
}
}
input[type = "radio"] { input[type = "radio"] {
display: none; display: none;
} }
......
...@@ -11,29 +11,32 @@ function onInputHandler(event: Event) { ...@@ -11,29 +11,32 @@ function onInputHandler(event: Event) {
window.addEventListener("load", () => { window.addEventListener("load", () => {
if (document.getElementById('preview')) { if (document.getElementById('preview')) {
for (const el of document.getElementsByClassName('input-dispatch')) { for (const el of document.getElementsByClassName('input-dispatch')) {
console.log(el); console.debug(el);
el.addEventListener('input', onInputHandler); el.addEventListener('input', onInputHandler);
} }
}
for (const op of document.querySelectorAll('.option .preview')) { for (const op of document.querySelectorAll('.option .preview')) {
console.log(op); console.debug(op);
const input_id = (op as HTMLElement).dataset.for; const input_id = (op as HTMLElement).dataset.for;
if (!input_id) { let handler: (_: Event) => void;
console.error("Missing data-for attribute for", op); if (input_id) {
continue;
}
const input = document.getElementById(input_id); const input = document.getElementById(input_id);
if (!input || input === null) { if (!input || input === null) {
console.error("Unable to find input for", op); console.error("Unable to find input for", op);
continue; continue;
} }
const handler = (_: Event) => { handler = (_: Event) => {
console.log("clicked");
(input as HTMLInputElement).checked = true; (input as HTMLInputElement).checked = true;
}; }
} else {
const p = (op as HTMLElement).parentNode;
handler = (_: Event) => {
window.location.href = (p as HTMLAnchorElement).href;
}
}
op.addEventListener('click', handler); op.addEventListener('click', handler);
(op as HTMLIFrameElement).contentDocument?.addEventListener('click', handler); (op as HTMLIFrameElement).contentDocument?.addEventListener('click', handler);
} }
}
}); });
...@@ -6,19 +6,18 @@ ...@@ -6,19 +6,18 @@
{% block main %} {% block main %}
<h2>Existierende Schilder:</h2> <h2>Existierende Schilder:</h2>
<div class="sign-grid"> {#- wir klauen uns hier an der Stelle einfach mal das Layout vom schild templateselect #}
<div class="select templateselect">
{%- for schild in schilder %} {%- for schild in schilder %}
<a class="sign" href="{{ url_for('.schild', ident=schild.ident) }}"> <a class="sign option" href="{{ url_for('.schild', ident=schild.ident) }}">
<div>
<iframe <iframe
class="preview preview-small" class="preview option-border"
src="{{ url_for('instance.schild_html', ident=schild.ident) }}" src="{{ url_for('instance.schild_html', ident=schild.ident) }}"
id="preview:{{ schild.ident }}"> id="preview:{{ schild.ident }}">
</iframe> </iframe>
<label for="preview:{{ schild.ident }}" class="preview-label"> <label for="preview:{{ schild.ident }}" class="preview-label">
{{ schild.title }} {{ schild.title }}
</label> </label>
</div>
</a> </a>
{%- endfor %} {%- endfor %}
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment