Initial pass on public project index

master
Drew DeVault 3 years ago
parent 55d590a4c4
commit 777db28c6d
  1. 10
      hubsrht/blueprints/public.py
  2. 2
      hubsrht/templates/dashboard.html
  3. 8
      hubsrht/templates/new-user-dashboard.html
  4. 84
      hubsrht/templates/project-index.html
  5. 7
      scss/main.scss

@ -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)

@ -17,7 +17,7 @@
class="btn btn-primary btn-block"
>Create new project {{icon("caret-right")}}</a>
<a
href="#"
href="{{url_for("public.project_index")}}"
class="btn btn-white btn-sm btn-block"
>Discover projects on {{cfg('sr.ht', 'site-name')}} {{icon("caret-right")}}</a>
<a

@ -132,10 +132,10 @@
</div>
{% endif %}
<div class="col-md-4">
<a href="#" class="btn btn-white btn-block">
Find interesting projects
{{icon("caret-right")}}
</a>
<a
href="{{url_for("public.project_index")}}"
class="btn btn-white btn-block"
>Find interesting projects {{icon("caret-right")}}</a>
</div>
</div>
</div>

@ -0,0 +1,84 @@
{% extends "layout-full.html" %}
{% block title %}
<title>Browse projects - {{cfg("sr.ht", "site-name")}}</title>
{% endblock %}
{% block body %}
<div class="container-fluid">
<div class="row">
<div class="col-lg-8">
<h3>Browse public projects</h3>
<form>
<input
name="search"
type="text"
placeholder="Search all public projects"
class="form-control"
value="{{search if search else ""}}" />
{% if search_error %}
<div class="invalid-feedback">{{ search_error }}</div>
{% endif %}
<fieldset class="pull-right" style="margin-top: 0.25rem">
<legend class="inline-legend">Sort results by</legend>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="sort"
id="sort-recently-updated"
value="recently-updated"
checked>
<label class="form-check-label" for="sort-recently-updated">
Recently updated
</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="sort"
id="sort-longest-active"
value="longest-active">
<label class="form-check-label" for="sort-longest-active">
Longest active
</label>
</div>
<button type="submit" class="btn btn-default">
Apply {{icon("caret-right")}}
</button>
</fieldset>
<div class="clearfix"></div>
</form>
<div class="event-list">
{% for project in projects %}
<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>
<p>{{project.description}}</p>
</div>
{% endfor %}
</div>
{{pagination()}}
</div>
<div class="col-lg-4">
<h3>Featured projects</h3>
<div class="event-list">
{% for i in range(3) %}
<a href="#">~sircmpwn</a>/<a href="#">sourcehut</a>
<blockquote style="margin-top: 0.5rem">
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.
</blockquote>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}

@ -102,3 +102,10 @@
margin-bottom: 0;
}
}
.inline-legend {
float: left;
margin-right: 1rem;
display: inline;
width: inherit;
}

Loading…
Cancel
Save