contentdb/app/templates/index.html
2023-10-31 23:28:20 +00:00

182 lines
6.1 KiB
HTML

{% extends "base.html" %}
{% block title %}
{{ _("Welcome") }}
{% endblock %}
{% block description %}
{{ _("Welcome to the best place to find Minetest mods, games, and texture packs") }}
{% endblock %}
{% block scriptextra %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"url": "https://content.minetest.net/",
"potentialAction": {
"@type": "SearchAction",
"target": "https://content.minetest.net/packages?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
{% if current_user.is_authenticated %}
<script src="/static/js/quick_review_voting.js?v=2"></script>
{% endif %}
{% endblock %}
{% block content %}
{% from "macros/packagegridtile.html" import render_pkggrid %}
<div id="featuredCarousel" class="carousel slide mt-0 mb-5" data-bs-ride="carousel" data-bs-interval="7500">
<div class="carousel-indicators">
{% for package in spotlight_pkgs %}
<button
data-bs-target="#featuredCarousel"
data-bs-slide-to="{{ loop.index - 1 }}"
{% if loop.index == 1 %}class="active" aria-current="true"{% endif %}></button>
{% endfor %}
</div>
<div class="carousel-inner">
{% for package in spotlight_pkgs %}
{% set cover_image = package.get_cover_image_url() %}
{% set tags = package.tags | sort(attribute="views", reverse=True) %}
<div class="carousel-item {% if loop.index == 1 %}active{% endif %}">
<a href="{{ package.get_url('packages.view') }}">
<div class="ratio ratio-16x9">
<img src="{{ cover_image }}"
alt="{{ _('%(title)s by %(author)s', title=package.title, author=package.author.display_name) }}">
</div>
<div class="carousel-caption text-shadow">
<h3 class="mt-0 mb-3">
{% if package.author %}
{{ _('<strong>%(title)s</strong> by %(author)s', title=package.title, author=package.author.display_name) }}
{% else %}
<strong>{{ package.title }}</strong>
{% endif %}
</h3>
<p>
{{ package.short_desc }}
</p>
{% if package.author %}
<div class="d-none d-md-block">
<span class="me-2">
{{ package.type.text }}
</span>
{% for warning in package.content_warnings %}
<span class="badge bg-warning" title="{{ warning.description }}">
<i class="fas fa-exclamation-circle" style="margin-right: 0.3em;"></i>
{{ warning.title }}
</span>
{% endfor %}
{% for t in tags[:3] %}
<span class="badge bg-primary" title="{{ t.description or '' }}">
{{ t.title }}
</span>
{% endfor %}
<span class="btn" title="{{ _('Reviews') }}">
<i class="fas fa-star-half-alt"></i>
<span class="count">
+{{ package.reviews | selectattr("rating", "equalto", 5) | list | length }}
/
{{ package.reviews | selectattr("rating", "equalto", 3) | list | length }}
/
-{{ package.reviews | selectattr("rating", "equalto", 1) | list | length }}
</span>
</span>
</div>
{% endif %}
</div>
</a>
</div>
{% endfor %}
</div>
<button class="carousel-control-prev" role="button" data-bs-target="#featuredCarousel" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">{{ _("Previous") }}</span>
</button>
<button class="carousel-control-next" role="button" data-bs-target="#featuredCarousel" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">{{ _("Next") }}</span>
</button>
</div>
<!-- <div class="text-end mb-5 text-muted" style="opacity: 0.4;">
<a href="/help/featured/" class="btn">
<i class="fas fa-question-circle me-1"></i>
{{ _("Featured") }}
</a>
</div> -->
<a href="{{ url_for('packages.list_all', sort='approved_at', order='desc') }}" class="btn btn-secondary float-end">
{{ _("See more") }}
</a>
<h2 class="my-3">{{ _("Recently Added") }}</h2>
{{ render_pkggrid(new) }}
<a href="{{ url_for('packages.list_all', sort='last_release', order='desc') }}" class="btn btn-secondary float-end">
{{ _("See more") }}
</a>
<h2 class="my-3">{{ _("Recently Updated") }}</h2>
{{ render_pkggrid(updated) }}
<a href="{{ url_for('packages.list_all', type='game', sort='score', order='desc') }}" class="btn btn-secondary float-end">
{{ _("See more") }}
</a>
<h2 class="my-3">{{ _("Top Games") }}</h2>
{{ render_pkggrid(pop_gam) }}
<a href="{{ url_for('packages.list_all', type='mod', sort='score', order='desc') }}" class="btn btn-secondary float-end">
{{ _("See more") }}
</a>
<h2 class="my-3">{{ _("Top Mods") }}</h2>
{{ render_pkggrid(pop_mod) }}
<a href="{{ url_for('packages.list_all', type='txp', sort='score', order='desc') }}" class="btn btn-secondary float-end">
{{ _("See more") }}
</a>
<h2 class="my-3">{{ _("Top Texture Packs") }}</h2>
{{ render_pkggrid(pop_txp) }}
<h2 class="my-3">{{ _("Search by Tags") }}</h2>
{% for pair in tags %}
{% set count = pair[0] %}
{% set tag = pair[1] %}
<a class="btn btn-sm btn-secondary m-1" rel="nofollow"
title="{{ tag.description or '' }}"
href="{{ url_for('packages.list_all', tag=tag.name) }}">
{{ tag.title }}
<span class="badge roaded-pill bg-light text-dark ms-1">{{ count }}</span>
</a>
{% endfor %}
<div class="clearfix mb-4"></div>
<a href="{{ url_for('packages.list_all', sort='reviews', order='desc') }}" class="btn btn-secondary float-end">
{{ _("See more") }}
</a>
<h2 class="my-3">{{ _("Highest Reviewed") }}</h2>
{{ render_pkggrid(high_reviewed) }}
<a href="{{ url_for('packages.list_reviews') }}" class="btn btn-secondary float-end">
{{ _("See more") }}
</a>
<h2 class="my-3">{{ _("Recent Positive Reviews") }}</h2>
{% from "macros/reviews.html" import render_reviews with context %}
{{ render_reviews(reviews, current_user, True) }}
<div class="text-center mt-5">
<small>
{{ _("CDB has %(count)d packages, with a total of %(downloads)d downloads.", count=count, downloads=downloads) }}
</small>
</div>
<!-- </main> -->
{% endblock %}