Commit 3c70a1b8 authored by Felix Edelmann's avatar Felix Edelmann

Add app list with pagination under browse

parent cc4971e5
......@@ -11,7 +11,7 @@ test:
- apt-get install -y nodejs
- npm install
- nodejs build.js
- gem install jekyll jekyll-include-cache
- gem install jekyll jekyll-include-cache jekyll-paginate-v2
- jekyll build -d test
artifacts:
paths:
......@@ -28,7 +28,7 @@ pages:
- apt-get install -y nodejs
- npm install
- nodejs build.js
- gem install jekyll jekyll-include-cache
- gem install jekyll jekyll-include-cache jekyll-paginate-v2
- jekyll build -d public
artifacts:
paths:
......
......@@ -38,7 +38,7 @@ This is easily done with Gem which depends on Ruby 2.0+. You also need to instal
```
sudo apt-get install ruby-full build-essential
sudo gem install jekyll jekyll-include-cache
sudo gem install jekyll jekyll-include-cache jekyll-paginate-v2
```
To build the website, run:
......
......@@ -12,5 +12,13 @@ description: >
© 2016 F-Droid Limited and Contributors
baseurl: "/fdroid-website" # the subpath of your site, e.g. /blog
url: "http://f-droid.org" # the base hostname & protocol for your site
include: ["_apps", "_pages"]
gems: [jekyll-include-cache]
\ No newline at end of file
include:
- "_pages"
collections:
apps:
output: true
gems:
- jekyll-include-cache
- jekyll-paginate-v2
pagination:
enabled: true
\ No newline at end of file
......@@ -9,13 +9,9 @@
{% for nav-item in site.data.navigation %}
{% if nav-item.title %}
{% if nav-item.external %}
<a class="page-link" href="{{ nav-item.url }}">{{ nav-item.title }}</a>
<a class="page-link" href="{{ nav-item.url }}">{{ nav-item.title }}</a>
{% else %}
{% if page.permalink == nav-item.url %}
<span class="page-link current">{{ nav-item.title }}</span>
{% else %}
<a class="page-link" href="{{ nav-item.url | prepend: site.baseurl }}">{{ nav-item.title }}</a>
{% endif %}
<a class="page-link {% if page.permalink contains nav-item.url %} current {% endif %}" href="{{ nav-item.url | prepend: site.baseurl }}">{{ nav-item.title }}</a>
{% endif %}
{% endif %}
{% endfor %}
......
{% if include.paginator.total_pages > 1 %}
<div class="browse-navigation">
<div class="previous">
{% if include.paginator.previous_page %}
<a href="{{ include.paginator.previous_page_path | prepend: site.baseurl }}">Previous</a>
{% endif %}
</div>
<div class="summary">
Page {{ include.paginator.page }} of {{ include.paginator.total_pages }}
</div>
<div class="next">
{% if include.paginator.next_page %}
<a href="{{ include.paginator.next_page_path | prepend: site.baseurl }}">Next</a>
{% endif %}
</div>
</div>
<div class="browse-pages">
{% for page in (1..include.paginator.total_pages) %}
{% if page == include.paginator.page %}
<b>{{ page }}</b>
{% else %}
{% if page == 1 %}
<a href="{{ include.permalink | prepend: site.baseurl }}">{{ page }}</a>
{% else %}
<a href="{{ include.permalink | append: page | prepend: site.baseurl }}">{{ page }}</a>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% endif %}
\ No newline at end of file
<h3>Last updated</h3>
{% assign updatedApps = site.apps | sort: "title" | reverse | sort: "lastupdated" | reverse %}
{% for updatedApp in updatedApps limit:3 %}
{% include app-list-item.html app=updatedApp %}
{% endfor %}
\ No newline at end of file
<h3>Latest Apps</h3>
{% assign apps = site.pages | where_exp: "item", "item.package" %}
{% assign latestApps = apps | sort: "title" | reverse | sort: "added" | reverse %}
{% for latestApp in latestApps limit:10 %}
{% assign latestApps = site.apps | sort: "title" | reverse | sort: "added" | reverse %}
{% for latestApp in latestApps limit:3 %}
{% include app-list-item.html app=latestApp %}
{% endfor %}
\ No newline at end of file
......@@ -20,11 +20,15 @@
{% capture donate %}{% include sidebar-donate.md %}{% endcapture %}
{{ donate | markdownify }}
</div>
<div class="sidebar-widget">
{% include_cached sidebar-lastupdated-apps.html %}
</div>
<div class="sidebar-widget">
{% include_cached sidebar-latest-apps.html %}
</div>
<div class="sidebar-widget">
{% include sidebar-news.html %}
</div>
......
......@@ -2,13 +2,19 @@
layout: page
title: Browse
permalink: /browse/
pagination:
enabled: true
collection: apps
per_page: 30
permalink: '/:num/'
sort_field: 'title'
title: ':title'
---
<h3>Last updated</h3>
{% include_cached paginator-navigation.html paginator=paginator permalink='/browse/' %}
{% assign apps = site.pages | where_exp: "item", "item.package" %}
{% for app in paginator.posts %}
{% include app-list-item.html app=app %}
{% endfor %}
{% assign updatedApps = apps | sort: "title" | reverse | sort: "lastupdated" | reverse %}
{% for updatedApp in updatedApps limit:10 %}
{% include app-list-item.html app=updatedApp %}
{% endfor %}
\ No newline at end of file
{% include_cached paginator-navigation.html paginator=paginator permalink='/browse/' %}
\ No newline at end of file
......@@ -64,7 +64,6 @@ body {
@include button-dark($primary-color);
&.current {
pointer-events: none;
border-bottom: 6px solid rgba(255, 255, 255, .4);
}
}
......@@ -116,7 +115,7 @@ body {
/**
* Latest Apps
* Browsing
*/
.app-header, .app-header:visited {
display: flex;
......@@ -145,6 +144,20 @@ body {
}
}
.browse-navigation {
display: flex;
justify-content: space-between;
.previous, .next {
flex-basis: 0;
flex-grow: 1;
}
.next {
text-align: right;
}
}
/**
......
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