Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/chipsenkbeil/grid-side.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Senkbeil <chip.senkbeil@gmail.com>2015-09-30 05:12:49 +0300
committerChip Senkbeil <chip.senkbeil@gmail.com>2015-09-30 05:12:49 +0300
commitee03b5e0ceccf549b4755cb4823a7be87a4d1f7b (patch)
tree0cccd9cf0945c7832132b549e98e27aba22cb655
parent7f057181bb04006e1b1761d867ca51eb97f8a108 (diff)
Updated gallery, post, and project to support optional infinite scroll
-rw-r--r--layouts/partials/gallery/collection.html20
-rw-r--r--layouts/partials/post/list.html21
-rw-r--r--layouts/partials/project/collection.html20
3 files changed, 58 insertions, 3 deletions
diff --git a/layouts/partials/gallery/collection.html b/layouts/partials/gallery/collection.html
index 83d4bce..10b9bed 100644
--- a/layouts/partials/gallery/collection.html
+++ b/layouts/partials/gallery/collection.html
@@ -1,5 +1,23 @@
+{{ $sp := .Site.Params }}
+{{ if and (isset $sp "Gallery") (isset $sp.Gallery "infinite_scroll") }}
+ {{ with $sp.Gallery.infinite_scroll }}
+ {{ $.Scratch.Set "infinite_scroll" (eq . true) }}
+ {{ end }}
+{{ else }}
+ {{ $.Scratch.Set "infinite_scroll" false }}
+{{ end }}
+
+{{ if eq ($.Scratch.Get "infinite_scroll") false }}
+ {{ with $sp.infinite_scroll }}
+ {{ $.Scratch.Set "infinite_scroll" (eq . true) }}
+ {{ else }}
+ {{ $.Scratch.Set "infinite_scroll" false }}
+ {{ end }}
+{{ end }}
+
+{{ $infinite_scroll := $.Scratch.Get "infinite_scroll" }}
-<div class="masonry-flex-container infinite-scroll">
+<div class="masonry-flex-container {{ if $infinite_scroll }}infinite-scroll{{ end }}">
{{ range .Paginator.Pages }}
{{ partial "gallery/item.html" . }}
{{ end }}
diff --git a/layouts/partials/post/list.html b/layouts/partials/post/list.html
index 23056d8..93c2f46 100644
--- a/layouts/partials/post/list.html
+++ b/layouts/partials/post/list.html
@@ -4,8 +4,27 @@
<body>
{{ partial "core/main-menu.html" . }}
+ {{ $sp := .Site.Params }}
+ {{ if and (isset $sp "Post") (isset $sp.Post "infinite_scroll") }}
+ {{ with $sp.Post.infinite_scroll }}
+ {{ $.Scratch.Set "infinite_scroll" (eq . true) }}
+ {{ end }}
+ {{ else }}
+ {{ $.Scratch.Set "infinite_scroll" false }}
+ {{ end }}
+
+ {{ if eq ($.Scratch.Get "infinite_scroll") false }}
+ {{ with $sp.infinite_scroll }}
+ {{ $.Scratch.Set "infinite_scroll" (eq . true) }}
+ {{ else }}
+ {{ $.Scratch.Set "infinite_scroll" false }}
+ {{ end }}
+ {{ end }}
+
+ {{ $infinite_scroll := $.Scratch.Get "infinite_scroll" }}
+
<section class="main-content">
- <div class="masonry-flex-container infinite-scroll">
+ <div class="masonry-flex-container {{ if $infinite_scroll }}infinite-scroll{{ end }}">
{{ if .IsNode }}
{{ range .Paginator.Pages }}
<div class="flex-item">
diff --git a/layouts/partials/project/collection.html b/layouts/partials/project/collection.html
index 3bc516c..e7767fb 100644
--- a/layouts/partials/project/collection.html
+++ b/layouts/partials/project/collection.html
@@ -1,5 +1,23 @@
+{{ $sp := .Site.Params }}
+{{ if and (isset $sp "Project") (isset $sp.Project "infinite_scroll") }}
+ {{ with $sp.Project.infinite_scroll }}
+ {{ $.Scratch.Set "infinite_scroll" (eq . true) }}
+ {{ end }}
+{{ else }}
+ {{ $.Scratch.Set "infinite_scroll" false }}
+{{ end }}
+
+{{ if eq ($.Scratch.Get "infinite_scroll") false }}
+ {{ with $sp.infinite_scroll }}
+ {{ $.Scratch.Set "infinite_scroll" (eq . true) }}
+ {{ else }}
+ {{ $.Scratch.Set "infinite_scroll" false }}
+ {{ end }}
+{{ end }}
+
+{{ $infinite_scroll := $.Scratch.Get "infinite_scroll" }}
-<div class="masonry-flex-container infinite-scroll">
+<div class="masonry-flex-container {{ if $infinite_scroll }}infinite-scroll{{ end }}">
{{ range .Paginator.Pages }}
{{ partial "project/item.html" . }}
{{ end }}