Handle urls poiting directly to a specific maintainer

This commit is contained in:
Alexandre Aubin 2018-12-10 22:08:17 +00:00
parent 51604a9fe4
commit 63499d6f0e
2 changed files with 13 additions and 3 deletions

View file

@ -156,7 +156,11 @@ def appsobservatory_unlisted():
return render_template("unlistedapps.html", apps=apps) return render_template("unlistedapps.html", apps=apps)
@main.route('/app_maintainer_dash') @main.route('/app_maintainer_dash')
def app_maintainer_dash(): @main.route('/app_maintainer_dash/<maintainer>')
def app_maintainer_dash(maintainer=None):
if maintainer:
maintainer = maintainer.lower().replace(" ", "")
maintainers = set() maintainers = set()
apps = App.query.all() apps = App.query.all()
@ -175,5 +179,5 @@ def app_maintainer_dash():
maintainers = sorted(maintainers, key=lambda m: m.lower()) maintainers = sorted(maintainers, key=lambda m: m.lower())
apps = sorted(apps, key=lambda app: app.name.lower()) apps = sorted(apps, key=lambda app: app.name.lower())
return render_template("maintainer.html", maintainers=maintainers, apps=apps) return render_template("maintainer.html", maintainers=maintainers, apps=apps, maintainer=maintainer)

View file

@ -3,6 +3,7 @@
<div class="row"> <div class="row">
<div class="mx-auto"> <div class="mx-auto">
Active maintainers :
<select id="maintainer-select"> <select id="maintainer-select">
<option value="all">All</option> <option value="all">All</option>
<option value="nobody">Nobody / Unmaintained</option> <option value="nobody">Nobody / Unmaintained</option>
@ -151,6 +152,7 @@
window.onload = function () { window.onload = function () {
$('#maintainer-select').on('change', function() { $('#maintainer-select').on('change', function() {
var maintainer = this.value; var maintainer = this.value;
window.history.pushState("?", "YunoHost dashboard", "{{ url_for('main.app_maintainer_dash') }}/"+maintainer);
if (maintainer == "all") if (maintainer == "all")
{ {
$(".appline").show(); $(".appline").show();
@ -181,7 +183,11 @@ $('#maintainer-select').on('change', function() {
}); });
} }
}); });
} {% if maintainer %}
$('#maintainer-select').val('{{ maintainer }}');
$('#maintainer-select').change();
{% endif %}
};
</script> </script>
{% endblock %} {% endblock %}