mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
Add page listing all featured projects
This commit is contained in:
parent
b72c7c7feb
commit
981622c92f
|
@ -61,3 +61,14 @@ def project_index():
|
||||||
|
|
||||||
return render_template("project-index.html", projects=projects,
|
return render_template("project-index.html", projects=projects,
|
||||||
search=search, features=features, sort=sort, **pagination)
|
search=search, features=features, sort=sort, **pagination)
|
||||||
|
|
||||||
|
@public.route("/projects/featured")
|
||||||
|
def featured_projects():
|
||||||
|
features = (Feature.query
|
||||||
|
.join(Project, Feature.project_id == Project.id)
|
||||||
|
.join(User, Project.owner_id == User.id)
|
||||||
|
.filter(Project.visibility == Visibility.public)
|
||||||
|
.order_by(Feature.created.desc()))
|
||||||
|
features, pagination = paginate_query(features)
|
||||||
|
return render_template("featured-projects.html",
|
||||||
|
features=features, **pagination)
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
{% extends "layout-full.html" %}
|
||||||
|
{% block title %}
|
||||||
|
<title>Featured projects on {{cfg("sr.ht", "site-name")}}</title>
|
||||||
|
{% endblock %}
|
||||||
|
{% block body %}
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<h3>Featured projects</h3>
|
||||||
|
<div class="event-list">
|
||||||
|
{% for feature in features %}
|
||||||
|
{% set project = feature.project %}
|
||||||
|
<div class="event">
|
||||||
|
<h4>
|
||||||
|
<a href="{{url_for("users.summary_GET",
|
||||||
|
username=project.owner.username)}}"
|
||||||
|
>{{project.owner.canonical_name}}</a>/<a
|
||||||
|
href="{{url_for("projects.summary_GET",
|
||||||
|
owner=project.owner.canonical_name,
|
||||||
|
project_name=project.name)}}"
|
||||||
|
>{{project.name}}</a>
|
||||||
|
</h4>
|
||||||
|
<blockquote style="margin-top: 0.5rem">
|
||||||
|
{{feature.summary | md}}
|
||||||
|
</blockquote>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{{pagination()}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -89,6 +89,10 @@
|
||||||
{{feature.summary | md}}
|
{{feature.summary | md}}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<a
|
||||||
|
href="{{url_for("public.featured_projects")}}"
|
||||||
|
class="btn btn-default btn-block"
|
||||||
|
>More featured projects {{icon('caret-right')}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue