diff --git a/hubsrht/blueprints/public.py b/hubsrht/blueprints/public.py index 64d0d2d..58301ff 100644 --- a/hubsrht/blueprints/public.py +++ b/hubsrht/blueprints/public.py @@ -61,3 +61,14 @@ def project_index(): return render_template("project-index.html", projects=projects, 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) diff --git a/hubsrht/templates/featured-projects.html b/hubsrht/templates/featured-projects.html new file mode 100644 index 0000000..ddd605f --- /dev/null +++ b/hubsrht/templates/featured-projects.html @@ -0,0 +1,33 @@ +{% extends "layout-full.html" %} +{% block title %} +Featured projects on {{cfg("sr.ht", "site-name")}} +{% endblock %} +{% block body %} +
+
+
+

Featured projects

+
+ {% for feature in features %} + {% set project = feature.project %} +
+

+ {{project.owner.canonical_name}}/{{project.name}} +

+
+ {{feature.summary | md}} +
+
+ {% endfor %} + {{pagination()}} +
+
+
+
+{% endblock %} diff --git a/hubsrht/templates/project-index.html b/hubsrht/templates/project-index.html index 7fb70e0..07c9fdb 100644 --- a/hubsrht/templates/project-index.html +++ b/hubsrht/templates/project-index.html @@ -89,6 +89,10 @@ {{feature.summary | md}} {% endfor %} + More featured projects {{icon('caret-right')}}