Katalog Kategorie hinzugefügt

This commit is contained in:
Patrick Neff 2019-05-03 01:20:04 +02:00
parent 78e8d68266
commit 37ff04cb6a
15 changed files with 196 additions and 66 deletions

View File

@ -34,10 +34,10 @@ googleAnalytics = "UA-12671637-1"
weight = -800 weight = -800
[[menu.main]] [[menu.main]]
identifier = "galerie" identifier = "katalog"
name = "Galerie" name = "Katalog"
title = "Galerie" title = "Katalog"
url = "/galerie" url = "/katalog"
weight = -500 weight = -500
[[menu.main]] [[menu.main]]

View File

@ -5,7 +5,11 @@ draft = false
price = "" price = ""
type = "catalog" type = "catalog"
alt = "Bildergalerie für Test" alt = "Bildergalerie für Test"
description = "Bildergalerie für Test" description = ""
material = "Material, Bearbeitungsart"
ornament = "Ornament"
article_id = "Artikel Nummer"
used_for = ["Doppelgrab", "Einzelgrab"]
keywords = [] keywords = []
[[resources]] [[resources]]
@ -14,5 +18,3 @@ keywords = []
[resources.params] [resources.params]
alt = "Bild von einem Test" alt = "Bild von einem Test"
+++ +++
{{< gallery "bilder/**.jpg" >}}

View File

@ -1,11 +1,12 @@
+++ +++
title = "{{ replace .Name "-" " " | title }}" title = "{{ replace .Name "-" " " | title }}"
date = "{{ .Date }}"
draft = true draft = true
price = ""
type = "catalog" type = "catalog"
alt = "Bildergalerie für {{ replace .Name "-" " " | title }}" alt = "{{ replace .Name "-" " " | title }}"
description = "Bildergalerie für {{ replace .Name "-" " " | title }}" description = "Kurzbeschreibung"
material = "Material, Bearbeitungsart"
ornament = "Ornament"
article_id = "Artikel Bezeichnung"
keywords = [] keywords = []
[[resources]] [[resources]]

View File

@ -16,7 +16,7 @@
{{ else }} {{ else }}
{{ $image = index $images 0 }} {{ $image = index $images 0 }}
{{ end }} {{ end }}
{{ with $images }} {{ with $image }}
<li class="padding"> {{- partial "figure.html" (dict "ctx" $ctx "image" $image "class" "gallery" "showTitle" true "showDescription" true) -}} <li class="padding"> {{- partial "catalog.html" (dict "ctx" $ctx "image" . "class" "catalog" "showTitle" true "showDescription" true) -}}
</li> </li>
{{ end }} {{ end }}

View File

@ -0,0 +1,16 @@
{{- define "title" -}}
{{ .Title }} &bull; {{ .Site.Title }}
{{- end -}}
{{- define "main" -}}
<main id="single">
<article>
{{- partial "single.html" . -}}
<div class="flex column">
<div class="padding">
<model-viewer model-url="#"></model-viewer>
</div>
</div>
</article>
</main>
{{- end -}}

View File

@ -0,0 +1,45 @@
{{- $ctx := .ctx }}
{{- $title := .ctx.Title -}}
{{- $alt := .ctx.Params.alt -}}
{{- $description := .ctx.Params.description | markdownify -}}
{{- $class := .class -}}
{{- $href := .ctx.Params.href }}
<figure {{- with .class }} class="{{ . }}"{{- end -}}>
{{ with .image }}
{{- $imageSm := .Fill "300x300 Top" -}}
{{- $imageMd := .Fill "500x500 Top" -}}
<img alt="{{ $alt }}"
title="{{ $title }}"
class="{{ $class }}"
srcset="{{ $imageSm.RelPermalink }} 300w, {{ $imageMd.RelPermalink }} 500w"
sizes="(max-width: 300px) 300px, 500px"
src="{{ $imageMd.RelPermalink }}" />
{{- partial "schema/img.html" (dict "image" . "ctx" $ctx) -}}
{{ end }}
<figcaption class="overlay description hidden">
<a href="{{ $ctx.Permalink }}"><h3>{{ $title }}</h3></a>
{{- with $description -}}
<p class="description">{{- . -}}</p>
{{- end -}}
<p class="material">Material: {{ .ctx.Params.material}}</p>
{{ with .ctx.Params.ornament }}
<p class="ornament">Ornament: {{ . }}</p>
{{ end }}
<p class="type">Typ: {{ range $index, $value := .ctx.Params.used_for }}{{ if $index }}, {{end}}{{ . }}{{end}}</p>
<p class="article_id">Art. Nr.: {{ .ctx.Params.article_id }}</p>
</figcaption>
<noscript>
<figcaption class="description">
<a href="{{$href}}"><h3>{{ $title }}</h3></a>
{{- with $description -}}
<p>{{- . -}}</p>
{{- else -}}
<p>{{- $alt -}}</p>
{{- end -}}
<p>
{{ .ctx.Params.material}}
</p>
</figcaption>
</noscript>
</figure>

View File

@ -9,8 +9,12 @@
{{- partial "schema/collectionpage.html" . -}} {{- partial "schema/collectionpage.html" . -}}
{{- end -}} {{- end -}}
{{- $css := resources.Get "css/style.css" -}} {{- $css := resources.Get "css/style.css" -}}
{{ if .Site.IsServer }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
{{ else }}
{{- $css = $css | resources.Fingerprint -}} {{- $css = $css | resources.Fingerprint -}}
<link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}"> <link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}">
{{ end }}
<link rel="shortcut icon" href="/img/favicon.ico"> <link rel="shortcut icon" href="/img/favicon.ico">
<link rel="icon" type="image/svg+xml" href="/img/favicon.svg"> <link rel="icon" type="image/svg+xml" href="/img/favicon.svg">
<link rel="icon" type="image/png" href="/img/favicon.png" sizes="32x32"> <link rel="icon" type="image/png" href="/img/favicon.png" sizes="32x32">

View File

@ -2,5 +2,9 @@
var $googleAnalytics = '{{ .Site.GoogleAnalytics }}'; var $googleAnalytics = '{{ .Site.GoogleAnalytics }}';
</script> </script>
{{- $js := resources.Get "js/bundle.js" -}} {{- $js := resources.Get "js/bundle.js" -}}
{{ if .Site.IsServer }}
<script src="{{ $js.RelPermalink }}"></script>
{{ else }}
{{- $js = $js | resources.Fingerprint -}} {{- $js = $js | resources.Fingerprint -}}
<script src="{{ $js.Permalink }}" integrity="{{ $js.Data.Integrity }}"></script> <script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
{{ end }}

View File

@ -0,0 +1,45 @@
function showOverlay(el) {
let classes = el.className;
if (classes.indexOf('hidden') !== -1) {
el.className = classes.replace(/ ?hidden ?/, '')
}
}
function hideOverlay(el) {
let classes = el.className;
if (classes.indexOf('hidden') === -1) {
el.className = classes + ' hidden'
}
}
function toggleOverlay(el) {
if (el.className.indexOf('hidden') === -1) {
hideOverlay(el)
} else {
showOverlay(el)
}
}
function addListeners(el, overlay) {
var isTouchSupported = "ontouchend" in document;
if (isTouchSupported) {
el.addEventListener('touchstart', ev => {
ev.preventDefault()
toggleOverlay(overlay)
})
} else {
el.addEventListener('mouseover', ev => {
ev.preventDefault()
showOverlay(overlay)
})
el.addEventListener('mouseleave', ev => {
ev.preventDefault()
hideOverlay(overlay)
})
}
}
document.querySelectorAll('figure').forEach(figure => {
let overlay = figure.querySelector('.overlay')
addListeners(figure, overlay)
})

View File

@ -1,5 +1,6 @@
import "./cookies" import "./cookies"
import "./lightbox" import "./lightbox"
import "./scrollspy" import "./scrollspy"
import "./catalogSimilar" import "./catalog"
//import "./catalogSimilar"
import "./modelViewer"

View File

@ -0,0 +1,9 @@
import Vue from "vue"
import ModelViewer from "../vue/ModelViewer.vue"
import wrap from '@vue/web-component-wrapper'
const myModelViewer = wrap(Vue, ModelViewer)
window.customElements.define('model-viewer', myModelViewer)

View File

@ -292,14 +292,33 @@ img.original {
figure { figure {
max-width: 100%; max-width: 100%;
position: relative;
img { img {
width: 100%; width: 100%;
height: auto; height: auto;
} }
figcaption { figcaption {
color: $font-color; &.overlay {
&.hidden {
visibility: hidden;
}
position: absolute;
background-color: rgba(230,230,230,0.85);
top: 0;
left: 0;
bottom: 0;
right: 0;
border-radius: $border-radius;
text-align: center;
padding: $gutter-width;
text-shadow: 1px 1px 2px white;
}
color: $font-color;
} }
} }

View File

@ -0,0 +1,10 @@
<template>
<div>{{ modelUrl }}</div>
</template>
<script>
export default {
name: 'model-viewer',
props: ['model-url'],
}
</script>

View File

@ -1,4 +1,6 @@
const VueLoaderPlugin = require("vue-loader/lib/plugin") const VueLoaderPlugin = require("vue-loader/lib/plugin")
const CleanWebpackPlugin = require("clean-webpack-plugin")
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const path = require("path") const path = require("path")
module.exports = { module.exports = {
@ -26,6 +28,13 @@ module.exports = {
{ {
test: /\.(sa|sc|c)ss$/, test: /\.(sa|sc|c)ss$/,
use: [ use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: "../",
sourceMap: true
}
},
{ {
loader: "css-loader", loader: "css-loader",
options: { options: {
@ -129,6 +138,18 @@ module.exports = {
] ]
}, },
plugins: [ plugins: [
new VueLoaderPlugin() new VueLoaderPlugin(),
new CleanWebpackPlugin([
"assets/css/*",
"assets/js/*",
"static/fonts/*",
"static/img/*"
]),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "css/[name].css",
chunkFilename: "css/[id].css"
})
], ],
} }

View File

@ -1,59 +1,12 @@
const merge = require("webpack-merge") const merge = require("webpack-merge")
const common = require("./webpack.common.js") const common = require("./webpack.common.js")
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const CleanWebpackPlugin = require("clean-webpack-plugin")
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin") const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin")
module.exports = merge(common, { module.exports = merge(common, {
mode: "production", mode: "production",
module: { module: {
rules: [
{
test: /\.(sa|sc|c)ss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: "../",
sourceMap: true
}
},
{
loader: "css-loader",
options: {
sourceMap: true
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true
}
},
{
loader: "sass-loader",
options: {
implementation: require("sass"),
sourceMap: true
}
}
]
}
]
}, },
plugins: [ plugins: [
new CleanWebpackPlugin([
"assets/css/*",
"assets/js/*",
"static/fonts/*",
"static/img/*"
]),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "css/[name].css",
chunkFilename: "css/[id].css"
})
], ],
optimization: { optimization: {
usedExports: true, usedExports: true,