Commit ee5a2ac9 authored by paulh's avatar paulh Committed by GitSync

(Grav GitSync) Automatic Commit from paulh

parent 5d710160
# v2.0.4
## 02/02/2018
1. [](#improved)
* Updated global handling of 'chromeless' and 'hidepagetitle' URL flags (thanks Ricardo)
# v2.0.3
## 02/01/2018
1. [](#improved)
* Updated example RSS Feed page in 'advanced' course example
1. [](#bugfix)
* Added handling for initial release of RSS Feed page configuration
# v2.0.2
## 02/01/2018
1. [](#new)
* Added experimental pagination controls for RSS Feed page sorted by 'date' (thanks OleVik)
1. [](#improved)
* Updated example RSS Feed page in 'advanced' course example
* Added visual indicator for active page on blog list pages
# v2.0.1
## 01/23/2018
......
---
title: 'UX News'
published: true
hide_git_sync_repo_link: false
rss_feed_display_order: date
hide_git_sync_repo_link: true
rss_feed_limit: '10'
rss_feed_pagination: true
rss_feed_header_images: true
hide_rss_feed_header_images_when_chromeless: false
rss_feed_preview_paragraphs: two
hide_page_title: false
---
A look at what's going on in the field of user experience.
**Pick of the Week**
[plugin:page-inject](/web-pick-of-the-week)
name: Course Hub Bootstrap
version: 2.0.1
version: 2.0.4
description: "A customized version of the Bootstrap theme (built with Bootstrap 3) for use with the Grav Course Hub skeleton package."
icon: university
author:
......
......@@ -52,18 +52,30 @@ form:
title: Display Options
underline: true
header.rss_feed_display_order:
type: select
size: small
label: RSS Feed Order
default: date
options:
source: By Source
date: By Date
header.rss_feed_limit:
type: text
size: small
label: Max Item Count
default: 10
validate:
required: true
type: integer
min: 1
header.rss_feed_pagination:
type: toggle
label: Pagination
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
header.rss_feed_header_images:
type: toggle
label: RSS Feed Header Images
label: Item Header Images
highlight: 1
default: 1
options:
......@@ -75,7 +87,7 @@ form:
header.rss_feed_preview_paragraphs:
type: select
size: medium
label: RSS Feed Preview Paragraphs
label: Item Preview Paragraphs
default: one
options:
none: None
......
......@@ -52,18 +52,30 @@ form:
title: Display Options
underline: true
header.rss_feed_display_order:
type: select
size: small
label: RSS Feed Order
default: date
options:
source: By Source
date: By Date
header.rss_feed_limit:
type: text
size: small
label: Max Item Count
default: 10
validate:
required: true
type: integer
min: 1
header.rss_feed_pagination:
type: toggle
label: Pagination
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
header.rss_feed_header_images:
type: toggle
label: RSS Feed Header Images
label: Item Header Images
highlight: 1
default: 1
options:
......@@ -75,7 +87,7 @@ form:
header.rss_feed_preview_paragraphs:
type: select
size: medium
label: RSS Feed Preview Paragraphs
label: Item Preview Paragraphs
default: one
options:
none: None
......
$(document).ready(function(){
$("a.newwindow").attr("target","_blank");
$("a.topwindow").attr("target","_top");
$('.container').on('click', 'a:not(.external-link):not([href^="#"])', function(e){
e.preventDefault();
var url = window.location.href;
if (url.indexOf("chromeless:true") >= 0) {
var clickedLink = $(this).attr('href') + "/chromeless:true";
window.location.href = clickedLink;
}else {
$('.container').on('click', 'a:not(.external-link):not([href^="#"])', function(e){
e.preventDefault();
var url = window.location.href;
var newurl = $(this).attr('href');
window.location.href = $(this).attr('href');
if (url.indexOf("chromeless:true") >= 0) {
newurl = newurl + "/chromeless:true";
}
}
});
if (url.indexOf("hidepagetitle:true") >= 0) {
newurl = newurl + "/hidepagetitle:true";
}
window.location.href = newurl;
});
});
......@@ -16,80 +16,97 @@
{% set index = 1 %}
{% set feed_items = [] %}
{% for name, feed in twig_feeds %}
{% for item in feed.items %}
{% set index = index + 1 %}
{% set item = item|merge({ 'retrievedTitle': feed.title }) %}
{% set item = item|merge({ 'sortDate': item.date.date }) %}
{% set feed_items = feed_items|merge({ (index): (item) }) %}
{% endfor %}
{% for item in feed.items %}
{% set index = index + 1 %}
{% set item = item|merge({ 'retrievedTitle': feed.title }) %}
{% set item = item|merge({ 'sortDate': item.date.date }) %}
{% set feed_items = feed_items|merge({ (index): (item) }) %}
{% endfor %}
{% endfor %}
{% if uri.param('page') %}
{% set currentPage = uri.param('page') %}
{% else %}
{% set currentPage = 1 %}
{% endif %}
{% if page.header.rss_feed_limit %}
{% set perPage = page.header.rss_feed_limit %}
{% else %}
{% set perPage = 10 %}
{% endif %}
{% set totalPages = (feed_items|length / perPage)|round(0, 'ceil') %}
{% set start = currentPage * perPage - perPage %}
{% set paginationLimit = perPage - 1 %}
{{ page.content }}
{% if page.header.rss_feed_display_order == 'source' %}
{% for name, feed in twig_feeds %}
<h4><a class="newwindow external-link" href="{{ feed.source }}">{{ feed.title }}</a></h4>
{% for item in feed.items %}
<h5>
<a class="newwindow external-link" href="{{ item.url }}">{{ item.title }}</a>
</h5>
<time>{{ item.date.date|date("m/d/Y") }}</time>
{% if page.header.rss_feed_header_images and not (page.header.rss_feed_preview_paragraphs == 'all') %}
{% if grav.uri.param('chromeless') or (config.site.chromeless.enabled) %}
{% if not header.hide_rss_feed_header_images_when_chromeless %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% else %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% endif %}
{% set paragraphs = item.content | split('</p>') %}
{% set firstParagraph = paragraphs[0] ~ '</p>' %}
{% set secondParagraph = paragraphs[1] ~ '</p>' %}
{% if not (page.header.rss_feed_preview_paragraphs == 'none') %}
{% if page.header.rss_feed_preview_paragraphs == 'all' %}
{{ item.content }}
{% else %}
<p>{{ firstParagraph | striptags }}</p>
{% if page.header.rss_feed_preview_paragraphs == 'two' %}
<p>{{ secondParagraph | striptags }}</p>
{% endif %}
<p><a class="newwindow external-link" href="{{ item.url }}">Continue reading...</a></p><br>
{% endif %}
{% for index, item in feed_items|sort_by_key('sortDate')|reverse|slice(start, perPage) %}
<h4>
<a class="newwindow external-link" href="{{ item.url }}">{{ item.title }}</a>
</h4>
<time>{{ item.date.date|date("m/d/Y") }}</time>, {{ item.retrievedTitle }}
{% if page.header.rss_feed_header_images and not (page.header.rss_feed_preview_paragraphs == 'all') %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% set paragraphs = item.content | split('</p>') %}
{% set firstParagraph = paragraphs[0] ~ '</p>' %}
{% set secondParagraph = paragraphs[1] ~ '</p>' %}
{% if not (page.header.rss_feed_preview_paragraphs == 'none') %}
{% if page.header.rss_feed_preview_paragraphs == 'all' %}
{{ item.content }}
{% else %}
<p>{{ firstParagraph | striptags }}</p>
{% if page.header.rss_feed_preview_paragraphs == 'two' %}
<p>{{ secondParagraph | striptags }}</p>
{% endif %}
{% endfor %}
{% endfor %}
<p><a class="newwindow external-link" href="{{ item.url }}">Continue reading...</a></p><br>
{% endif %}
{% endif %}
{% endfor %}
{% if page.header.rss_feed_pagination %}
{% set rssfeedpagination = page.header.rss_feed_pagination %}
{% else %}
{% for index, item in feed_items|sort_by_key('sortDate')|reverse %}
<h4>
<a class="newwindow external-link" href="{{ item.url }}">{{ item.title }}</a>
</h4>
<time>{{ item.date.date|date("m/d/Y") }}</time>, {{ item.retrievedTitle }}
{% if page.header.rss_feed_header_images and not (page.header.rss_feed_preview_paragraphs == 'all') %}
{% if grav.uri.param('chromeless') or (config.site.chromeless.enabled) %}
{% if not header.hide_rss_feed_header_images_when_chromeless %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% else %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% endif %}
{% set paragraphs = item.content | split('</p>') %}
{% set firstParagraph = paragraphs[0] ~ '</p>' %}
{% set secondParagraph = paragraphs[1] ~ '</p>' %}
{% if not (page.header.rss_feed_preview_paragraphs == 'none') %}
{% if page.header.rss_feed_preview_paragraphs == 'all' %}
{{ item.content }}
{% else %}
<p>{{ firstParagraph | striptags }}</p>
{% if page.header.rss_feed_preview_paragraphs == 'two' %}
<p>{{ secondParagraph | striptags }}</p>
{% endif %}
<p><a class="newwindow external-link" href="{{ item.url }}">Continue reading...</a></p><br>
{% endif %}
{% set rssfeedpagination = true %}
{% endif %}
{% if totalPages > 1 and rssfeedpagination %}
<div class="text-center">
<ul class="pagination">
<li class="page-item">
{% if currentPage <= 1 %}
<li><span>&laquo;</span></li>
{% else %}
<a href="{{ page.url }}/page:{{ currentPage - 1 }}">&laquo;</a>
{% endif %}
</li>
{% for i in 1..totalPages %}
{% if (currentPage - paginationLimit) - loop.index == 0 %}
<li class="page-item">
<span>&hellip;</span>
</li>
{% elseif (currentPage + paginationLimit) - loop.index == 0 %}
<li class="page-item">
<span>&hellip;</span>
</li>
{% elseif (currentPage - paginationLimit) - loop.index > 0 %}
{% elseif (currentPage + paginationLimit) - loop.index < 0 %}
{% else %}
<li class="page-item {% if currentPage == loop.index %} active{% endif %}">
<a href="{{ page.url }}/page:{{ loop.index }}">{{ loop.index }}</a>
</li>
{% endif %}
{% endfor %}
<li class="page-item">
{% if currentPage >= totalPages %}
<li><span>&raquo;</span></li>
{% else %}
<a href="{{ page.url }}/page:{{ currentPage + 1 }}">&raquo;</a>
{% endif %}
</li>
</ul>
</div>
{% endif %}
{% else %}
{% set admin_panel_appearance_url = grav.base_url ~ '/admin/plugins/twigfeeds' %}
<a class="newwindow external-link" href="{{ admin_panel_appearance_url }}" title="Enable Twig Feeds Plugin">
......
{% set pagination = pagination|default(page.collection.params.pagination) %}
{% set base_url = base_url|default(page.url) %}
{% if pagination|length > 1 %}
<ul class="pagination">
{% if pagination.hasPrev %}
{% set url = (base_url ~ pagination.params ~ pagination.prevUrl)|replace({'//':'/'}) %}
<li><a rel="prev" href="{{ url }}">&laquo;</a></li>
{% else %}
<li><span>&laquo;</span></li>
{% endif %}
{% for paginate in pagination %}
{% if paginate.isCurrent %}
<li class="active"><span>{{ paginate.number }}</span></li>
{% elseif paginate.isInDelta %}
{% set url = (base_url ~ pagination.params ~ paginate.url)|replace({'//':'/'}) %}
<li><a href="{{ url }}">{{ paginate.number }}</a></li>
{% elseif paginate.isDeltaBorder %}
<li class="gap"><span>&hellip;</span></li>
{% endif %}
{% endfor %}
{% if pagination.hasNext %}
{% set url = (base_url ~ pagination.params ~ pagination.nextUrl)|replace({'//':'/'}) %}
<li><a rel="next" href="{{ url }}">&raquo;</a></li>
{% else %}
<li><span>&raquo;</span></li>
{% endif %}
</ul>
{% endif %}
......@@ -21,80 +21,97 @@
{% set index = 1 %}
{% set feed_items = [] %}
{% for name, feed in twig_feeds %}
{% for item in feed.items %}
{% set index = index + 1 %}
{% set item = item|merge({ 'retrievedTitle': feed.title }) %}
{% set item = item|merge({ 'sortDate': item.date.date }) %}
{% set feed_items = feed_items|merge({ (index): (item) }) %}
{% endfor %}
{% for item in feed.items %}
{% set index = index + 1 %}
{% set item = item|merge({ 'retrievedTitle': feed.title }) %}
{% set item = item|merge({ 'sortDate': item.date.date }) %}
{% set feed_items = feed_items|merge({ (index): (item) }) %}
{% endfor %}
{% endfor %}
{% if uri.param('page') %}
{% set currentPage = uri.param('page') %}
{% else %}
{% set currentPage = 1 %}
{% endif %}
{% if page.header.rss_feed_limit %}
{% set perPage = page.header.rss_feed_limit %}
{% else %}
{% set perPage = 10 %}
{% endif %}
{% set totalPages = (feed_items|length / perPage)|round(0, 'ceil') %}
{% set start = currentPage * perPage - perPage %}
{% set paginationLimit = perPage - 1 %}
{{ page.content }}
{% if page.header.rss_feed_display_order == 'source' %}
{% for name, feed in twig_feeds %}
<h4><a class="newwindow external-link" href="{{ feed.source }}">{{ feed.title }}</a></h4>
{% for item in feed.items %}
<h5>
<a class="newwindow external-link" href="{{ item.url }}">{{ item.title }}</a>
</h5>
<time>{{ item.date.date|date("m/d/Y") }}</time>
{% if page.header.rss_feed_header_images and not (page.header.rss_feed_preview_paragraphs == 'all') %}
{% if grav.uri.param('chromeless') or (config.site.chromeless.enabled) %}
{% if not header.hide_rss_feed_header_images_when_chromeless %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% else %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% endif %}
{% set paragraphs = item.content | split('</p>') %}
{% set firstParagraph = paragraphs[0] ~ '</p>' %}
{% set secondParagraph = paragraphs[1] ~ '</p>' %}
{% if not (page.header.rss_feed_preview_paragraphs == 'none') %}
{% if page.header.rss_feed_preview_paragraphs == 'all' %}
{{ item.content }}
{% else %}
<p>{{ firstParagraph | striptags }}</p>
{% if page.header.rss_feed_preview_paragraphs == 'two' %}
<p>{{ secondParagraph | striptags }}</p>
{% endif %}
<p><a class="newwindow external-link" href="{{ item.url }}">Continue reading...</a></p><br>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% for index, item in feed_items|sort_by_key('sortDate')|reverse|slice(start, perPage) %}
<h4>
<a class="newwindow external-link" href="{{ item.url }}">{{ item.title }}</a>
</h4>
<time>{{ item.date.date|date("m/d/Y") }}</time>, {{ item.retrievedTitle }}
{% if page.header.rss_feed_header_images and not (page.header.rss_feed_preview_paragraphs == 'all') %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% set paragraphs = item.content | split('</p>') %}
{% set firstParagraph = paragraphs[0] ~ '</p>' %}
{% set secondParagraph = paragraphs[1] ~ '</p>' %}
{% if not (page.header.rss_feed_preview_paragraphs == 'none') %}
{% if page.header.rss_feed_preview_paragraphs == 'all' %}
{{ item.content }}
{% else %}
<p>{{ firstParagraph | striptags }}</p>
{% if page.header.rss_feed_preview_paragraphs == 'two' %}
<p>{{ secondParagraph | striptags }}</p>
{% endif %}
<p><a class="newwindow external-link" href="{{ item.url }}">Continue reading...</a></p><br>
{% endif %}
{% endif %}
{% endfor %}
{% if page.header.rss_feed_pagination %}
{% set rssfeedpagination = page.header.rss_feed_pagination %}
{% else %}
{% for index, item in feed_items|sort_by_key('sortDate')|reverse %}
<h4>
<a class="newwindow external-link" href="{{ item.url }}">{{ item.title }}</a>
</h4>
<time>{{ item.date.date|date("m/d/Y") }}</time>, {{ item.retrievedTitle }}
{% if page.header.rss_feed_header_images and not (page.header.rss_feed_preview_paragraphs == 'all') %}
{% if grav.uri.param('chromeless') or (config.site.chromeless.enabled) %}
{% if not header.hide_rss_feed_header_images_when_chromeless %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% else %}
<p>{{ item.content|preg_get('/(<img(?:(\s*(class)\s*=\s*\x22([^\x22]+)\x22*)+|[^>]+?)*>)/') }}</p>
{% endif %}
{% set rssfeedpagination = true %}
{% endif %}
{% if totalPages > 1 and rssfeedpagination %}
<div class="text-center">
<ul class="pagination">
<li class="page-item">
{% if currentPage <= 1 %}
<li><span>&laquo;</span></li>
{% else %}
<a href="{{ page.url }}/page:{{ currentPage - 1 }}">&laquo;</a>
{% endif %}
{% set paragraphs = item.content | split('</p>') %}
{% set firstParagraph = paragraphs[0] ~ '</p>' %}
{% set secondParagraph = paragraphs[1] ~ '</p>' %}
{% if not (page.header.rss_feed_preview_paragraphs == 'none') %}
{% if page.header.rss_feed_preview_paragraphs == 'all' %}
{{ item.content }}
</li>
{% for i in 1..totalPages %}
{% if (currentPage - paginationLimit) - loop.index == 0 %}
<li class="page-item">
<span>&hellip;</span>
</li>
{% elseif (currentPage + paginationLimit) - loop.index == 0 %}
<li class="page-item">
<span>&hellip;</span>
</li>
{% elseif (currentPage - paginationLimit) - loop.index > 0 %}
{% elseif (currentPage + paginationLimit) - loop.index < 0 %}
{% else %}
<p>{{ firstParagraph | striptags }}</p>
{% if page.header.rss_feed_preview_paragraphs == 'two' %}
<p>{{ secondParagraph | striptags }}</p>
{% endif %}
<p><a class="newwindow external-link" href="{{ item.url }}">Continue reading...</a></p><br>
<li class="page-item {% if currentPage == loop.index %} active{% endif %}">
<a href="{{ page.url }}/page:{{ loop.index }}">{{ loop.index }}</a>
</li>
{% endif %}
{% endfor %}
<li class="page-item">
{% if currentPage >= totalPages %}
<li><span>&raquo;</span></li>
{% else %}
<a href="{{ page.url }}/page:{{ currentPage + 1 }}">&raquo;</a>
{% endif %}
{% endfor %}
</li>
</ul>
</div>
{% endif %}
{% else %}
{% set admin_panel_appearance_url = grav.base_url ~ '/admin/plugins/twigfeeds' %}
<a class="newwindow external-link" href="{{ admin_panel_appearance_url }}" title="Enable Twig Feeds Plugin">
......@@ -117,7 +134,7 @@
</div>
{% endif %}
</div>
</div>
{% endblock %}
</div>
{% endblock %}
{% endembed %}
{% endembed %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment