diff --git a/docker-compose.yml b/docker-compose.yml index a278df5..54359e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: web: build: . - image: umrechner:v1.0.2 + image: umrechner:v1.0.3 restart: unless-stopped environment: - POCKETBASE_URL={$POCKETBASE_URL} diff --git a/hugo/content/_content.gotmpl b/hugo/content/_content.gotmpl index 84a3b76..3914fc4 100644 --- a/hugo/content/_content.gotmpl +++ b/hugo/content/_content.gotmpl @@ -22,7 +22,7 @@ {{ $pbRates := dict }} {{ $latestUpdate := "" }} {{ range $record := $pbData }} - {{ $pbRates = merge $pbRates (dict (lower $record.id) $record.rate) }} + {{ $pbRates = merge $pbRates (dict $record.id $record.rate) }} {{ if or (eq $latestUpdate "") (gt $record.updated $latestUpdate) }} {{ $latestUpdate = $record.updated }} {{ end }} @@ -39,17 +39,17 @@ {{ if not $pbOk }}{{ continue }}{{ end }} {{ $pbCurrencies := slice }} {{ range $record := $pbData }} - {{ $pbCurrencies = $pbCurrencies | append (lower $record.id) }} + {{ $pbCurrencies = $pbCurrencies | append $record.id }} {{ end }} {{ $availableCurrencies := $pbCurrencies | append "eur" }} {{ range $fromCode := $availableCurrencies }} {{ range $toCode := $availableCurrencies }} {{ if eq $fromCode $toCode }}{{ continue }}{{ end }} - {{ $fromName := $fromCode | upper }} + {{ $fromName := $fromCode }} {{ with index $units $fromCode }} {{ $fromName = .name }} {{ end }} - {{ $toName := $toCode | upper }} + {{ $toName := $toCode }} {{ with index $units $toCode }} {{ $toName = .name }} {{ end }} @@ -59,8 +59,8 @@ {{ $description := printf "Konvertieren Sie %s in %s. Einfache und schnelle Umrechnung mit Einheitsumrechner." $fromName $toName }} - {{ $fromCurrency := $fromCode | upper }} - {{ $toCurrency := $toCode | upper }} + {{ $fromCurrency := $fromCode }} + {{ $toCurrency := $toCode }} {{ $fromRate := 1 }} {{ if ne $fromCode "eur" }} {{ $fromRate = index $pbRates $fromCode }} diff --git a/hugo/layouts/_default/baseof.html b/hugo/layouts/_default/baseof.html index 9c12af9..6f8bac3 100644 --- a/hugo/layouts/_default/baseof.html +++ b/hugo/layouts/_default/baseof.html @@ -15,7 +15,8 @@ - {{ block "headscripts" . }}{{ end }} + + diff --git a/hugo/layouts/conversion/single.html b/hugo/layouts/conversion/single.html index d7efabe..ba832e3 100644 --- a/hugo/layouts/conversion/single.html +++ b/hugo/layouts/conversion/single.html @@ -177,7 +177,4 @@ {{ end }} -{{ define "headscripts" }} - - -{{ end }} + diff --git a/hugo/layouts/partials/available-currencies.html b/hugo/layouts/partials/available-currencies.html index 00172a1..5306aa5 100644 --- a/hugo/layouts/partials/available-currencies.html +++ b/hugo/layouts/partials/available-currencies.html @@ -9,7 +9,7 @@ {{ with transform.Unmarshal .Content }} {{ if .items }} {{ range $record := .items }} - {{ $pbCurrencies = $pbCurrencies | append (lower $record.id) }} + {{ $pbCurrencies = $pbCurrencies | append $record.id }} {{ end }} {{ $pbOk = true }} {{ end }} diff --git a/hugo/layouts/partials/available-units.html b/hugo/layouts/partials/available-units.html index 716612c..ea507af 100644 --- a/hugo/layouts/partials/available-units.html +++ b/hugo/layouts/partials/available-units.html @@ -5,8 +5,7 @@ {{ if $pb.ok }} {{ $filtered := dict }} {{ range $slug, $data := $units }} - {{ $slugLower := lower $slug }} - {{ if or (eq $slugLower "eur") (in $pb.currencies $slugLower) }} + {{ if or (eq $slug "eur") (in $pb.currencies $slug) }} {{ $filtered = merge $filtered (dict $slug $data) }} {{ end }} {{ end }} diff --git a/hugo/static/js/converter.js b/hugo/static/js/converter.js index b4c5f7f..1c476b9 100644 --- a/hugo/static/js/converter.js +++ b/hugo/static/js/converter.js @@ -89,13 +89,11 @@ function createConverter(engine, config) { if (!normalized || isNaN(normalized)) { return; } - const fromCode = (config.fromCurrency || '') - .toUpperCase(); - const toCode = (config.toCurrency || '') - .toUpperCase(); - const fromRate = fromCode === 'EUR' + const fromCode = config.fromCurrency || ''; + const toCode = config.toCurrency || ''; + const fromRate = fromCode === 'eur' ? 1 : this.rates[fromCode]; - const toRate = toCode === 'EUR' + const toRate = toCode === 'eur' ? 1 : this.rates[toCode]; if (!fromRate || !toRate) { return; diff --git a/import-currencies.pb.js b/import-currencies.pb.js index 6e40161..e9c3078 100644 --- a/import-currencies.pb.js +++ b/import-currencies.pb.js @@ -23,7 +23,7 @@ function runImport() { let match; while ((match = CURRENCY_RATE_REGEX.exec(xml)) !== null) { rates.push({ - currency: match[1], + currency: match[1].toLowerCase(), rate: parseFloat(match[2]), }); }