~sircmpwn/hub.sr.ht

981622c92f14fd3ca2829ebe6f1b1b9cd4098aa1 — Drew DeVault 10 days ago b72c7c7 0.8.0
Add page listing all featured projects
M hubsrht/blueprints/public.py => hubsrht/blueprints/public.py +11 -0
@@ 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)

A hubsrht/templates/featured-projects.html => hubsrht/templates/featured-projects.html +33 -0
@@ 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 %}

M hubsrht/templates/project-index.html => hubsrht/templates/project-index.html +4 -0
@@ 89,6 89,10 @@
          {{feature.summary | md}}
        </blockquote>
        {% endfor %}
        <a
          href="{{url_for("public.featured_projects")}}"
          class="btn btn-default btn-block"
        >More featured projects {{icon('caret-right')}}</a>
      </div>
    </div>
  </div>