small fixes

This commit is contained in:
teldra 2022-04-08 17:21:11 +02:00
parent 2b5708d402
commit ac5f7f7aea
8 changed files with 87 additions and 96 deletions

View File

@ -61,7 +61,7 @@ featured = 'featured'
nonprofit = true
[outputs]
home = ["HTML", "RSS"]
home = ["HTML"]
section = ["HTML", "RSS"]
page = ["HTML"]
taxonomy = ["HTML", "RSS"]

View File

@ -1,5 +1,5 @@
---
title: "About"
title: "Über uns"
---
Wir sind das Buntehaus, ein [soziokulturelles](/bunteshaus/soziokultur) Zentrum in Celle.
Wir leben vom mitmachen und so.
@ -7,4 +7,4 @@ Lerne unsere [Projekte](/bunteshaus/) kennen und schau, was wir unter [Selbstbes
Wir machen Dinge und andere Dinge. Dabei verteilen wir Essen, organisieren Partys und machen Musik.
**Hier sind Details aller Projekte:**
**Hier sind Details aller Projekte:**

View File

@ -4,62 +4,61 @@ date: 2021-06-22T23:00:00+02:00
description: "generator"
type: "tools"
tool: "generator"
divide: "Getrennt durch Komma"
forms:
- to: info@bunteshaus.de
placeholders: false
realnames: false
fields:
- name: title
- title: title
input_type: text
placeholder: Title
name: "Titel"
required: true
- name: content
- title: content
input_type: textarea
placeholder: Content
name: "Inhalt"
required: true
- name: categories
- title: categories
input_type: mc
placeholder: Kategorien
name: "Kategorien"
expanded: true
new: true
- name: when
new: "Neue Kategorien"
- title: when
group: events
input_type: text
placeholder: Datum des Events
- name: price
name: "Datum des Events"
- title: price
group: events
input_type: text
placeholder: Preis
- name: contact
name: "Preis"
- title: contact
group: events
input_type: text
placeholder: Kontakt
- name: events
name: "Kontakt"
- title: events
group: events
input_type: mc
placeholder: Eventkategorien
name: "Eventkategorien"
expanded: false
new: true
- name: featured
new: "Neue Events"
- title: featured
group: misc
input_type: checkbox
placeholder: featured
required: true
- name: about
name: "Featured"
- title: about
group: misc
input_type: checkbox
placeholder: about
required: true
- name: tags
name: "Über uns"
- title: tags
group: misc
input_type: mc
placeholder: Tags
name: "Tags"
expanded: false
new: true
- name: results
new: "Neue Tags"
- title: results
input_type: results
- name: submit
- title: submit
input_type: submit
placeholder: Generate
name: "Erzeugen"
required: true
---
Hier kannst du einen neuen Artikel generieren.

View File

@ -1,21 +1,7 @@
{{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections -}}
{{- $pages := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections -}}
{{- $title := lower .Title -}}
{{- $pages := slice -}}
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $what := printf ".Params.%s" $title -}}
{{- if or (eq $title "about") (eq $title "featured") -}}
{{- $pages = where $posts $what "eq" true -}}
{{- else if or (eq $title "tags") (eq $title "categories") -}}
{{- $pages = $posts -}}
{{- else if eq $title "events" -}}
{{- $pages = where $posts ".Params.when" "ne" nil -}}
{{- else -}}
{{- $pages = .Data.Pages -}}
{{- end -}}
{{- if eq $title "events" -}}
{{- $pages = where $pages ".Params.when" "ne" nil -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}

View File

@ -1,18 +1,13 @@
{{- define "title" -}}
{{ $name := .Name | lower }}
{{ if ne ($name | i18n) "" }}
{{ $name = $name | i18n }}
{{ else }}
{{ if ne .Section "events" }}
{{ $name = $name | singularize }}
{{ end }}
{{ $name = $name | humanize }}
{{ $name := .Name }}
{{ if ne ($name | lower | i18n) "" }}
{{ $name = $name | lower | i18n }}
{{ end }}
<h1>{{ $name }}</h1>
{{- end -}}
{{- define "main" -}}
{{ if site.Params.debug }}taxonomy.html{{ end }}
{{ partial "debug" (dict "context" .) }}
{{ $title := lower .Title }}
{{- $paginator := slice -}}
{{ $partial := "contentlayouts/list.html" }}
@ -27,6 +22,8 @@
{{ $partial = "contentlayouts/termlist.html" }}
{{ else if eq $title "events" }}
{{- $paginator = .Paginate (where $posts ".Params.when" "ne" nil) -}}
{{ else if eq .Section "about" }}
{{- $paginator = .Paginate (where $posts ".Params.about" "eq" true) -}}
{{ else }}
{{- $paginator = .Paginate .Data.Pages -}}
{{ end }}

View File

@ -3,4 +3,5 @@ Title: {{ .context.Title }}<br>
Name: {{ .context.Name }}<br>
context: {{ .context }}<br>
filename: {{ .filename }}<br>
section: {{ .context.Section }}<br>
{{ end }}

View File

@ -1,13 +1,15 @@
{{ $pageform := (index .context.Page.Params.forms .form) }}
{{ $group := slice }}
{{ $divide := .context.Page.Params.divide }}
<form id="myform">
{{ range $pageform.fields }}
{{ if .required }}{{ .Scratch.Set "requiredstar" "" }}{{ else }}{{ .Scratch.Set "requiredstar" " (optioneel)" }}{{ end }}
{{ if .required }}{{ .Scratch.Set "requiredtext" "required" }}{{ else }}{{ .Scratch.Set "requiredtext" "" }}{{ end }}
{{ $title := .title }}
{{ $name := $title }}
{{ if .name }}
{{ $name = .name }}
{{ end }}
{{ if and .group (not (in $group .group))}}
<div class="margin_top_1rem">
@ -15,29 +17,28 @@
{{ partial "misc/expand" (dict "name" (printf "%sgroup" .group)) }}
</div>
{{ $group = $group | append .group }}
{{ end }}
{{ if eq .input_type "title" }}
<h3 {{ if .group }}class="visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'"{{ end }}>{{ .placeholder }}</h3>
<h3 {{ if .group }}class="visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'"{{ end }}>{{- $name -}}{{- if .required -}}{{- " *" -}}{{- end -}}</h3>
{{ else if eq .input_type "textarea" }}
<div {{ if .group }}class="visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'"{{ end }}>
<label {{ if $pageform.placeholders }}sr-only{{ end }} for="{{ .name }}">{{ .placeholder }}{{ .Scratch.Get "requiredstar" }}</label>
<textarea name="{{ .name }}" id="{{ .name }}" rows="10" {{ if $pageform.placeholders }}placeholder="{{ .placeholder }}{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}></textarea>
<label {{ if $pageform.names }}sr-only{{ end }} for="{{ .title }}">{{- $name -}}{{- if .required -}}{{- " *" -}}{{- end -}}</label>
<textarea name="{{ .title }}" id="{{ .title }}" rows="10" {{ if $pageform.names }}placeholder="{{ .name }}{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}></textarea>
</div>
{{ else if eq .input_type "radio" }}
<div class="radio {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
<label><input type="radio" name="{{ .name }}" id="{{ .name }}" value="{{ .placeholder }}" {{ .Scratch.Get "requiredtext" }}>{{ .placeholder }}</label>
<label><input type="radio" name="{{ .title }}" id="{{ .title }}" value="{{ .name }}" {{ .Scratch.Get "requiredtext" }}>{{- $name -}}{{- if .required -}}{{- " *" -}}{{- end -}}</label>
</div>
{{ else if eq .input_type "checkbox" }}
<div class="checkbox {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
<label><input type="checkbox" name="{{ .name }}" id="{{ .name }}" value="{{ .placeholder }}" {{ .Scratch.Get "requiredtext" }}>{{ if i18n .placeholder }}{{ i18n .placeholder }}{{ else }}{{ humanize .placeholder }}{{ end }}</label>
<label><input type="checkbox" name="{{ .title }}" id="{{ .title }}" value="{{ .name }}" {{ .Scratch.Get "requiredtext" }}>{{- $name -}}{{- if .required -}}{{- " *" -}}{{- end -}}</label>
</div>
{{ else if eq .input_type "results" }}
<div id='display' class="result" style="white-space: pre; display: none; background: var(--background-body); padding: .6rem 0 1rem 1rem;"></div>
{{ else if eq .input_type "submit" }}
<div class="margin_top_1rem {{ if .group }}visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
<input type="{{ .input_type }}" value="{{ if i18n "generate" }}{{ i18n "generate" }}{{ else }}{{ "Generate" }}{{ end }}" onclick="showInput(event);" />
<input type="{{ .input_type }}" value="{{- $name -}}" onclick="showInput(event);" />
</div>
@ -48,11 +49,11 @@
{{ else if eq .input_type "mc" }}
{{ $in0 := .name }}
{{ $in0 := .title }}
{{- $finale := slice -}}
{{ $pages := where site.RegularPages "Type" "in" site.Params.searchSections }}
{{ if eq .name "tags" }}
{{ if eq .title "tags" }}
{{ range $pages }}
{{- if .Params.tags -}}
{{- $finale = $finale | append .Params.tags -}}
@ -69,8 +70,8 @@
<div class="margin_top_1rem {{- if .group }} visibleIf" data-visibleif-rule="{{ .group }}group == 'true'"{{ else }}"{{ end }} style="flex-direction: column;">
<div class="{{- if .group }}margin_left_1rem{{ end }}">
{{ .placeholder }}
{{ if ne .expanded true }}{{ partial "misc/expand" (dict "name" (printf "%scat" $in0)) }}{{ end }}
{{ .name }}
{{ if ne .expanded true }}{{ partial "misc/expand" (dict "name" (printf "%scat" $in0)) }}{{ end }}{{- if .required -}}{{- " *" -}}{{- end -}}
</div>
@ -84,9 +85,9 @@
<input type="checkbox" name="{{ $in0 }}" id="{{ $in0 }}-cat" value="{{ . }}"><label for="{{ $in0 }}-cat">{{ . }}</label>
{{ end }}
</fieldset>
{{ if eq .new true }}
<label id="label" for="new{{- .name -}}">{{ if i18n "new" }}{{ i18n "new" }}{{ else }}{{ "New" }}{{ end }} <span style="font-size: x-small;">(Getrennt durch Komma)</span></label>
<input type="text" name="new{{- .name -}}" id="new{{- .name -}}" value="" placeholder="{{ .eg }}" />
{{ if .new }}
<label id="label" for="new{{- .title -}}">{{ .new }} <span style="font-size: x-small;">({{ $divide }})</span></label>
<input type="text" name="new{{- .title -}}" id="new{{- .title -}}" value="" placeholder="{{ .eg }}" />
{{ end }}
</div>
</div>
@ -103,34 +104,34 @@
{{ else }}
{{ if eq .name "name" }}
{{ if eq .title "name" }}
<div class="half {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
<label class="{{ if $pageform.placeholders }}sr-only{{ end }}" for="firstname">First name{{ .Scratch.Get "requiredstar" }}</label>
<input type="text" name="firstname" id="firstname" {{ if $pageform.placeholders }}placeholder="First name{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="firstname">First name{{- if .required -}}{{- " *" -}}{{- end -}}</label>
<input type="text" name="firstname" id="firstname" {{ if $pageform.names }}placeholder="First name{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
</div>
<div class="half {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
<label class="{{ if $pageform.placeholders }}sr-only{{ end }}" for="lastname">Last name{{ .Scratch.Get "requiredstar" }}</label>
<input type="text" name="lastname" id="lastname" {{ if $pageform.placeholders }}placeholder="Last name{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="lastname">Last name{{- if .required -}}{{- " *" -}}{{- end -}}</label>
<input type="text" name="lastname" id="lastname" {{ if $pageform.names }}placeholder="Last name{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
</div>
{{ else if eq .name "address" }}
{{ else if eq .title "address" }}
<div {{- if .group }} class="visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'"{{ end -}}>
<label class="{{ if $pageform.placeholders }}sr-only{{ end }}" for="address">Address{{ .Scratch.Get "requiredstar" }}</label>
<input type="text" name="address" id="address" {{ if $pageform.placeholders }}placeholder="Address{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="address">Address{{- if .required -}}{{- " *" -}}{{- end -}}</label>
<input type="text" name="address" id="address" {{ if $pageform.names }}placeholder="Address{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
</div>
<div class="half {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true{{ end }}">
<label class="{{ if $pageform.placeholders }}sr-only{{ end }}" for="city">City{{ .Scratch.Get "requiredstar" }}</label>
<input type="text" name="city" id="city" {{ if $pageform.placeholders }}placeholder="City{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="city">City{{- if .required -}}{{- " *" -}}{{- end -}}</label>
<input type="text" name="city" id="city" {{ if $pageform.names }}placeholder="City{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
</div>
<div class="half {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
<label class="{{ if $pageform.placeholders }}sr-only{{ end }}" for="postalcode">Postal code{{ .Scratch.Get "requiredstar" }}</label>
<input type="text" name="postalcode" id="postalcode" {{ if $pageform.placeholders }}placeholder="Postal code{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="postalcode">Postal code{{- if .required -}}{{- " *" -}}{{- end -}}</label>
<input type="text" name="postalcode" id="postalcode" {{ if $pageform.names }}placeholder="Postal code{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
</div>
{{ else }}
<div class="margin_top_1rem {{ if .group }} visibleIf margin_left_1rem" data-visibleif-rule=" {{ .group }}group == 'true' {{ end }}" class="minmax">
<div class="minmax" style="display: flex; flex-direction: column;">
<label class="{{ if $pageform.placeholders }}sr-only{{ end }}" for="{{ .name }}">{{ .placeholder }}{{ .Scratch.Get "requiredstar" }}</label>
<input type="{{ .input_type }}" name="{{ .name }}" id="{{ .name }}" {{ if $pageform.placeholders }}placeholder="{{ .placeholder }}{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="{{ .title }}">{{ .name }}{{- if .required -}}{{- " *" -}}{{- end -}}</label>
<input type="{{ .input_type }}" name="{{ .title }}" id="{{ .title }}" {{ if $pageform.names }}placeholder="{{ .name }}{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
</div>
</div>
{{ end }}

View File

@ -42,12 +42,19 @@
{{ end }}
<a href="{{- "links" | absLangURL -}}">{{- $links | strings.FirstUpper -}}</a><br><br>
{{- end -}}
{{- with .OutputFormats.Get "rss" -}}
{{- if .Permalink -}}
{{- printf `<a href="%s">` .Permalink | safeHTML -}}
{{- end -}}
RSS</a><br><br>
{{- end -}}
{{- if not (or (eq .Section "featured") (eq .Section "about")) -}}
{{ if .IsHome }}
{{- printf `<a href="%s">` "/news/index.xml" | safeHTML -}}
RSS</a><br><br>
{{ else }}
{{- with .OutputFormats.Get "rss" -}}
{{- if .Permalink -}}
{{- printf `<a href="%s">` .Permalink | safeHTML -}}
{{- end -}}
RSS</a><br><br>
{{- end -}}
{{ end }}
{{ end }}
<a href="https://schlomp.space/Bunteshaus/bunteshaus.de">Sourcecode</a>
</div>