[FastAPI] Modularize homepage and add side panel

This puts one more toward completion of the homepage
overall; we'll need to still implement the authenticated
user dashboard after this.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-07-28 13:28:17 -07:00
parent 9e73936c4e
commit d9cdd5faef
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
10 changed files with 500 additions and 102 deletions

101
templates/home.html Normal file
View file

@ -0,0 +1,101 @@
<div id="intro" class="box">
<h2>AUR {% trans %}Home{% endtrans %}</h2>
<p>
{{ "Welcome to the AUR! Please read the %sAUR User Guidelines%s and %sAUR TU Guidelines%s for more information."
| tr
| format('<a href="https://wiki.archlinux.org/title/AUR_User_Guidelines">', "</a>",
'<a href="https://wiki.archlinux.org/title/AUR_Trusted_User_Guidelines">', "</a>")
| safe
}}
{{ "Contributed PKGBUILDs %smust%s conform to the %sArch Packaging Standards%s otherwise they will be deleted!"
| tr
| format("<strong>", "</strong>",
'<a href="https://wiki.archlinux.org/title/Arch_Packaging_Standards">',
"</a>")
| safe
}}
{% trans %}Remember to vote for your favourite packages!{% endtrans %}
{% trans %}Some packages may be provided as binaries in [community].{% endtrans %}
</p>
<p class="important">
{% trans %}DISCLAIMER{% endtrans %}:
{% trans %}AUR packages are user produced content. Any use of the provided files is at your own risk.{% endtrans %}
</p>
<p class="readmore"><a href="https://wiki.archlinux.org/title/AUR">{% trans %}Learn more...{% endtrans %}</a></p>
</div>
<div id="news">
<h3><a>{% trans %}Support{% endtrans %}</a><span class="arrow"></span></h3>
<h4>{% trans %}Package Requests{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "There are three types of requests that can be filed in the %sPackage Actions%s box on the package details page:"
| tr
| format("<var>", "</var>")
| safe
}}
</p>
<ul>
<li><em>{% trans %}Orphan Request{% endtrans %}</em>: {% trans %}Request a package to be disowned, e.g. when the maintainer is inactive and the package has been flagged out-of-date for a long time.{% endtrans %}</li>
<li><em>{% trans %}Deletion Request{% endtrans %}</em>: {%trans %}Request a package to be removed from the Arch User Repository. Please do not use this if a package is broken and can be fixed easily. Instead, contact the package maintainer and file orphan request if necessary.{% endtrans %}</li>
<li><em>{% trans %}Merge Request{% endtrans %}</em>: {% trans %}Request a package to be merged into another one. Can be used when a package needs to be renamed or replaced by a split package.{% endtrans %}</li>
</ul>
<p>
{{ "If you want to discuss a request, you can use the %saur-requests%s mailing list. However, please do not use that list to file requests."
| tr
| format('<a href="https://mailman.archlinux.org/mailman/listinfo/aur-requests">', "</a>")
| safe
}}
</p>
</div>
<h4>{% trans %}Submitting Packages{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "Git over SSH is now used to submit packages to the AUR. See the %sSubmitting packages%s section of the Arch User Repository ArchWiki page for more details."
| tr
| format('<a href="https://wiki.archlinux.org/title/Arch_User_Repository#Submitting_packages">', "</a>")
| safe
}}
</p>
{% if ssh_fingerprints %}
<p>
{% trans %}The following SSH fingerprints are used for the AUR:{% endtrans %}
<p>
<ul>
{% for keytype in ssh_fingerprints %}
<li><code>{{ keytype }}</code>: <code>{{ ssh_fingerprints[keytype] }}</code>
{% endfor %}
</ul>
{% endif %}
</div>
<h4>{% trans %}Discussion{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "General discussion regarding the Arch User Repository (AUR) and Trusted User structure takes place on %saur-general%s. For discussion relating to the development of the AUR web interface, use the %saur-dev%s mailing list."
| tr
| format('<a href="https://mailman.archlinux.org/mailman/listinfo/aur-general">', "</a>",
'<a href="https://mailman.archlinux.org/mailman/listinfo/aur-dev">', "</a>")
| safe
}}
<p>
</div>
<h4>{% trans %}Bug Reporting{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "If you find a bug in the AUR web interface, please fill out a bug report on our %sbug tracker%s. Use the tracker to report bugs in the AUR web interface %sonly%s. To report packaging bugs contact the package maintainer or leave a comment on the appropriate package page."
| tr
| format('<a href="https://bugs.archlinux.org/index.php?project=2">', "</a>",
"<strong>", "</strong>")
| safe
}}
</p>
</div>
</div>
<!-- Bootstrap typeahead for the homepage. -->
<script type="text/javascript" src="/static/js/typeahead-home.js"></script>
<!-- Stub inline javascript with a nonce. Used for testing purposes. -->
<script type="text/javascript" nonce={{ request.user.nonce }}>
function NONEXISTENT() {}
NONEXISTENT();
</script>

View file

@ -1,106 +1,15 @@
{% extends 'partials/layout.html' %}
{% block pageContent %}
<div id="intro" class="box">
<h2>AUR {% trans %}Home{% endtrans %}</h2>
<p>
{{ "Welcome to the AUR! Please read the %sAUR User Guidelines%s and %sAUR TU Guidelines%s for more information."
| tr
| format('<a href="https://wiki.archlinux.org/title/AUR_User_Guidelines">', "</a>",
'<a href="https://wiki.archlinux.org/title/AUR_Trusted_User_Guidelines">', "</a>")
| safe
}}
{{ "Contributed PKGBUILDs %smust%s conform to the %sArch Packaging Standards%s otherwise they will be deleted!"
| tr
| format("<strong>", "</strong>",
'<a href="https://wiki.archlinux.org/title/Arch_Packaging_Standards">',
"</a>")
| safe
}}
{% trans %}Remember to vote for your favourite packages!{% endtrans %}
{% trans %}Some packages may be provided as binaries in [community].{% endtrans %}
<p class="important">
{% trans %}DISCLAIMER{% endtrans %}:
{% trans %}AUR packages are user produced content. Any use of the provided files is at your own risk.{% endtrans %}
</p>
<p class="readmore"><a href="https://wiki.archlinux.org/title/AUR">{% trans %}Learn more...{% endtrans %}</a></p>
</p>
</div>
<div id="news">
<h3><a>{% trans %}Support{% endtrans %}</a><span class="arrow"></span></h3>
<h4>{% trans %}Package Requests{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "There are three types of requests that can be filed in the %sPackage Actions%s box on the package details page:"
| tr
| format("<var>", "</var>")
| safe
}}
</p>
<ul>
<li><em>{% trans %}Orphan Request{% endtrans %}</em>: {% trans %}Request a package to be disowned, e.g. when the maintainer is inactive and the package has been flagged out-of-date for a long time.{% endtrans %}</li>
<li><em>{% trans %}Deletion Request{% endtrans %}</em>: {%trans %}Request a package to be removed from the Arch User Repository. Please do not use this if a package is broken and can be fixed easily. Instead, contact the package maintainer and file orphan request if necessary.{% endtrans %}</li>
<li><em>{% trans %}Merge Request{% endtrans %}</em>: {% trans %}Request a package to be merged into another one. Can be used when a package needs to be renamed or replaced by a split package.{% endtrans %}</li>
</ul>
<p>
{{ "If you want to discuss a request, you can use the %saur-requests%s mailing list. However, please do not use that list to file requests."
| tr
| format('<a href="https://mailman.archlinux.org/mailman/listinfo/aur-requests">', "</a>")
| safe
}}
</p>
<div id="content-left-wrapper">
<div id="content-left">
{% include 'home.html' %}
</div>
</div>
<h4>{% trans %}Submitting Packages{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "Git over SSH is now used to submit packages to the AUR. See the %sSubmitting packages%s section of the Arch User Repository ArchWiki page for more details."
| tr
| format('<a href="https://wiki.archlinux.org/title/Arch_User_Repository#Submitting_packages">', "</a>")
| safe
}}
</p>
{% if ssh_fingerprints %}
<p>
{% trans %}The following SSH fingerprints are used for the AUR:{% endtrans %}
<p>
<ul>
{% for keytype in ssh_fingerprints %}
<li><code>{{ keytype }}</code>: <code>{{ ssh_fingerprints[keytype] }}</code>
{% endfor %}
</ul>
{% endif %}
<div id="content-right">
{% include 'partials/packages/widgets/search.html' %}
{% include 'partials/packages/widgets/updates.html' %}
{% include 'partials/packages/widgets/statistics.html' %}
</div>
<h4>{% trans %}Discussion{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "General discussion regarding the Arch User Repository (AUR) and Trusted User structure takes place on %saur-general%s. For discussion relating to the development of the AUR web interface, use the %saur-dev%s mailing list."
| tr
| format('<a href="https://mailman.archlinux.org/mailman/listinfo/aur-general">', "</a>",
'<a href="https://mailman.archlinux.org/mailman/listinfo/aur-dev">', "</a>")
| safe
}}
<p>
</div>
<h4>{% trans %}Bug Reporting{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "If you find a bug in the AUR web interface, please fill out a bug report on our %sbug tracker%s. Use the tracker to report bugs in the AUR web interface %sonly%s. To report packaging bugs contact the package maintainer or leave a comment on the appropriate package page."
| tr
| format('<a href="https://bugs.archlinux.org/index.php?project=2">', "</a>",
"<strong>", "</strong>")
| safe
}}
</p>
</div>
</div>
<!-- Bootstrap typeahead for the homepage. -->
<script type="text/javascript" src="/static/js/typeahead-home.js"></script>
<!-- Stub inline javascript with a nonce. Used for testing purposes. -->
<script type="text/javascript" nonce={{ request.user.nonce }}>
function NONEXISTENT() {}
NONEXISTENT();
</script>
{% endblock %}

View file

@ -0,0 +1,14 @@
<div id="pkgsearch" class="widget">
<form id="pkgsearch-form" method="get" action="/packages/">
<fieldset>
<label for="pkgsearch-field">{{ "Package Search" | tr }}:</label>
<input type="hidden" name="O" value="0" />
<input id="pkgsearch-field"
type="text"
name="K"
size="30"
maxlength="35"
autocomplete="off" />
</fieldset>
</form>
</div>

View file

@ -0,0 +1,55 @@
<div id="pkg-stats" class="widget box">
<h3>{{ "Statistics" | tr }}</h3>
<table>
<tr>
<td class="stat-desc">{{ "Packages" | tr }}</td>
<td>{{ package_count }}</td>
</tr>
<tr>
<td class="stat-desc">{{ "Orphan Packages" | tr }}</td>
<td>{{ orphan_count }}</td>
</tr>
<tr>
<td class="stat-desc">
{{ "Packages added in the past 7 days" | tr }}
</td>
<td>{{ seven_days_old_added }}</td>
</tr>
<tr>
<td class="stat-desc">
{{ "Packages updated in the past 7 days" | tr }}
</td>
<td>{{ seven_days_old_updated }}</td>
</tr>
<tr>
<td class="stat-desc">
{{ "Packages updated in the past year" | tr }}
</td>
<td>{{ year_old_updated }}</td>
</tr>
<tr>
<td class="stat-desc">
{{ "Packages never updated" | tr }}
</td>
<td>{{ never_updated }}</td>
</tr>
<tr>
<td class="stat-desc">
{{ "Registered Users" | tr }}
</td>
<td>{{ user_count }}</td>
</tr>
<tr>
<td class="stat-desc">
{{ "Trusted Users" | tr }}
</td>
<td>{{ trusted_user_count }}</td>
</tr>
</table>
</div>
{% if request.user.is_authenticated() %}
<!-- Include "My Statistics" -->
{% include 'partials/widgets/statistics.html' %}
{% endif %}

View file

@ -0,0 +1,35 @@
<div id="pkg-updates" class="widget box">
<h3>
{{ "Recent Updates" | tr }}
<span class="more">
(<a href="/packages/?SB=l&SO=d">{{ "more" | tr }}</a>)
</span>
</h3>
<a class="rss-icon latest" href="/rss/"
title="AUR Latest Packages RSS Feed">
<img src="/static/images/rss.svg" alt="RSS Feed" />
</a>
<a class="rss-icon" href="/rss/modified"
title="AUR Modified Packages RSS Feed">
<img src="/static/images/rss.svg" alt="RSS Feed" />
</a>
<table>
<tbody>
{% for pkg in package_updates %}
<tr>
<td class="pkg-name">
<a href="/packages/{{ pkg.Name }}">
{{ pkg.Name }} {{ pkg.Version }}
</a>
</td>
<td class="pkg-date">
{% set modified = pkg.PackageBase.ModifiedTS | dt | as_timezone(timezone) %}
{{ modified.strftime("%Y-%m-%d %H:%M") }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

View file

@ -0,0 +1,27 @@
<div id="my-stats" class="widget box">
<h3>{{ "My Statistics" | tr }}</h3>
{% set bases = request.user.maintained_bases %}
<table>
<tbody>
<tr>
<td>
<a href="/packages/?SeB=m&K={{ request.user.Username }}">
{{ "Packages" | tr }}
</a>
</td>
<td>{{ bases.count() }}</td>
</tr>
{% set out_of_date_packages = bases | out_of_date %}
<tr>
<td>
<a href="/packages/?SeB=m&outdated=on&K={{ request.user.Username }}">
{{ "Out of Date" | tr }}
</a>
</td>
<td>{{ out_of_date_packages.count() }}</td>
</tr>
</tbody>
</table>
</div>