diff --git a/app/blueprints/homepage/__init__.py b/app/blueprints/homepage/__init__.py index f029fdec..85f6686b 100644 --- a/app/blueprints/homepage/__init__.py +++ b/app/blueprints/homepage/__init__.py @@ -34,5 +34,8 @@ def home(): downloads_result = db.session.query(func.sum(Package.downloads)).one_or_none() downloads = 0 if not downloads_result or not downloads_result[0] else downloads_result[0] - return render_template("index.html", count=count, downloads=downloads, \ + tags = db.session.query(func.count(Tags.c.tag_id), Tag) \ + .select_from(Tag).outerjoin(Tags).group_by(Tag.id).order_by(db.asc(Tag.title)).all() + + return render_template("index.html", count=count, downloads=downloads, tags=tags, \ new=new, updated=updated, pop_mod=pop_mod, pop_txp=pop_txp, pop_gam=pop_gam, reviews=reviews) diff --git a/app/templates/index.html b/app/templates/index.html index 19110582..6fb833e7 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -58,6 +58,20 @@ {{ render_pkggrid(pop_txp) }} +

{{ _("Search by Tags") }}

+ {% for pair in tags %} + {% set count = pair[0] %} + {% set tag = pair[1] %} + + + {{ tag.title }} + {{ count }} + + {% endfor %} +
+ + {{ _("See more") }} diff --git a/app/templates/packages/list.html b/app/templates/packages/list.html index ec17f801..49fcdd15 100644 --- a/app/templates/packages/list.html +++ b/app/templates/packages/list.html @@ -27,18 +27,16 @@ {% set tag = pair[1] %} {% if tag in selected_tags %} - - {{ tag.title }} - ({{ count }}) + {{ count }} {% else %} - - {{ tag.title }} - ({{ count }}) + {{ count }} {% endif %} {% endfor %}