Add shuffle animations to landing page

This commit is contained in:
Clément Fournier
2018-05-21 08:30:37 +02:00
parent 36d07a5060
commit bb51792ba7
4 changed files with 77 additions and 31 deletions

View File

@ -1,16 +1,15 @@
<!-- Argument summary: --> <!-- Argument summary: -->
<!-- tag: tag determining the pages included in the panel --> <!-- tags: tag determining the pages included in the panel -->
<!-- title: Display title of the panel --> <!-- title: Display title of the panel -->
<!-- description: Description of the panel --> <!-- description: Description of the panel -->
<!-- image (optional) : Name of the image to use, as a css class, eg "fa-list" --> <!-- image (optional) : Name of the image to use, as a css class, eg "fa-list" -->
<!-- titlemaker (optional) : name of a variable that's evaluated to determine the displayed title of the page. Default is page.title --> <!-- titlemaker (optional) : name of a variable that's evaluated to determine the displayed title of the page. Default is page.title -->
{% capture titlemaker %} {{ include.titlemaker | or_else: "page.title" }} {% endcapture %} {% capture titlemaker %} {{ include.titlemaker | default: "page.title" }} {% endcapture %}
<div class="col-xs-6 col-sm-4 col-md-4" data-groups='{{ include.datagroups }}'>
<div class="col-xs-6 col-sm-4 col-md-4" data-groups='["{{ include.tag }}"]'>
<div class="panel panel-default"> <div class="panel panel-default">
@ -31,11 +30,11 @@
</p> </p>
<ul> <ul>
{% for page in site.pages %} {% for page in site.pages %}
{% for tag in page.tags %} {% capture alltags %}{{ page.tags | contains_all: include.tags }}{% endcapture %}
{% if tag == include.tag %} <!-- ugly, but one can only capture string values -->
<li><a href="{{page.url | remove: '/'}}">{% eval titlemaker %}</a></li> {% if alltags contains "true" %}
{% endif %} <li><a href="{{page.url | remove: '/'}}">{% eval titlemaker %}</a></li>
{% endfor %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>

View File

@ -98,9 +98,9 @@ $(document).ready(function() {
</script> </script>
<!-- new attempt--> <!-- new attempt-->
<script> <script>
$(document).ready(function() { $(document).ready(function() {
/* initialize shuffle plugin */ /* initialize shuffle plugin */

View File

@ -1,13 +1,27 @@
module CustomFilters module CustomFilters
# returns the input if it's a non-blank string, otherwise return default value
def or_else(input, default) def contains_all(input, test)
if input if !test
input.strip != "" ? input : default !input
elsif !input
false
else else
default test.split(",").all? {|val| input.include?(val)}
end end
end end
def intersect(xs, ys)
xs & ys
end
def union(xs, ys)
xs | ys
end
def diff(xs, ys)
xs - ys
end
end end
Liquid::Template.register_filter(CustomFilters) Liquid::Template.register_filter(CustomFilters)

View File

@ -18,26 +18,59 @@ First time user? Then you may be interested in our [quickstart series](TODO)!
<br/> <br/>
<div id="grid" class="row">
{% include custom/shuffle_panel.html {% unless site.output == "pdf" %}
tag="getting_started" <script src="js/jquery.shuffle.min.js"></script>
description="These pages summarize the gist of PMD usage to get you started quickly:" <script src="js/jquery.ba-throttle-debounce.min.js"></script>
title="Getting started" %} {% endunless %}
{% include custom/shuffle_panel.html
tag="rule_references"
title="Rule references"
description="Pick your language to find out about the rule it supports:"
image="fa-database"
titlemaker="page.language_name" %}
{% include custom/shuffle_panel_filler.html %}
<div class="filter-options">
<button class="btn btn-primary" data-group="all">All</button>
<button class="btn btn-primary" data-group="getting_started">Getting Started</button>
<button class="btn btn-primary" data-group="userdocs">User documentation</button>
<button class="btn btn-primary" data-group="extending">Extending PMD</button>
<button class="btn btn-primary" data-group="contributing">Contributing</button>
</div> </div>
<div id="grid" class="row">
{% include custom/shuffle_panel.html
tags="getting_started"
datagroups='["getting_started"]'
description="These pages summarize the gist of PMD usage to get you started quickly."
title="Getting started" %}
{% include custom/shuffle_panel.html
tags="rule_references"
datagroups='["userdocs"]'
title="Rule references"
description="Pick your language to find out about the rule it supports."
image="fa-database"
titlemaker="page.language_name" %}
{% include custom/shuffle_panel.html
tags="userdocs,extending"
datagroups='["userdocs", "extending"]'
title="Writing rules"
description="These pages document the process of writing and testing custom rules and metrics for PMD."
%}
<!-- {% include custom/shuffle_panel_filler.html %} -->
</div>
<!-- {% include image.html file="pmd-logo-big.png" alt="PMD Logo" %} --> <!-- {% include image.html file="pmd-logo-big.png" alt="PMD Logo" %} -->
{% unless site.output == "pdf" %}
{% include initialize_shuffle.html %}<!-- new attempt-->
{% endunless %}
{% include links.html %} {% include links.html %}