focus on season not show

This commit is contained in:
Your Name 2023-05-21 17:14:35 -04:00 committed by Henri Dickson
parent ca5342c827
commit 89d0b689ab
6 changed files with 138 additions and 100 deletions

View file

@ -51,7 +51,14 @@ class Command(BaseCommand):
while len(item_ids) < MAX_GALLERY_ITEMS / 2 and days < 150:
item_ids = self.get_popular_item_ids(category, days)
days *= 3
items = Item.objects.filter(id__in=item_ids)
items = list(
Item.objects.filter(id__in=item_ids).order_by("-created_time")
)
if category == ItemCategory.TV:
seasons = [i for i in items if i.__class__ == TVSeason]
for season in seasons:
if season.show in items:
items.remove(season.show)
gallery_list.append(
{
"name": "popular_" + category.value,

View file

@ -55,6 +55,9 @@
{% if item.release_date %}<span>{{ item.release_date }}</span>{% endif %}
{% include '_people.html' with people=item.genre role='' max=10 %}
{% include '_people.html' with people=item.platform role='' max=10 %}
{% if item.show %}
<span>{% trans '所属剧集:' %}<a href="{{ item.show.url }}">{{ item.show.title }}</a></span>
{% endif %}
</div>
<div class="brief">
{% if item.actor %}

View file

@ -55,7 +55,7 @@
</div>
{% if request.user.is_authenticated and not mark.shelf_type %}
<div id="item-primary-action" class="right mark">
<div class="item-action">
<div class="item-action item-mark-buttons">
{% for k, v in shelf_types %}
{% if v %}
<button class="primary"
@ -66,6 +66,20 @@
{% endif %}
{% endfor %}
</div>
<div class="tv-tip" style="display:none;">
这里是全剧条目,建议选择单季标记
{% with item.all_seasons as seasons %}
{% if seasons %}
<div _="init hide .item-mark-buttons then hide .item-mark-icon then show .tv-tip end">
{% for s in seasons %}
<span class="season-number">
<a href="{{ s.url }}">{{ s.season_number|default:"#" }}</a>
</span>
{% endfor %}
</div>
{% endif %}
{% endwith %}
</div>
</div>
{% endif %}
{% if request.user.is_authenticated and mark.shelf_type %}
@ -98,7 +112,7 @@
<small>
<a href="#"
hx-get="{% url 'journal:mark' item.uuid %}?new=1"
class="edit"
class="item-mark-icon"
hx-target="body"
hx-swap="beforeend">
{% if mark.tags %}
@ -123,7 +137,7 @@
<small>
<a href="#"
hx-get="{% url 'journal:mark' item.uuid %}?new=1"
class="edit"
class="item-mark-icon"
hx-target="body"
hx-swap="beforeend">
{% if mark.text %}
@ -157,11 +171,13 @@
我的评论
<small>
{% if review %}
<a href="{% url 'journal:review_edit' item.uuid review.uuid %}">
<a href="{% url 'journal:review_edit' item.uuid review.uuid %}"
class="item-mark-icon">
<i class="fa-solid fa-pen-to-square"></i>
</a>
{% else %}
<a href="{% url 'journal:review_create' item.uuid %}">
<a href="{% url 'journal:review_create' item.uuid %}"
class="item-mark-icon">
<i class="fa-regular fa-square-plus"></i>
</a>
{% endif %}

View file

@ -32,12 +32,22 @@
<!-- class specific details -->
{% block details %}
<div>
{% if item.imdb %}
{% trans 'IMDb' %}<a href="https://www.imdb.com/title/{{ item.imdb }}/"
target="_blank"
rel="noopener">{{ item.imdb }}</a>
{% if item.show %}
{% trans '所属剧集:' %}<a href="{{ item.show.url }}">{{ item.show.title }}</a>
{% endif %}
</div>
{% with item.all_seasons as seasons %}
{% if seasons %}
<div>
{% trans '本剧所有季:' %}
{% for s in seasons %}
<span class="season-number">
<a {% if s == item %}class="current" {% else %} href="{{ s.url }}" {% endif %}>{{ s.season_number|default:"#" }}</a>
</span>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<div>
{% if item.director %}
{% trans '导演:' %}
@ -134,6 +144,33 @@
{% endfor %}
{% endif %}
</div>
<div>
{% if item.showtime %}
{% trans '上映时间:' %}
{% for showtime in item.showtime %}
{% for time, region in showtime.items %}
<span>{{ time }}
{% if region != '' %}({{ region }}){% endif %}
</span>
{% endfor %}
{% if not forloop.last %}/{% endif %}
{% endfor %}
{% endif %}
</div>
<div>
{% if item.other_title %}
{% trans '又名:' %}
{% for t in item.other_title %}
<span>{{ t }}</span>
{% if not forloop.last %}/{% endif %}
{% endfor %}
{% endif %}
</div>
<div>
{% if item.season_count %}
{% trans '总季数:' %}{{ item.season_count }}
{% endif %}
</div>
<div>
{% if item.season_number %}
{% trans '本季序号:' %}{{ item.season_number }}
@ -144,66 +181,27 @@
{% trans '本季集数:' %}{{ item.episode_count }}
{% endif %}
</div>
<div></div>
<div>
{% if item.show %}
{% trans '所属剧集:' %}<a href="{{ item.show.url }}">{{ item.show.title }}
{% if item.single_episode_length %}
{% trans '单集长度:' %}{{ item.single_episode_length }}
{% endif %}
</a>
</div>
<div>
{% if item.season_count %}
{% trans '总季数:' %}{{ item.season_count }}
</div>
<div>
{% if item.imdb %}
{% trans 'IMDb' %}<a href="https://www.imdb.com/title/{{ item.imdb }}/"
target="_blank"
rel="noopener">{{ item.imdb }}</a>
{% endif %}
</div>
<div>
{% if item.site %}
{% trans '网站:' %}
<a href="{{ item.site }}" target="_blank" rel="noopener">{{ item.site|strip_scheme }}</a>
{% endif %}
</div>
{% if item.other_info %}
{% for k, v in item.other_info.items %}<div>{{ k }}{{ v|urlizetrunc:24 }}</div>{% endfor %}
{% endif %}
</div>
<div>
{% if item.single_episode_length %}
{% trans '单集长度:' %}{{ item.single_episode_length }}
{% endif %}
</div>
{% with item.all_seasons as seasons %}
{% if seasons %}
<div>
{% trans '本剧所有季:' %}
{% for s in seasons %}
<span>
<a href="{{ s.url }}">{{ s.season_number }}</a>
</span>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<div>
{% if item.showtime %}
{% trans '上映时间:' %}
{% for showtime in item.showtime %}
{% for time, region in showtime.items %}
<span>{{ time }}
{% if region != '' %}({{ region }}){% endif %}
</span>
{% endfor %}
{% if not forloop.last %}/{% endif %}
{% endfor %}
{% endif %}
</div>
<div>
{% if item.other_title %}
{% trans '又名:' %}
{% for t in item.other_title %}
<span>{{ t }}</span>
{% if not forloop.last %}/{% endif %}
{% endfor %}
{% endif %}
</div>
<div>
{% if item.site %}
{% trans '网站:' %}
<a href="{{ item.site }}" target="_blank" rel="noopener">{{ item.site|strip_scheme }}</a>
{% endif %}
</div>
{% if item.other_info %}
{% for k, v in item.other_info.items %}<div>{{ k }}{{ v|urlizetrunc:24 }}</div>{% endfor %}
{% endif %}
{% endblock %}
<!-- class specific sidebar -->
{% block sidebar %}{% endblock %}

View file

@ -11,13 +11,6 @@
{% load thumb %}
<!-- class specific details -->
{% block details %}
<div>
{% if item.imdb %}
{% trans 'IMDb' %}<a href="https://www.imdb.com/title/{{ item.imdb }}/"
target="_blank"
rel="noopener">{{ item.imdb }}</a>
{% endif %}
</div>
<div>
{% if item.director %}
{% trans '导演:' %}
@ -30,13 +23,12 @@
{% if item.director|length > 5 %}
<a href="javascript:void(0);" id="directorMore">{% trans '更多' %}</a>
<script>
$("#directorMore").on('click', function (e) {
$("span.director:not(:visible)").each(function (e) {
$(this).parent().removeAttr('style');
});
$(this).remove();
})
$("#directorMore").on('click', function (e) {
$("span.director:not(:visible)").each(function (e) {
$(this).parent().removeAttr('style');
});
$(this).remove();
})
</script>
{% endif %}
{% endif %}
@ -76,13 +68,12 @@
{% if item.actor|length > 5 %}
<a href="javascript:void(0);" id="actorMore">{% trans '更多' %}</a>
<script>
$("#actorMore").on('click', function(e) {
$("span.actor:not(:visible)").each(function(e){
$(this).parent().removeAttr('style');
});
$(this).remove();
})
$("#actorMore").on('click', function(e) {
$("span.actor:not(:visible)").each(function(e){
$(this).parent().removeAttr('style');
});
$(this).remove();
})
</script>
{% endif %}
{% endif %}
@ -114,6 +105,18 @@
{% endfor %}
{% endif %}
</div>
{% with item.all_seasons as seasons %}
{% if seasons %}
<div>
{% trans '本剧所有季:' %}
{% for s in seasons %}
<span class="season-number">
<a href="{{ s.url }}">{{ s.season_number|default:"#" }}</a>
</span>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<div>
{% if item.season_count %}
{% trans '季数:' %}{{ item.season_count }}
@ -129,18 +132,6 @@
{% trans '单集长度:' %}{{ item.single_episode_length }}
{% endif %}
</div>
{% with item.all_seasons as seasons %}
{% if seasons %}
<div>
{% trans '本剧所有季:' %}
{% for s in seasons %}
<span>
<a href="{{ s.url }}">{{ s.season_number }}</a>
</span>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<div>
{% if item.showtime %}
{% trans '播出时间:' %}
@ -163,6 +154,13 @@
{% endfor %}
{% endif %}
</div>
<div>
{% if item.imdb %}
{% trans 'IMDb' %}<a href="https://www.imdb.com/title/{{ item.imdb }}/"
target="_blank"
rel="noopener">{{ item.imdb }}</a>
{% endif %}
</div>
<div>
{% if item.site %}
{% trans '网站:' %}

View file

@ -8,6 +8,22 @@
color: var(--pico-muted-color);
}
span.season-number {
a {
border-radius: calc(var(--pico-spacing)/4);
margin-right: 0.5em;
padding: 0 0.25rem;
border: var(--pico-primary) solid 1px;
&.current {
color: var(--pico-form-element-background-color);
background: var(--pico-primary);
line-height: 1.2em;
text-decoration: none;
}
}
}
.muted .fa-lock {
filter: brightness(50%) !important;
}