From 2b23e50893956bda866e89d959f5042d99b4c8f4 Mon Sep 17 00:00:00 2001 From: teldra Date: Mon, 4 Apr 2022 00:42:08 +0200 Subject: [PATCH] small fixes --- themes/buha/i18n/de.toml | 17 ++++- themes/buha/layouts/_default/baseof.html | 2 +- themes/buha/layouts/_default/single.html | 44 ++++++------- .../buha/layouts/partials/orga/generator.html | 20 +++--- .../orga/generator/partials/categories.html | 31 ---------- .../partials/categories_and_tags.html | 62 +++++++++++++++++++ .../orga/generator/partials/expand.html | 2 +- .../orga/generator/partials/input_line.html | 4 +- .../orga/generator/partials/truefalse.html | 7 +-- .../partials/single/article_footer.html | 22 +++++++ themes/buha/static/js/generator.js | 47 +++++++++----- 11 files changed, 172 insertions(+), 86 deletions(-) delete mode 100644 themes/buha/layouts/partials/orga/generator/partials/categories.html create mode 100644 themes/buha/layouts/partials/orga/generator/partials/categories_and_tags.html create mode 100644 themes/buha/layouts/partials/single/article_footer.html diff --git a/themes/buha/i18n/de.toml b/themes/buha/i18n/de.toml index 452a3ec9..517dd44d 100644 --- a/themes/buha/i18n/de.toml +++ b/themes/buha/i18n/de.toml @@ -34,5 +34,20 @@ other = "Kategorien" [category] other = "Kategorie" +[tags] +other = "Tags" + +[tag] +other = "Tag" + +[new] +other = "Neu" + [recurrent] -other = "Regelmäßig" \ No newline at end of file +other = "Regelmäßig" + +[expand] +other = "erweitern" + +[featured] +other = "Featured" diff --git a/themes/buha/layouts/_default/baseof.html b/themes/buha/layouts/_default/baseof.html index 092327ec..939135af 100644 --- a/themes/buha/layouts/_default/baseof.html +++ b/themes/buha/layouts/_default/baseof.html @@ -21,7 +21,7 @@ {{ block "ab" . -}}{{- end }} diff --git a/themes/buha/layouts/_default/single.html b/themes/buha/layouts/_default/single.html index d545d01d..b9027f49 100644 --- a/themes/buha/layouts/_default/single.html +++ b/themes/buha/layouts/_default/single.html @@ -12,26 +12,28 @@ {{ end }} {{ define "ab" }} -
- {{ if .IsTranslated }} -
- {{ "Translations" }} - {{ range .Translations }} -
  • - {{ T .Lang }} -
  • - {{ end }} -
    - {{ end }} -
    - Verfasst am
    - {{ .Date | time.Format ":date_full" }} -
    - {{ if ne .Date .Lastmod }} + {{ if ne .Section "orga" }} +
    + {{ if .IsTranslated }} +
    + {{ "Translations" }} + {{ range .Translations }} +
  • + {{ T .Lang }} +
  • + {{ end }} +
    + {{ end }}
    - zuletzt geändert
    - {{ .Lastmod | time.Format ":date_full" }} + Verfasst am
    + {{ .Date | time.Format ":date_full" }}
    - {{ end }} -
    -{{ end }} \ No newline at end of file + {{ if ne .Date .Lastmod }} +
    + zuletzt geändert
    + {{ .Lastmod | time.Format ":date_full" }} +
    + {{ end }} +
    + {{ end }} +{{ end }} diff --git a/themes/buha/layouts/partials/orga/generator.html b/themes/buha/layouts/partials/orga/generator.html index 5e4e2960..d6a58475 100644 --- a/themes/buha/layouts/partials/orga/generator.html +++ b/themes/buha/layouts/partials/orga/generator.html @@ -1,8 +1,8 @@ {{ define "css" }} {{ end }} -

    Artikelgenerator

    +

    Hier kannst du einen neuen Artikel generieren.

    @@ -23,25 +23,27 @@

    {{ 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" ) }}
    - {{ 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") }}
    {{ partial "orga/generator/partials/expand" (dict "id" "Verschiedenes" "name" "misc" "translation" "aufklappen" ) }}
    {{ 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") }}
    {{ partial "orga/generator/submit" }}
    -
    +
    +
    \ No newline at end of file diff --git a/themes/buha/layouts/partials/orga/generator/partials/categories.html b/themes/buha/layouts/partials/orga/generator/partials/categories.html deleted file mode 100644 index e3e03d80..00000000 --- a/themes/buha/layouts/partials/orga/generator/partials/categories.html +++ /dev/null @@ -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" }} -
    - {{ 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" ) }} -
    -{{ end }} -
    - {{ range sort $categories }} - {{ $n := . | i18n }} - {{ if not $n }} - {{ $n = . }} - {{ end }} -
    - -
    - {{ end }} -
    -
    \ No newline at end of file diff --git a/themes/buha/layouts/partials/orga/generator/partials/categories_and_tags.html b/themes/buha/layouts/partials/orga/generator/partials/categories_and_tags.html new file mode 100644 index 00000000..aef405b1 --- /dev/null +++ b/themes/buha/layouts/partials/orga/generator/partials/categories_and_tags.html @@ -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" }} +
    + {{ $id }}{{- if eq .mandatory "true" -}}*{{- end -}} +{{ else }} + {{ partial "orga/generator/partials/expand" (dict "id" $id "name" $openname ) }} +
    +{{ end }} +
    + {{ range sort $finale }} + {{ $n := . | i18n }} + {{ if not $n }} + {{ $n = . }} + {{ end }} +
    + +
    + {{ end }} +
    + {{ if eq .new "true" }} +
    + {{ partial "orga/generator/partials/input_line" (dict "name" $in0) }} +
    + {{ end }} +
    + + diff --git a/themes/buha/layouts/partials/orga/generator/partials/expand.html b/themes/buha/layouts/partials/orga/generator/partials/expand.html index 6832adaa..08db307d 100644 --- a/themes/buha/layouts/partials/orga/generator/partials/expand.html +++ b/themes/buha/layouts/partials/orga/generator/partials/expand.html @@ -1,2 +1,2 @@ -
    {{ .id }}
    {{ .translation }}{{- if eq .mandatory "true" -}}*{{- end -}}
    +
    {{ .id }}
    {{ if i18n "expand" }}{{ i18n "expand" }}{{ else }}{{ "expand" }}{{ end }}{{- if eq .mandatory "true" -}}*{{- end -}}
    diff --git a/themes/buha/layouts/partials/orga/generator/partials/input_line.html b/themes/buha/layouts/partials/orga/generator/partials/input_line.html index 7b89ad76..962329f1 100644 --- a/themes/buha/layouts/partials/orga/generator/partials/input_line.html +++ b/themes/buha/layouts/partials/orga/generator/partials/input_line.html @@ -1,2 +1,2 @@ - - \ No newline at end of file + + \ No newline at end of file diff --git a/themes/buha/layouts/partials/orga/generator/partials/truefalse.html b/themes/buha/layouts/partials/orga/generator/partials/truefalse.html index 06a3205d..a07afe06 100644 --- a/themes/buha/layouts/partials/orga/generator/partials/truefalse.html +++ b/themes/buha/layouts/partials/orga/generator/partials/truefalse.html @@ -1,6 +1,5 @@ - -
    -
    - Yes +
    +
    {{ if i18n .name }}{{ i18n .name }}{{ else }}{{ .name }}{{ end }}{{- if eq .mandatory "true" -}}*{{- end -}} +
    \ No newline at end of file diff --git a/themes/buha/layouts/partials/single/article_footer.html b/themes/buha/layouts/partials/single/article_footer.html new file mode 100644 index 00000000..fd255f0f --- /dev/null +++ b/themes/buha/layouts/partials/single/article_footer.html @@ -0,0 +1,22 @@ +
    + {{ if .IsTranslated }} +
    + {{ "Translations" }} + {{ range .Translations }} +
  • + {{ T .Lang }} +
  • + {{ end }} +
    + {{ end }} +
    + Verfasst am
    + {{ .Date | time.Format ":date_full" }} +
    + {{ if ne .Date .Lastmod }} +
    + zuletzt geändert
    + {{ .Lastmod | time.Format ":date_full" }} +
    + {{ end }} +
    \ No newline at end of file diff --git a/themes/buha/static/js/generator.js b/themes/buha/static/js/generator.js index acf15a65..6444b552 100644 --- a/themes/buha/static/js/generator.js +++ b/themes/buha/static/js/generator.js @@ -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..
    " } @@ -82,12 +97,12 @@ function showInput(e) { display.innerHTML += "when: \"" + when + "\"
    "; } - if (cats_news != '') { - display.innerHTML += "categories: \[" + cats_news + "]
    "; + if (ncategories) { + display.innerHTML += "categories: \[" + ncategories + "]
    "; } - if (cats_event != '') { - display.innerHTML += "events: \[" + cats_event + "]
    "; + if (events != '') { + display.innerHTML += "events: \[" + events + "]
    "; } if (ntags) {