From d48a18b3f4c2c5c3011d65e3df301343cf0259a3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 14 Jul 2024 10:45:27 -0400 Subject: [PATCH] display item desc by locale --- catalog/common/models.py | 2 +- catalog/jobs/discover.py | 4 ++-- catalog/search/external.py | 2 +- catalog/templates/_item_card_metadata_album.html | 2 +- catalog/templates/_item_card_metadata_base.html | 2 +- catalog/templates/_item_card_metadata_edition.html | 2 +- catalog/templates/_item_card_metadata_game.html | 2 +- catalog/templates/_item_card_metadata_movie.html | 2 +- catalog/templates/_item_card_metadata_performance.html | 2 +- .../_item_card_metadata_performanceproduction.html | 4 +++- catalog/templates/_item_card_metadata_podcast.html | 2 +- catalog/templates/_item_card_metadata_tvseason.html | 2 +- catalog/templates/_item_card_metadata_tvshow.html | 2 +- catalog/templates/_item_card_metadata_work.html | 2 +- catalog/templates/item_base.html | 10 +++++----- catalog/templates/podcast.html | 2 +- catalog/templates/podcast_episode_data.html | 2 +- 17 files changed, 24 insertions(+), 22 deletions(-) diff --git a/catalog/common/models.py b/catalog/common/models.py index 5f4cfede..9ed833da 100644 --- a/catalog/common/models.py +++ b/catalog/common/models.py @@ -636,7 +636,7 @@ class Item(PolymorphicModel): @property def brief_description(self): - return self.brief[:155] + return self.display_description[:155] @classmethod def get_by_url(cls, url_or_b62: str, resolve_merge=False) -> "Self | None": diff --git a/catalog/jobs/discover.py b/catalog/jobs/discover.py index 8c5b15f0..83e5edaf 100644 --- a/catalog/jobs/discover.py +++ b/catalog/jobs/discover.py @@ -128,8 +128,8 @@ class DiscoverGenerator(BaseJob): ).count() trends.append( { - "title": i.title, - "description": i.brief, + "title": i.display_title, + "description": i.display_description, "url": i.absolute_url, "image": i.cover_image_url or "", "provider_name": str(i.category.label), diff --git a/catalog/search/external.py b/catalog/search/external.py index bc9ff399..091686a6 100644 --- a/catalog/search/external.py +++ b/catalog/search/external.py @@ -36,7 +36,7 @@ class SearchResultItem: self.source_url = source_url self.display_title = title self.subtitle = subtitle - self.brief = brief + self.display_description = brief self.cover_image_url = cover_url @property diff --git a/catalog/templates/_item_card_metadata_album.html b/catalog/templates/_item_card_metadata_album.html index ff5cb4fc..eff0aa5c 100644 --- a/catalog/templates/_item_card_metadata_album.html +++ b/catalog/templates/_item_card_metadata_album.html @@ -19,7 +19,7 @@
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_base.html b/catalog/templates/_item_card_metadata_base.html index eff4b653..0b829c65 100644 --- a/catalog/templates/_item_card_metadata_base.html +++ b/catalog/templates/_item_card_metadata_base.html @@ -41,7 +41,7 @@
{% block full %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %}
diff --git a/catalog/templates/_item_card_metadata_edition.html b/catalog/templates/_item_card_metadata_edition.html index 15f59108..e7124e0a 100644 --- a/catalog/templates/_item_card_metadata_edition.html +++ b/catalog/templates/_item_card_metadata_edition.html @@ -32,6 +32,6 @@ {% endblock brief %} {% block full %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_game.html b/catalog/templates/_item_card_metadata_game.html index cae34c34..27364811 100644 --- a/catalog/templates/_item_card_metadata_game.html +++ b/catalog/templates/_item_card_metadata_game.html @@ -18,6 +18,6 @@ {% include '_people.html' with people=item.publisher role='publisher' max=2 %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_movie.html b/catalog/templates/_item_card_metadata_movie.html index 10379667..dd2a4b72 100644 --- a/catalog/templates/_item_card_metadata_movie.html +++ b/catalog/templates/_item_card_metadata_movie.html @@ -13,6 +13,6 @@ {% block full %}
{% include '_people.html' with people=item.additional_title role='other title' max=2 %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_performance.html b/catalog/templates/_item_card_metadata_performance.html index 4e3c067d..683e030e 100644 --- a/catalog/templates/_item_card_metadata_performance.html +++ b/catalog/templates/_item_card_metadata_performance.html @@ -24,6 +24,6 @@ {% include '_people.html' with people=item.performer role='performer' max=5 %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_performanceproduction.html b/catalog/templates/_item_card_metadata_performanceproduction.html index f95b4920..27010644 100644 --- a/catalog/templates/_item_card_metadata_performanceproduction.html +++ b/catalog/templates/_item_card_metadata_performanceproduction.html @@ -24,6 +24,8 @@ {% include '_people.html' with people=item.performer role='performer' max=2 %}
- {% if not hide_brief %}{{ item.brief | default:item.parent_item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %} + {{ item.display_description | default:item.parent_item.display_description | linebreaksbr }} + {% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_podcast.html b/catalog/templates/_item_card_metadata_podcast.html index 2c611b08..e3d925e5 100644 --- a/catalog/templates/_item_card_metadata_podcast.html +++ b/catalog/templates/_item_card_metadata_podcast.html @@ -11,6 +11,6 @@ {% endblock brief %} {% block full %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_tvseason.html b/catalog/templates/_item_card_metadata_tvseason.html index 4e619e87..0951a41c 100644 --- a/catalog/templates/_item_card_metadata_tvseason.html +++ b/catalog/templates/_item_card_metadata_tvseason.html @@ -12,6 +12,6 @@ {% endblock brief %} {% block full %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_tvshow.html b/catalog/templates/_item_card_metadata_tvshow.html index 10379667..dd2a4b72 100644 --- a/catalog/templates/_item_card_metadata_tvshow.html +++ b/catalog/templates/_item_card_metadata_tvshow.html @@ -13,6 +13,6 @@ {% block full %}
{% include '_people.html' with people=item.additional_title role='other title' max=2 %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/_item_card_metadata_work.html b/catalog/templates/_item_card_metadata_work.html index 639bf1b5..66928086 100644 --- a/catalog/templates/_item_card_metadata_work.html +++ b/catalog/templates/_item_card_metadata_work.html @@ -12,6 +12,6 @@ {% block full %}
{% include '_people.html' with people=item.additional_title role='other title' max=2 %}
- {% if not hide_brief %}{{ item.brief | linebreaksbr }}{% endif %} + {% if not hide_brief %}{{ item.display_description | linebreaksbr }}{% endif %}
{% endblock full %} diff --git a/catalog/templates/item_base.html b/catalog/templates/item_base.html index 1c80e913..a1e0ae04 100644 --- a/catalog/templates/item_base.html +++ b/catalog/templates/item_base.html @@ -18,7 +18,7 @@ {% if item.has_cover %}{% endif %} - + {% if item.is_deleted or item.merged_to_item %}{% endif %} {{ site_name }} - {% trans item.category.label %} | {{ item.display_title }} {% include "common_libs.html" %} @@ -228,10 +228,10 @@
{% trans 'overview' %}
- {% if item.brief %} -

{{ item.brief | linebreaksbr }}

- {% elif item.parent_item.brief %} -

{{ item.parent_item.brief | linebreaksbr }}

+ {% if item.display_description %} +

{{ item.display_description | linebreaksbr }}

+ {% elif item.parent_item.display_description %} +

{{ item.parent_item.display_description | linebreaksbr }}

{% else %}

{% trans 'nothing so far.' %}

{% endif %} diff --git a/catalog/templates/podcast.html b/catalog/templates/podcast.html index ea21450e..1ccc6a96 100644 --- a/catalog/templates/podcast.html +++ b/catalog/templates/podcast.html @@ -38,7 +38,7 @@ window.podcastData = { "title": "{{ item.display_title | escapejs }}", "subtitle": "", - "description": "{{ item.brief | escapejs }}", + "description": "{{ item.display_description | escapejs }}", "cover": "{{ item.cover.url | escapejs }}", "feeds": [{"type": "audio", "format": "mp3", "url": "{{ item.feed_url | escapejs }}", "variant": "high"}] } diff --git a/catalog/templates/podcast_episode_data.html b/catalog/templates/podcast_episode_data.html index ec877625..854aed9c 100644 --- a/catalog/templates/podcast_episode_data.html +++ b/catalog/templates/podcast_episode_data.html @@ -32,7 +32,7 @@ {{ ep.display_title }} {{ ep.pub_date|date }} - {{ ep.brief | linebreaksbr }} + {{ ep.display_description | linebreaksbr }}

{% if forloop.last %}