small fixes

This commit is contained in:
teldra 2022-04-04 00:42:08 +02:00
parent 44ec3ceb55
commit 2b23e50893
11 changed files with 172 additions and 86 deletions

View File

@ -34,5 +34,20 @@ other = "Kategorien"
[category]
other = "Kategorie"
[tags]
other = "Tags"
[tag]
other = "Tag"
[new]
other = "Neu"
[recurrent]
other = "Regelmäßig"
other = "Regelmäßig"
[expand]
other = "erweitern"
[featured]
other = "Featured"

View File

@ -21,7 +21,7 @@
</div>
{{ block "ab" . -}}{{- end }}
<footer>
{{- partial "structure/footer" . -}}
{{- partialCached "structure/footer" . -}}
</footer>
</div>
</body>

View File

@ -12,26 +12,28 @@
{{ end }}
{{ define "ab" }}
<div id="article_footer">
{{ if .IsTranslated }}
<div style="flex-grow: 0; flex-direction: column; margin-right: 1rem;">
<b>{{ "Translations" }}</b>
{{ range .Translations }}
<li style="list-style: none; text-decoration: none; font-size: x-small; color: var(--text-muted);">
<a href="{{ .Permalink }}" class="underline">{{ T .Lang }}</a>
</li>
{{ end }}
</div>
{{ end }}
<div style="flex-grow: 1; flex-direction: column;">
<b>Verfasst am</b><br>
{{ .Date | time.Format ":date_full" }}
</div>
{{ if ne .Date .Lastmod }}
{{ if ne .Section "orga" }}
<div id="article_footer">
{{ if .IsTranslated }}
<div style="flex-grow: 0; flex-direction: column; margin-right: 1rem;">
<b>{{ "Translations" }}</b>
{{ range .Translations }}
<li style="list-style: none; text-decoration: none; font-size: x-small; color: var(--text-muted);">
<a href="{{ .Permalink }}" class="underline">{{ T .Lang }}</a>
</li>
{{ end }}
</div>
{{ end }}
<div style="flex-grow: 1; flex-direction: column;">
<b>zuletzt geändert</b><br>
{{ .Lastmod | time.Format ":date_full" }}
<b>Verfasst am</b><br>
{{ .Date | time.Format ":date_full" }}
</div>
{{ end }}
</div>
{{ end }}
{{ if ne .Date .Lastmod }}
<div style="flex-grow: 1; flex-direction: column;">
<b>zuletzt geändert</b><br>
{{ .Lastmod | time.Format ":date_full" }}
</div>
{{ end }}
</div>
{{ end }}
{{ end }}

View File

@ -1,8 +1,8 @@
{{ define "css" }}
<link rel="stylesheet" href="/css/visibleIf.css" type="text/css" />
{{ end }}
<h1>Artikelgenerator</h1>
<article>
<p>
Hier kannst du einen neuen Artikel generieren.<br><br>
@ -23,25 +23,27 @@
<form id="myform" style="display: flex; flex-shrink: 0; flex-grow: 1; flex-direction: column; max-width: 950px;">
{{ partial "orga/generator/partials/input_line" (dict "name" "title" "mandatory" "true") }}
{{ partial "orga/generator/content" }}
{{ partial "orga/generator/partials/categories" (dict "name" "news" "expanded" "true") }}
{{ partial "orga/generator/partials/categories_and_tags.html" (dict "name" "categories" "expanded" "true" "new" "false") }}
{{ partial "orga/generator/partials/expand" (dict "id" "Ist es ein Event?" "name" "isevent" "translation" "aufklappen" ) }}
<div style="flex-direction: column; margin-left: 2rem;" class="visibleIf" data-visibleif-rule="isevent == 'true'">
{{ partial "orga/generator/partials/input_line" (dict "name" "when" "mandatory" "false") }}
{{ partial "orga/generator/partials/input_line" (dict "name" "price" "mandatory" "false") }}
{{ partial "orga/generator/partials/input_line" (dict "name" "covid" "mandatory" "false") }}
{{ partial "orga/generator/partials/input_line" (dict "name" "registeremail" "mandatory" "false") }}
{{ partial "orga/generator/partials/categories" (dict "name" "event" "expanded" "true") }}
{{ partial "orga/generator/partials/input_line" (dict "name" "when" "mandatory" "false" "eg" "Montag, 13. September 2022, 19Uhr") }}
{{ partial "orga/generator/partials/input_line" (dict "name" "price" "mandatory" "false" "eg" "3€ or free") }}
{{ partial "orga/generator/partials/input_line" (dict "name" "registeremail" "mandatory" "false" "eg" "info@bunteshaus.de") }}
{{ partial "orga/generator/partials/categories_and_tags.html" (dict "name" "events" "new" "false") }}
</div>
{{ partial "orga/generator/partials/expand" (dict "id" "Verschiedenes" "name" "misc" "translation" "aufklappen" ) }}
<div style="flex-direction: column; margin-left: 2rem;" class="visibleIf" data-visibleif-rule="misc == 'true'">
{{ partial "orga/generator/partials/truefalse" (dict "name" "featured" "expanded" "true") }}
{{ partial "orga/generator/tags" }}
{{ partial "orga/generator/partials/truefalse" (dict "name" "about" "expanded" "true") }}
{{ partial "orga/generator/partials/categories_and_tags.html" (dict "name" "tags" "new" "true") }}
{{ partial "orga/generator/partials/input_line" (dict "name" "covid" "mandatory" "false" "eg" "3G") }}
</div>
{{ partial "orga/generator/submit" }}
</form>
<div id='display' class="result" style="white-space: pre;"></div>
<div id='display' class="result" style="white-space: pre; background: green;"></div>
</article>
<script defer language="javascript" type="text/javascript" src="{{ "/js/visibleIf.js" | urlize | relURL }}"></script>
<script defer language="javascript" type="text/javascript" src="{{ "/js/generator.js" | urlize | relURL }}"></script>

View File

@ -1,31 +0,0 @@
{{ $in0 := printf "%s" .name }}
{{ $in1 := printf "%scategories" .name }}
{{ $in2 := printf "%scategory" .name }}
{{ $openname := printf "open%s" .name }}
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- $categories := slice -}}
{{ range $pages }}
{{ range .Param $in1 }}
{{- $categories = $categories | append . -}}
{{ end }}
{{ end }}
{{- $categories := $categories | uniq -}}
{{ if eq .expanded "true" }}
<div style="flex-direction: column;">
{{ if i18n .name }}{{ i18n .name }}{{ else }}{{ .name }}{{ end }}{{- if eq .mandatory "true" -}}*{{- end -}}
{{ else }}
{{ partial "orga/generator/partials/expand" (dict "id" $in0 "name" $openname "translation" "aufklappen" ) }}
<div style="flex-direction: column;" class="visibleIf" data-visibleif-rule="{{- $openname }} == 'true'">
{{ end }}
<fieldset style="max-width: 58.5rem;" id="{{ $in1 }}" name="{{ $in1 }}">
{{ range sort $categories }}
{{ $n := . | i18n }}
{{ if not $n }}
{{ $n = . }}
{{ end }}
<div style="display: flex; flex-direction: row;">
<input type="checkbox" name="{{ $in2 }}" id="{{ $in0 }}-cat" value="{{ $n }}"><label style="width: 20rem;" for="{{ $in0 }}-cat">{{ strings.FirstUpper $n }}</label>
</div>
{{ end }}
</fieldset>
</div>

View File

@ -0,0 +1,62 @@
{{ $in0 := .name }}
{{ $name := .name }}
{{ $id := .name }}
{{ $newname := .name }}
{{ if i18n $name }}
{{ $name = i18n $name }}
{{ end }}
{{ $openname := printf "open%s" $in0 }}
{{- $finale := slice -}}
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ if eq .name "tags" }}
{{ range $pages }}
{{- if .Params.tags -}}
{{- $finale = $finale | append .Params.tags -}}
{{ end }}
{{ end }}
{{ $id = $name }}
{{ else }}
{{ range $pages }}
{{ range .Param $in0 }}
{{- $finale = $finale | append . -}}
{{ end }}
{{ end }}
{{ if ne .name "categories" }}
{{ $cat := "categories" }}
{{ if i18n $cat }}
{{ $cat = i18n $cat }}
{{ end }}
{{ $id = printf "%s %s" $name $cat }}
{{ else }}
{{ $id = $name }}
{{ end }}
{{ end }}
{{- $finale = $finale | uniq -}}
{{ if eq .expanded "true" }}
<div style="flex-direction: column;">
{{ $id }}{{- if eq .mandatory "true" -}}*{{- end -}}
{{ else }}
{{ partial "orga/generator/partials/expand" (dict "id" $id "name" $openname ) }}
<div style="flex-direction: column;" class="visibleIf" data-visibleif-rule="{{- $openname }} == 'true'">
{{ end }}
<fieldset style="max-width: 58.5rem; padding: 0; margin: 0; border-style: none;" id="{{ $in0 }}" name="{{ $in0 }}">
{{ range sort $finale }}
{{ $n := . | i18n }}
{{ if not $n }}
{{ $n = . }}
{{ end }}
<div style="display: flex; flex-direction: row;">
<input type="checkbox" name="{{ $in0 }}" id="{{ $in0 }}-cat" value="{{ $n }}"><label style="width: 20rem;" for="{{ $in0 }}-cat">{{ strings.FirstUpper $n }}</label>
</div>
{{ end }}
</fieldset>
{{ if eq .new "true" }}
<div style="flex-direction: column;">
{{ partial "orga/generator/partials/input_line" (dict "name" $in0) }}
</div>
{{ end }}
</div>

View File

@ -1,2 +1,2 @@
<div style="display:flex; flex-direction: row;"> {{ .id }} <input type="checkbox" name="{{ .name }}" value="true" style="font-size: smaller;" /> <div style="font-size: smaller;">{{ .translation }}{{- if eq .mandatory "true" -}}*{{- end -}}</div></div>
<div style="display:flex; flex-direction: row;">{{ .id }}<input type="checkbox" name="{{ .name }}" value="true" style="font-size: smaller;" /> <div style="font-size: smaller;">{{ if i18n "expand" }}{{ i18n "expand" }}{{ else }}{{ "expand" }}{{ end }}{{- if eq .mandatory "true" -}}*{{- end -}}</div></div>

View File

@ -1,2 +1,2 @@
<label for="{{ .name }}">{{ if i18n .name }}{{ i18n .name }}{{ else }}{{ .name }}{{ end }}{{- if eq .mandatory "true" -}}*{{- end -}}</label>
<input type="text" name="{{ .name }}" id="{{ .name }}" value="" placeholder="" />
<label for="new{{- .name -}}">{{ if i18n .name }}{{ i18n .name }}{{ else }}{{ .name }}{{ end }}{{- if eq .mandatory "true" -}}*{{- end -}}</label>
<input type="text" name="new{{- .name -}}" id="new{{- .name -}}" value="" placeholder="{{ .eg }}" />

View File

@ -1,6 +1,5 @@
<label for="{{ .name }}">{{ if i18n .name }}{{ i18n .name }}{{ else }}{{ .name }}{{ end }}{{- if eq .mandatory "true" -}}*{{- end -}}</label>
<fieldset id="{{ .name }}" name="{{ .name }}">
<div style="display: flex; flex-direction: row;">
<input type="checkbox" name="{{ .name }}" id="{{ .name }}" value="{{ .name }}" />Yes
<fieldset id="{{ .name }}" name="{{ .name }}" style="padding: 0; margin: 0; border-style: none;">
<div style="display: flex; flex-direction: row;">{{ if i18n .name }}{{ i18n .name }}{{ else }}{{ .name }}{{ end }}{{- if eq .mandatory "true" -}}*{{- end -}}
<input type="checkbox" name="{{ .name }}" id="{{ .name }}" value="{{ .name }}" />
</div>
</fieldset>

View File

@ -0,0 +1,22 @@
<div id="article_footer" style="margin-top: 0; margin-bottom: 0; background: green; padding: 0;">
{{ if .IsTranslated }}
<div style="flex-grow: 0; flex-direction: column; margin-right: 1rem;">
<b>{{ "Translations" }}</b>
{{ range .Translations }}
<li style="list-style: none; text-decoration: none; font-size: x-small; color: var(--text-muted);">
<a href="{{ .Permalink }}" class="underline">{{ T .Lang }}</a>
</li>
{{ end }}
</div>
{{ end }}
<div style="flex-grow: 1; flex-direction: column;">
<b>Verfasst am</b><br>
{{ .Date | time.Format ":date_full" }}
</div>
{{ if ne .Date .Lastmod }}
<div style="flex-grow: 1; flex-direction: column;">
<b>zuletzt geändert</b><br>
{{ .Lastmod | time.Format ":date_full" }}
</div>
{{ end }}
</div>

View File

@ -33,31 +33,46 @@ function showInput(e) {
var datestring = d.getFullYear() + "-" + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "T" + ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2) + ":00+02:00\"";
var form = document.querySelector('form[id="myform"]');
var title = form.elements['title'].value;
var title = form.elements['newtitle'].value;
var content = form.elements['content'].value;
var when = form.elements['when'].value;
var covid = form.elements['covid'].value;
var price = form.elements['price'].value;
var registeremail = form.elements['registeremail'].value;
var cats_event = check_checkboxes('eventcategory');
var cats_news = check_checkboxes('newscategory');
var when = form.elements['newwhen'].value;
var covid = form.elements['newcovid'].value;
var price = form.elements['newprice'].value;
var registeremail = form.elements['newregisteremail'].value;
var events = check_checkboxes('events');
if (form.elements['newevents']) { var newevents = testor(form.elements['newevents'].value.split(',')); }
var categories = check_checkboxes('categories');
if (form.elements['newcategories']) { var newcategories = testor(form.elements['newcategories'].value.split(',')); }
var tags = check_checkboxes('tags');
var newtag = testor(form.elements['newtag'].value.split(','));
if (form.elements['newtags']) { var newtags = testor(form.elements['newtags'].value.split(',')); }
var featured = check_checkboxes('featured');
if (newtag != '""') {
var ntags = newtag;
if (newtags != '""') {
var ntags = newtags;
}
if (tags != '') {
var ntags = tags;
}
if (tags != '' && newtag != '""') {
var ntags = tags + "," + newtag;
if (tags != '' && newtags != '""') {
var ntags = tags + "," + newtags;
}
if (newcategories != '""') {
var ncategories = newcategories;
}
if (categories != '') {
var ncategories = categories;
}
if (categories != '' && newcategories != '""') {
var ncategories = categories + "," + newcategories;
}
if (!title) {
display.innerHTML += "Title is missing..<br>"
}
@ -82,12 +97,12 @@ function showInput(e) {
display.innerHTML += "when: \"" + when + "\"<br>";
}
if (cats_news != '') {
display.innerHTML += "categories: \[" + cats_news + "]<br>";
if (ncategories) {
display.innerHTML += "categories: \[" + ncategories + "]<br>";
}
if (cats_event != '') {
display.innerHTML += "events: \[" + cats_event + "]<br>";
if (events != '') {
display.innerHTML += "events: \[" + events + "]<br>";
}
if (ntags) {