Skip to content
Permalink
Browse files

projectpages: v8 update

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 6, 2018
1 parent f79b5c5 commit 1db6202adafe2b6598839ba42a50d9dbfe8001b2
@@ -53,7 +53,7 @@ Meta fields
* **description** — tagline or short project description
* **previewimage** — promotional graphics (used in slider and social networks)
* **logo** — project logo (used on the right side of the project page)
* **status** (str/int) — Development Status. Use your own phrasing, or the
* **devstatus** (str/int) — Development Status. Use your own phrasing, or the
following numbers to get nice formatting:

1. Planning
@@ -76,14 +76,14 @@ Meta fields
* **license** — name of the license under which the project
* **role** — your role in the project. Free-form, sample values include
*Contributor* and *Maintainer*
* **featured** (bool) — show in the slider
* **hidden** (bool) — don’t show under “all projects” (can still be in slider though)
* **status** ``featured`` to show in the slider, ``private`` to hide from the
page
* Also: the **post text** is a full description of the project. You can put a
README here. (Bonus points for using a .meta file for the metadata and a
symlink to the actual README as the post, assuming you have good READMEs)

**title**, **description**, **status** are required. **previewimage** is needed if
**featured** is set. **date** and **tags** are ignored and not included in the
**title**, **description**, **devstatus** are required. **previewimage** is needed if
**status: featured** is set. **date** and **tags** are ignored and not included in the
JSON file.

Any other fields are not used by default — however, you can modify templates
@@ -141,8 +141,8 @@ def gen_tasks(self):
def sortf(p):
return ((-int(p.meta('sort')) if p.meta('sort') != '' else -1), p.title())

context["featured"] = sorted((p for p in self.projects if p.meta('featured') not in ('False', '0', 'false', 'no', '')), key=sortf)
context["projects"] = sorted((p for p in self.projects if p.meta('hidden') not in ('False', '0', 'false', 'no')), key=sortf)
context["featured"] = sorted((p for p in self.projects if p.meta('status').lower() == 'featured'), key=sortf)
context["projects"] = sorted((p for p in self.projects if p.meta('status').lower() != 'private'), key=sortf)

link = short_tdst.replace('\\', '/')
index_len = len(self.kw['index_file'])
@@ -152,7 +152,7 @@ def sortf(p):

context["pagekind"] = ['projectpages']

all_meta = [(p.title(), p.meta('status')) for p in self.projects]
all_meta = [(p.title(), p.meta('devstatus')) for p in self.projects]
all_meta += [p.meta('previewimage') for p in context["featured"]]
all_meta += [p.source_path for p in context["featured"]]

@@ -19,7 +19,7 @@
<table class="table table-hover">
<tr>
<td><b>Status</b></td>
<td>{{ project.status(post.meta('status')) }}</td>
<td>{{ project.devstatus(post.meta('devstatus')) }}</td>
</tr>

{% if post.meta('language') %}
@@ -1,6 +1,6 @@
{# -*- coding: utf-8 -*- #}

{% macro status(desc) %}
{% macro devstatus(desc) %}
{% if desc == '1' %}
<span class="badge badge-default">Planning</span>
{% elif desc == '2' %}
@@ -31,7 +31,7 @@ active
<img class="d-block w-100" style="max-width: 100%" src="{{ p.meta('previewimage') }}" alt="{{ p.title() }}">
</a>
<div class="carousel-caption d-none d-md-block">
<h3>{{ p.title() }} {{ project.status(p.meta('status')) }}</h3>
<h3>{{ p.title() }} {{ project.devstatus(p.meta('devstatus')) }}</h3>
<p>{{ p.description() }}</p>
<a href="{{ p.permalink() }}" class="btn btn-primary"><i class="fa fa-info-circle"></i> View details</a>
</div>
@@ -54,7 +54,7 @@ active

<ul class="project-list">
{% for p in projects %}
<li class="project project-sort-{{ p.meta('sort') }}"><a href="{{ p.permalink() }}">{{ p.title() }}</a> {{ project.status(p.meta('status')) }}</a></li>
<li class="project project-sort-{{ p.meta('sort') }}"><a href="{{ p.permalink() }}">{{ p.title() }}</a> {{ project.devstatus(p.meta('devstatus')) }}</a></li>
{% endfor %}
</ul>
{% endblock %}
@@ -19,7 +19,7 @@
<table class="table table-hover">
<tr>
<td><b>Status</b></td>
<td>${project.status(post.meta('status'))}</td>
<td>${project.devstatus(post.meta('devstatus'))}</td>
</tr>

% if post.meta('language'):
@@ -1,6 +1,6 @@
## -*- coding: utf-8 -*-

<%def name="status(desc)" buffered="True">
<%def name="devstatus(desc)" buffered="True">
% if desc == '1':
<span class="badge badge-default">Planning</span>
% elif desc == '2':
@@ -31,7 +31,7 @@ active
<img class="d-block w-100" style="max-width: 100%" src="${p.meta('previewimage')}" alt="${p.title()}">
</a>
<div class="carousel-caption d-none d-md-block">
<h3>${p.title()} ${project.status(p.meta('status'))}</h3>
<h3>${p.title()} ${project.devstatus(p.meta('devstatus'))}</h3>
<p>${p.description()}</p>
<a href="${p.permalink()}" class="btn btn-primary"><i class="fa fa-info-circle"></i> View details</a>
</div>
@@ -54,7 +54,7 @@ active

<ul class="project-list">
% for p in projects:
<li class="project project-sort-${p.meta('sort')}"><a href="${p.permalink()}">${p.title()}</a> ${project.status(p.meta('status'))}</a></li>
<li class="project project-sort-${p.meta('sort')}"><a href="${p.permalink()}">${p.title()}</a> ${project.devstatus(p.meta('devstatus'))}</a></li>
% endfor
</ul>
</%block>

0 comments on commit 1db6202

Please sign in to comment.
You can’t perform that action at this time.