diff --git a/hubsrht/blueprints/public.py b/hubsrht/blueprints/public.py index 6835abf..7c5cf1c 100644 --- a/hubsrht/blueprints/public.py +++ b/hubsrht/blueprints/public.py @@ -1,5 +1,5 @@ from flask import Blueprint, render_template -from hubsrht.types import Project, Event, EventType +from hubsrht.types import Project, Event, EventType, Visibility from srht.flask import paginate_query from srht.oauth import current_user, loginrequired @@ -26,3 +26,11 @@ def index(): @loginrequired def getting_started(): return render_template("new-user-dashboard.html") + +@public.route("/projects") +def project_index(): + projects = (Project.query + .filter(Project.visibility == Visibility.public)) + projects, pagination = paginate_query(projects) + return render_template("project-index.html", + projects=projects, **pagination) diff --git a/hubsrht/templates/dashboard.html b/hubsrht/templates/dashboard.html index ede4a03..02f0192 100644 --- a/hubsrht/templates/dashboard.html +++ b/hubsrht/templates/dashboard.html @@ -17,7 +17,7 @@ class="btn btn-primary btn-block" >Create new project {{icon("caret-right")}} Discover projects on {{cfg('sr.ht', 'site-name')}} {{icon("caret-right")}} {% endif %}
- - Find interesting projects - {{icon("caret-right")}} - + Find interesting projects {{icon("caret-right")}}
diff --git a/hubsrht/templates/project-index.html b/hubsrht/templates/project-index.html new file mode 100644 index 0000000..63480b4 --- /dev/null +++ b/hubsrht/templates/project-index.html @@ -0,0 +1,84 @@ +{% extends "layout-full.html" %} +{% block title %} +Browse projects - {{cfg("sr.ht", "site-name")}} +{% endblock %} +{% block body %} +
+
+
+

Browse public projects

+
+ + {% if search_error %} +
{{ search_error }}
+ {% endif %} +
+ Sort results by +
+ + +
+
+ + +
+ +
+
+
+
+ {% for project in projects %} +
+

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

+

{{project.description}}

+
+ {% endfor %} +
+ {{pagination()}} +
+
+

Featured projects

+
+ {% for i in range(3) %} + ~sircmpwn/sourcehut +
+ SourceHut itself is a free and open-source software project. You + can read and contribute to the code, and install it on your own + servers. +
+ {% endfor %} +
+
+
+
+{% endblock %} diff --git a/scss/main.scss b/scss/main.scss index 9b800dd..14a9e88 100644 --- a/scss/main.scss +++ b/scss/main.scss @@ -102,3 +102,10 @@ margin-bottom: 0; } } + +.inline-legend { + float: left; + margin-right: 1rem; + display: inline; + width: inherit; +}