mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
store: simplify query args handling because 'request' is available in jinja templates (#2286)
This commit is contained in:
parent
f2a03e963a
commit
aa13a2389a
3 changed files with 9 additions and 12 deletions
|
@ -186,9 +186,6 @@ def star_app(app_id, action):
|
||||||
def browse_wishlist():
|
def browse_wishlist():
|
||||||
return render_template(
|
return render_template(
|
||||||
"wishlist.html",
|
"wishlist.html",
|
||||||
init_sort=request.args.get("sort"),
|
|
||||||
init_search=request.args.get("search"),
|
|
||||||
init_starsonly=request.args.get("starsonly"),
|
|
||||||
wishlist=get_wishlist(),
|
wishlist=get_wishlist(),
|
||||||
stars=get_stars(),
|
stars=get_stars(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
type="text"
|
type="text"
|
||||||
id="search"
|
id="search"
|
||||||
placeholder="{{ _('Search for…') }}"
|
placeholder="{{ _('Search for…') }}"
|
||||||
{% if init_search %}value="{{ init_search }}"{% endif %}
|
{% if request.args.get("search") %}value="{{ request.args.get("search") }}"{% endif %}
|
||||||
class="w-full rounded-md border-gray-200 shadow-sm sm:text-sm py-2 pe-10"
|
class="w-full rounded-md border-gray-200 shadow-sm sm:text-sm py-2 pe-10"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
>
|
>
|
||||||
<option value="">{{ _("All apps") }}</option>
|
<option value="">{{ _("All apps") }}</option>
|
||||||
{% for id, category in catalog['categories'].items() %}
|
{% for id, category in catalog['categories'].items() %}
|
||||||
<option {% if id == init_category %}selected{% endif %} value="{{ id }}">{{ category['title']|localize }}</option>
|
<option {% if id == request.args.get("category") %}selected{% endif %} value="{{ id }}">{{ category['title']|localize }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,15 +120,15 @@
|
||||||
id="selectsort"
|
id="selectsort"
|
||||||
class="inline-block rounded-md border-gray-200 text-sm ml-1 pl-1 pr-7 h-8 py-0"
|
class="inline-block rounded-md border-gray-200 text-sm ml-1 pl-1 pr-7 h-8 py-0"
|
||||||
>
|
>
|
||||||
<option {% if not init_sort or init_sort == "popularity" %}selected{% endif %} value="popularity">{{ _("Popularity") }}</option>
|
<option {% if request.args.get("sort") in [None, "popularity"] %}selected{% endif %} value="popularity">{{ _("Popularity") }}</option>
|
||||||
<option {% if init_sort == "newest" %}selected{% endif %} value="newest">{{ _("Newest") }}</option>
|
<option {% if request.args.get("sort") == "newest" %}selected{% endif %} value="newest">{{ _("Newest") }}</option>
|
||||||
<option {% if init_sort == "alpha" %}selected{% endif %} value="alpha">{{ _("Alphabetical") }}</option>
|
<option {% if request.args.get("sort") == "alpha" %}selected{% endif %} value="alpha">{{ _("Alphabetical") }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-block flex items-center px-2 pt-2 md:pt-0 {% if not user %}text-gray-500{% endif %}" {% if not user %}title="{{ _('Requires to be logged-in') }}" aria-label="{{ _('Requires to be logged-in') }}"{% endif %}>
|
<div class="inline-block flex items-center px-2 pt-2 md:pt-0 {% if not user %}text-gray-500{% endif %}" {% if not user %}title="{{ _('Requires to be logged-in') }}" aria-label="{{ _('Requires to be logged-in') }}"{% endif %}>
|
||||||
<label for="starsonly" class="inline-block relative mr-2 h-4 w-7 cursor-pointer">
|
<label for="starsonly" class="inline-block relative mr-2 h-4 w-7 cursor-pointer">
|
||||||
<span class="sr-only">{{ _("Show only apps you starred") }}</span>
|
<span class="sr-only">{{ _("Show only apps you starred") }}</span>
|
||||||
<input type="checkbox" id="starsonly" class="peer sr-only" {% if user and init_starsonly %}checked{% endif %} {% if not user%}disabled{% endif %} >
|
<input type="checkbox" id="starsonly" class="peer sr-only" {% if user and request.args.get("starsonly") %}checked{% endif %} {% if not user%}disabled{% endif %} >
|
||||||
|
|
||||||
<span class="absolute inset-0 rounded-full bg-gray-300 transition peer-checked:bg-green-500">
|
<span class="absolute inset-0 rounded-full bg-gray-300 transition peer-checked:bg-green-500">
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
id="selectsort"
|
id="selectsort"
|
||||||
class="inline-block rounded-md border-gray-200 text-sm ml-1 pl-1 pr-7 h-8 py-0"
|
class="inline-block rounded-md border-gray-200 text-sm ml-1 pl-1 pr-7 h-8 py-0"
|
||||||
>
|
>
|
||||||
<option {% if not init_sort or init_sort == "popularity" %}selected{% endif %} value="popularity">{{ _("Popularity") }}</option>
|
<option {% if request.args.get("sort") in [None, "popularity"] %}selected{% endif %} value="popularity">{{ _("Popularity") }}</option>
|
||||||
<option {% if init_sort == "alpha" %}selected{% endif %} value="alpha">{{ _("Alphabetical") }}</option>
|
<option {% if request.args.get("sort") == "alpha" %}selected{% endif %} value="alpha">{{ _("Alphabetical") }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-block flex items-center px-2 pt-2 md:pt-0 {% if not user %}text-gray-500{% endif %}" {% if not user %}title="{{ _('Requires to be logged-in') }}" aria-label="{{ _('Requires to be logged-in') }}"{% endif %}>
|
<div class="inline-block flex items-center px-2 pt-2 md:pt-0 {% if not user %}text-gray-500{% endif %}" {% if not user %}title="{{ _('Requires to be logged-in') }}" aria-label="{{ _('Requires to be logged-in') }}"{% endif %}>
|
||||||
<label for="starsonly" class="inline-block relative mr-2 h-4 w-7 cursor-pointer">
|
<label for="starsonly" class="inline-block relative mr-2 h-4 w-7 cursor-pointer">
|
||||||
<span class="sr-only">{{ _("Show only apps you starred") }}</span>
|
<span class="sr-only">{{ _("Show only apps you starred") }}</span>
|
||||||
<input type="checkbox" id="starsonly" class="peer sr-only" {% if user and init_starsonly %}checked{% endif %} {% if not user%}disabled{% endif %}>
|
<input type="checkbox" id="starsonly" class="peer sr-only" {% if user and request.args.get("starsonly") %}checked{% endif %} {% if not user%}disabled{% endif %}>
|
||||||
|
|
||||||
<span class="absolute inset-0 rounded-full bg-gray-300 transition peer-checked:bg-green-500">
|
<span class="absolute inset-0 rounded-full bg-gray-300 transition peer-checked:bg-green-500">
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Add table
Reference in a new issue