summaryrefslogtreecommitdiff
path: root/themes/flog/layouts/partials/listing.html
blob: 58c7697fff72abe86ef4c8fbdc9f541d9f047880 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<main role="main">
    <div class="row grid">
        <div class="grid-sizer col s1"></div>
        {{ range .Data.Pages }}
            {{ if .Params.image }}
        <article itemscope itemtype="http://schema.org/BlogPosting" class="col s12 m6 grid-item grid--width6">
            {{ else }}
        <article itemscope itemtype="http://schema.org/BlogPosting" class="col s12 m4 grid-item grid--width4">
            {{ end }}
            <div class="card">
                {{ if .Params.image }}
                <div class="card-image">
                    <a href="{{ .RelPermalink }}"><img src="/images/{{ .Params.image }}"></a>
                </div>
                {{ end }}
                <section class="card-content" itemprop="text">
                    <span class="card-title" itemprop="headline">{{ .Title }}</span>
                    <div>
                        {{ .Summary }}
                    </div>
                </section>
                <div class="card-action">
                    <a href="{{ .RelPermalink }}">
                    Weiterlesen…
                    {{ if .Params.rating }}
                        <i class="material-icons right">
                        {{ range seq .Params.rating }}
                        star
                        {{ end }}
                        {{ range seq (sub 5 (int .Params.rating)) }}
                        star_border
                        {{ end }}
                        </i>
                    {{ end }}
                    </a>
                </div>
            </div>
        </article>
        {{ end }}
    </div>
</main>
<script type="text/javascript">
    var masonryReadyAttached;
    
    if (typeof $ === 'undefined') {
        document.addEventListener('DOMContentLoaded', loadMasonry);
    }
    if (typeof masonryReadyAttached === 'undefined') {
        masonryReadyAttached = true;
        document.addEventListener('pageReady', loadMasonry);
    }
    
    function loadMasonry() {
        if (typeof Masonry === 'undefined') {
            console.log('loading masonry files');
            $.getScript('/js/masonry-4.1.min.js', showMasonry);
        } else {
            console.log('masonry files already present');
            showMasonry();
        }
    }
    function showMasonry() {
        if ($('.grid').length == 0) return;
        console.log('using masonry to fix this grid');
        new Masonry('.grid', { itemSelector: '.grid-item', percentPosition: true, columnWidth: '.grid-sizer' });
    }
</script>