mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
help: Add "How can I help?" section to Contribute page
This doesn't use the how-can-i-help package, but it is a similar implementation that fetches the same data from udd.debian.org. There are sections for the following issues: - Packages that will be removed from Debian testing - Packages that are not in Debian testing - Good first issues for beginners - Issues for which the package maintainer has requested help The overall "How can I help?" section is collapsed by default. Test: - View the page in stable and testing container. - Run help functional tests. Closes: #536 Signed-off-by: James Valleroy <jvalleroy@mailbox.org> [sunil: Minor indentation fix] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
eeca9c05ba
commit
e5a866dd64
@ -42,4 +42,76 @@
|
||||
{% trans 'Learn more...' %}
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h3>{% trans "How can I help?" %}</h3>
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
Below is a list of opportunities for contributing to Debian. It
|
||||
has been filtered to only show packages that are installed on
|
||||
this system.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-default collapsed collapsible-button" role="button"
|
||||
data-toggle="collapse" href="#collapse-issues" aria-expanded="false"
|
||||
aria-controls="collapse-issues">
|
||||
<span class="fa fa-chevron-right fa-fw" aria-hidden="true"></span>
|
||||
{% trans "Show issues" %}
|
||||
</a>
|
||||
|
||||
<div class="collapse" id="collapse-issues">
|
||||
<h4>{% trans "Packages that will be removed from Debian testing" %}</h4>
|
||||
<ul>
|
||||
{% for issue in testing_autorm %}
|
||||
<li>
|
||||
{% for package in issue.packages %}
|
||||
<b>{{ package }}</b> {% endfor %}
|
||||
({% trans "source package:" %}
|
||||
<a href="https://tracker.debian.org/pkg/{{ issue.source }}">
|
||||
{{ issue.source }}</a>):
|
||||
{% for bug in issue.bugs %}
|
||||
<a href="https://bugs.debian.org/{{ bug }}">
|
||||
#{{ bug }}</a>
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4>{% trans "Packages that are not in Debian testing" %}</h4>
|
||||
<ul>
|
||||
{% for issue in no_testing %}
|
||||
<li>
|
||||
<b>{{ issue.package }}</b>
|
||||
({% trans "source package:" %}
|
||||
<a href="https://tracker.debian.org/pkg/{{ issue.source }}">
|
||||
{{ issue.source }}</a>)
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4>{% trans "Good first issues for beginners" %}</h4>
|
||||
<ul>
|
||||
{% for issue in gift %}
|
||||
<li>
|
||||
<b>{{ issue.package }}</b>:
|
||||
<a href="https://bugs.debian.org/{{ issue.bug }}">
|
||||
#{{ issue.bug }}</a>
|
||||
{{ issue.title }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4>{% trans "Issues for which the package maintainer has requested help" %}</h4>
|
||||
<ul>
|
||||
{% for issue in help %}
|
||||
<li>
|
||||
<b>{{ issue.package }}</b>:
|
||||
<a href="https://bugs.debian.org/{{ issue.bug }}">
|
||||
#{{ issue.bug }}</a>
|
||||
{{ issue.title }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
@ -3,16 +3,20 @@
|
||||
Help app for FreedomBox.
|
||||
"""
|
||||
|
||||
import gzip
|
||||
import json
|
||||
import mimetypes
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
import apt
|
||||
from django.core.files.base import File
|
||||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import get_language_from_request
|
||||
from django.utils.translation import gettext as _
|
||||
import requests
|
||||
|
||||
from plinth import __version__, actions, cfg
|
||||
from plinth.modules.upgrades.views import (get_os_release,
|
||||
@ -27,8 +31,52 @@ def index(request):
|
||||
|
||||
def contribute(request):
|
||||
"""Serve the contribute page"""
|
||||
return TemplateResponse(request, 'help_contribute.html',
|
||||
{'title': _('Contribute')})
|
||||
response = requests.get('https://udd.debian.org/how-can-i-help.json.gz')
|
||||
data = gzip.decompress(response.content)
|
||||
issues = json.loads(data)
|
||||
|
||||
# Split issues according to type and filter for installed packages.
|
||||
testing_autorm = []
|
||||
no_testing = []
|
||||
gift = []
|
||||
help_needed = []
|
||||
cache = apt.Cache()
|
||||
for issue in issues:
|
||||
if issue['type'] == 'testing-autorm':
|
||||
for package in issue['packages']:
|
||||
try:
|
||||
if cache[package].is_installed:
|
||||
testing_autorm.append(issue)
|
||||
break
|
||||
except KeyError:
|
||||
pass
|
||||
elif issue['type'] == 'no-testing':
|
||||
try:
|
||||
if cache[issue['package']].is_installed:
|
||||
no_testing.append(issue)
|
||||
except KeyError:
|
||||
pass
|
||||
elif issue['type'] == 'gift':
|
||||
try:
|
||||
if cache[issue['package']].is_installed:
|
||||
gift.append(issue)
|
||||
except KeyError:
|
||||
pass
|
||||
elif issue['type'] == 'help':
|
||||
try:
|
||||
if cache[issue['package']].is_installed:
|
||||
help_needed.append(issue)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return TemplateResponse(
|
||||
request, 'help_contribute.html', {
|
||||
'title': _('Contribute'),
|
||||
'testing_autorm': testing_autorm,
|
||||
'no_testing': no_testing,
|
||||
'gift': gift,
|
||||
'help': help_needed,
|
||||
})
|
||||
|
||||
|
||||
def feedback(request):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user