mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
Generalize resource list templates
This commit is contained in:
parent
163ca0f629
commit
d9b06b8092
|
@ -1,65 +1,28 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<div class="header-tabbed">
|
||||
<div class="container">
|
||||
{% include 'project-nav.html' %}
|
||||
</div>
|
||||
{% extends "resource-list.html" %}
|
||||
{% block resource_list %}
|
||||
{% for mailing_list in mailing_lists %}
|
||||
<div class="event">
|
||||
<h4>
|
||||
<a
|
||||
href="{{mailing_list.url()}}"
|
||||
>~{{owner.username}}/{{mailing_list.name}}</a>
|
||||
</h4>
|
||||
{% if mailing_list.description %}
|
||||
{{ mailing_list.description | md }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if project.description %}
|
||||
<div class="header-extension">
|
||||
<div class="container">
|
||||
{{ project.description }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<form class="container">
|
||||
<div class="row">
|
||||
{% if current_user and current_user.id == owner.id %}
|
||||
<div class="form-group col-md-12">
|
||||
{% else %}
|
||||
<div class="form-group col-md-10">
|
||||
{% endif %}
|
||||
<input
|
||||
name="search"
|
||||
type="text"
|
||||
placeholder="Search mailing lists"
|
||||
class="form-control{% if search_error %} is-invalid{% endif %}"
|
||||
value="{{ search if search else "" }}" />
|
||||
{% if search_error %}
|
||||
<div class="invalid-feedback">{{ search_error }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-10 event-list">
|
||||
{% for mailing_list in mailing_lists %}
|
||||
<div class="event">
|
||||
<h4>
|
||||
<a
|
||||
href="{{mailing_list.url()}}"
|
||||
>~{{owner.username}}/{{mailing_list.name}}</a>
|
||||
</h4>
|
||||
{% if mailing_list.description %}
|
||||
{{ mailing_list.description | md }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{{pagination()}}
|
||||
</div>
|
||||
{% if current_user and current_user.id == owner.id %}
|
||||
<div class="col-md-2">
|
||||
<a
|
||||
href="{{url_for("mailing_lists.new_GET",
|
||||
owner=owner.canonical_name, project_name=project.name)}}"
|
||||
class="btn btn-primary btn-block"
|
||||
>Add mailing list {{icon('caret-right')}}</a>
|
||||
<a
|
||||
href="{{url_for("mailing_lists.manage_GET",
|
||||
owner=owner.canonical_name, project_name=project.name)}}"
|
||||
class="btn btn-default btn-block"
|
||||
>Manage lists {{icon('caret-right')}}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
<a
|
||||
href="{{url_for("mailing_lists.new_GET",
|
||||
owner=owner.canonical_name, project_name=project.name)}}"
|
||||
class="btn btn-primary btn-block"
|
||||
>Add mailing list {{icon('caret-right')}}</a>
|
||||
<a
|
||||
href="{{url_for("mailing_lists.manage_GET",
|
||||
owner=owner.canonical_name, project_name=project.name)}}"
|
||||
class="btn btn-default btn-block"
|
||||
>Manage lists {{icon('caret-right')}}</a>
|
||||
{% endblock %}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<div class="header-tabbed">
|
||||
<div class="container">
|
||||
{% include 'project-nav.html' %}
|
||||
</div>
|
||||
</div>
|
||||
{% if project.description %}
|
||||
<div class="header-extension">
|
||||
<div class="container">
|
||||
{{ project.description }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<form class="container">
|
||||
<div class="row">
|
||||
{% if current_user and current_user.id == owner.id %}
|
||||
<div class="form-group col-md-12">
|
||||
{% else %}
|
||||
<div class="form-group col-md-10">
|
||||
{% endif %}
|
||||
<input
|
||||
name="search"
|
||||
type="text"
|
||||
placeholder="Search {{view}}"
|
||||
class="form-control{% if search_error %} is-invalid{% endif %}"
|
||||
value="{{ search if search else "" }}" />
|
||||
{% if search_error %}
|
||||
<div class="invalid-feedback">{{ search_error }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-10 event-list">
|
||||
{% block resource_list %}
|
||||
TODO: populate resource list
|
||||
{% endblock %}
|
||||
{{pagination()}}
|
||||
</div>
|
||||
{% if current_user and current_user.id == owner.id %}
|
||||
<div class="col-md-2">
|
||||
{% block sidebar %}
|
||||
TODO: populate sidebar
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -1,66 +1,29 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<div class="header-tabbed">
|
||||
<div class="container">
|
||||
{% include 'project-nav.html' %}
|
||||
</div>
|
||||
{% extends "resource-list.html" %}
|
||||
{% block resource_list %}
|
||||
{% for repo in sources %}
|
||||
<div class="event">
|
||||
<h4>
|
||||
<a href="{{repo.url()}}">~{{owner.username}}/{{repo.name}}</a>
|
||||
<small class="pull-right">
|
||||
{{ repo.repo_type.value }}
|
||||
</small>
|
||||
</h4>
|
||||
{% if repo.description %}
|
||||
<p>{{ repo.description }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if project.description %}
|
||||
<div class="header-extension">
|
||||
<div class="container">
|
||||
{{ project.description }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<form class="container">
|
||||
<div class="row">
|
||||
{% if current_user and current_user.id == owner.id %}
|
||||
<div class="form-group col-md-12">
|
||||
{% else %}
|
||||
<div class="form-group col-md-10">
|
||||
{% endif %}
|
||||
<input
|
||||
name="search"
|
||||
type="text"
|
||||
placeholder="Search repositories"
|
||||
class="form-control{% if search_error %} is-invalid{% endif %}"
|
||||
value="{{ search if search else "" }}" />
|
||||
{% if search_error %}
|
||||
<div class="invalid-feedback">{{ search_error }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-10 event-list">
|
||||
{% for repo in sources %}
|
||||
<div class="event">
|
||||
<h4>
|
||||
<a href="{{repo.url()}}">~{{owner.username}}/{{repo.name}}</a>
|
||||
<small class="pull-right">
|
||||
{{ repo.repo_type.value }}
|
||||
</small>
|
||||
</h4>
|
||||
{% if repo.description %}
|
||||
<p>{{ repo.description }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{{pagination()}}
|
||||
</div>
|
||||
{% if current_user and current_user.id == owner.id %}
|
||||
<div class="col-md-2">
|
||||
<a
|
||||
href="{{url_for("sources.new_GET",
|
||||
owner=owner.canonical_name, project_name=project.name)}}"
|
||||
class="btn btn-primary btn-block"
|
||||
>Add repository {{icon('caret-right')}}</a>
|
||||
<a
|
||||
href="{{url_for("sources.manage_GET",
|
||||
owner=owner.canonical_name, project_name=project.name)}}"
|
||||
class="btn btn-default btn-block"
|
||||
>Manage sources {{icon('caret-right')}}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
<a
|
||||
href="{{url_for("sources.new_GET",
|
||||
owner=owner.canonical_name, project_name=project.name)}}"
|
||||
class="btn btn-primary btn-block"
|
||||
>Add repository {{icon('caret-right')}}</a>
|
||||
<a
|
||||
href="{{url_for("sources.manage_GET",
|
||||
owner=owner.canonical_name, project_name=project.name)}}"
|
||||
class="btn btn-default btn-block"
|
||||
>Manage sources {{icon('caret-right')}}</a>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue