collection.de.md 4.8 KB
Newer Older
Tobias Buckdahn's avatar
Tobias Buckdahn committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
title: Abstände
icon: icon.png
filter: filter-offsets

content:
    items: 
        - '@taxonomy.function': stud_shift
        - '@taxonomy.function': stud_lift
    filter:
        published: true
        type: 'tech'    
    order:
        by: header.taxonomy.partcount
        dir: asc
    limit: 12
    pagination: true

########################################################################
# Needed because size of paginated collection can't be queried
# See issue https://github.com/getgrav/grav-plugin-pagination/issues/29
unpaginated:
    items: 
        - '@taxonomy.function': stud_shift
        - '@taxonomy.function': stud_lift
    filter:
        published: true
        type: 'tech'   
########################################################################

form:
    name: filter-offsets
    id: items-filter
    classes: row
    fields:
        -
            name: filter
            type: fieldset
            id: filter
            classes: "col-12 col-md-6 text-center text-md-left"
            fields:
                -
                    name: offset_type
44
                    label: Art
Tobias Buckdahn's avatar
Tobias Buckdahn committed
45
46
47
48
49
                    type: select
                    id: offset_type
                    classes: custom-select
                    options:
                        'all': 'Alle Arten'
50
51
                        'stud_lift': 'Noppen-Lift'
                        'stud_shift': 'Noppen-Shift'
Tobias Buckdahn's avatar
Tobias Buckdahn committed
52
53
                - 
                    name: offset_length
54
                    label: Länge
Tobias Buckdahn's avatar
Tobias Buckdahn committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
                    type: select
                    id: offset_length
                    classes: custom-select
                    options:
                        'all': 'Alle Längen'
                        '10' : '1/2 Noppe'
                        '5'  : '1/4 Noppe'
                        '4'  : '1/5 Noppe'
                        '2'  : '1/10 Noppe'
                        '1'  : '1/20 Noppe'
                        'flex' : Flexibel
        -
            name: sorting
            type: fieldset
            id: sorting
            classes: "col-12 col-md-6 text-center text-md-right"
            fields:
                - 
                    name: order_by
74
                    label: Sortieren nach
Tobias Buckdahn's avatar
Tobias Buckdahn committed
75
76
77
78
79
80
81
82
83
84
85
86
                    type: select
                    id: order_by
                    classes: custom-select
                    default: 'header.taxonomy.partcount'
                    options:
                        'title': 'nach Titel'
                        'date': 'nach Erstelldatum'
                        'modified': 'nach Änderungsdatum'
                        'header.taxonomy.partcount': 'nach Teilezahl'
                        'random': 'nach Zufall'
                -
                    name: order_dir
87
                    label: Sortierrichtung
Tobias Buckdahn's avatar
Tobias Buckdahn committed
88
89
90
91
92
93
94
95
96
97
98
99
                    type: select
                    id: order_dir
                    classes: custom-select
                    default: 'asc'
                    options:
                        'asc': 'Auf'
                        'desc': 'Ab'
    buttons:
        submit:
            value: Filter
    process:
        redirect: >-
100
            /de/techs/offsets/{% 
Tobias Buckdahn's avatar
Tobias Buckdahn committed
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
                set offset_length = form.value.offset_length                                     %}{%
                set offset_length = offset_length|slice(0,3) == 'all' ? 'all' : offset_length    %}{%
                set offset_type   = form.value.offset_type                                       %}{%
                if offset_type == 'all'                                                          %}{%
                    if offset_length != 'all'                                                    %}{%
                        set filter = 'offset_length:' ~ offset_length  ~ '/'                     %}{%
                    endif                                                                        %}{%
                else                                                                             %}{%
                    if offset_length != 'all'                                                    %}{%
                        set filter = offset_type ~ '_length:' ~ offset_length  ~ '/'             %}{%
                    else                                                                         %}{%
                        set filter = 'function:' ~ offset_type  ~ '/'                            %}{%
                    endif                                                                        %}{%
                endif                                                                            %}{{ filter }}{%
                set order_by = form.value.order_by                                               %}{%
                set order_dir = form.value.order_dir                                             %}{%
                set ordering = 'orderby:' ~ order_by ~ '/orderdir:' ~ order_dir                  %}{{ ordering }}

---