streamline search on mobile

This commit is contained in:
Your Name 2023-06-04 11:47:17 -04:00 committed by Henri Dickson
parent 31ba670c84
commit 2ac1671988
6 changed files with 13 additions and 17 deletions

View file

@ -157,11 +157,13 @@ class TheMovieDatabase:
if m["media_type"] == "tv":
cat = ItemCategory.TV
title = m["name"]
subtitle = f"{m.get('first_air_date')} {m.get('original_name')}"
subtitle = f"{m.get('first_air_date', '')} {m.get('original_name', '')}"
else:
cat = ItemCategory.Movie
title = m["title"]
subtitle = f"{m.get('release_date')} {m.get('original_name')}"
subtitle = (
f"{m.get('release_date', '')} {m.get('original_name', '')}"
)
cover = f"https://image.tmdb.org/t/p/w500/{m.get('poster_path')}"
results.append(
SearchResultItem(

View file

@ -33,10 +33,7 @@
</hgroup>
<div>
<div class="metadata">
{% if item.rating %}
<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% else %}
{% endif %}
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% include '_people.html' with people=item.author role='作者' max=2 %}
{% include '_people.html' with people=item.translator role='译者' max=2 %}
{% include '_people.html' with people=item.director role='导演' max=2 %}

View file

@ -8,11 +8,12 @@
<img src="{% static 'img/logo.svg' %}" alt="" />
</a>
</ul>
<ul class="nav-search">
<ul class="nav-search {% if request.GET.q %}unhide{% endif %}">
<li>
<form role="search" method="get" action="{% url 'catalog:search' %}">
<input type="search"
name="q"
id="q"
placeholder="搜索标题、创作者、ISBN、链接(如 https://movie.douban.com/subject/1297880/ )"
class="search"
value="{{ request.GET.q|default:'' }}" />
@ -35,7 +36,7 @@
</ul>
<ul>
<li class="small-only">
<a _="on click toggle .unhide on .nav-search">搜索</a>
<a _="on click toggle .unhide on .nav-search then call #q.focus()">搜索</a>
</li>
<li>
<a class="{% if current == 'discover' %}secondary{% endif %}"

View file

@ -1,10 +1,6 @@
from django import forms
from markdownx.fields import MarkdownxFormField
import django.contrib.postgres.forms as postgres
from django.utils import formats
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
import json
from .models import *
from common.forms import PreviewImageInput
@ -18,7 +14,7 @@ class ReviewForm(forms.ModelForm):
}
title = forms.CharField(label=_("评论标题"))
body = MarkdownxFormField(label=_("评论正文 (Markdown)"), strip=False)
body = MarkdownxFormField(label=_("评论正文 (Markdown格式可参考下方语法范例)"), strip=False)
share_to_mastodon = forms.BooleanField(
label=_("分享到联邦网络"), initial=False, required=False
)

View file

@ -41,7 +41,7 @@
</div>
<div>
<fieldset>
<span _=" on mousemove(currentTarget, offsetX) set current_value to Math.round((10 * offsetX) / currentTarget.offsetWidth) set star_div to the
<span class="rating-editor {% if shelf_type == 'wishlist' %}hidden{% endif %}" _="on mousemove(currentTarget, offsetX) set current_value to Math.round((10 * offsetX) / currentTarget.offsetWidth) set star_div to the
<div/>
in me set star_div.style.width to (current_value * 10) + '%' set @data-tooltip to current_value or '未评分' add .yellow to star_div end on click(currentTarget, offsetX) set current_value to Math.round((10 * offsetX) / currentTarget.offsetWidth) set star_div to the
<div/>
@ -51,9 +51,7 @@
<div/>
in me set star_input to the
<input/>
in me set current_value to star_input.value set star_div.style.width to (current_value * 10) + '%' set @data-tooltip to current_value or '未评分' remove .yellow from star_div end " class="rating-editor
{% if shelf_type == "wishlist" %}hidden{% endif %}
">
in me set current_value to star_input.value set star_div.style.width to (current_value * 10) + '%' set @data-tooltip to current_value or '未评分' remove .yellow from star_div end">
{{ mark.rating_grade|rating_star }}
<input type="hidden"
name="rating_grade"
@ -65,6 +63,7 @@
</div>
<textarea name="text"
rows="4"
autofocus
placeholder="提示: 善用 &gt;!文字!&lt; 标记可隐藏剧透; 超过360字可能无法分享到联邦网络实例时间线。"
id="id_text">{{ mark.comment_text|default:"" }}</textarea>
<div class="mark-modal__tag">

View file

@ -55,6 +55,7 @@
<input required
name="domain"
id="domain"
autofocus
pattern="(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,})"
title="实例域名(不含@和@之前的部分)如mastodon.social"
placeholder="实例域名(不含@和@之前的部分)如mastodon.social"