Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements #756

Merged
merged 3 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions boofilsic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,11 @@ def _init_language_settings(preferred_lanugages_env):
if SENTRY_DSN:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import ignore_logger
from sentry_sdk.integrations.loguru import LoguruIntegration

ignore_logger("podcastparser")

sentry_env = sys.argv[0].split("/")[-1]
if len(sys.argv) > 1 and sentry_env in ("manage.py", "django-admin"):
sentry_env = sys.argv[1]
Expand Down
34 changes: 26 additions & 8 deletions catalog/templates/item_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,35 @@ <h3>
{% endif %}
</hgroup>
</div>
<style type="text/css"></style>
<div id="item-detail" class="middle">
<section id="item-content">
<h5>{% trans 'overview' %}</h5>
{% if item.display_description %}
<p class="tldr" _="on click toggle .tldr on me">{{ item.display_description | linebreaksbr }}</p>
{% elif item.parent_item.display_description %}
<p class="tldr" _="on click toggle .tldr on me">{{ item.parent_item.display_description | linebreaksbr }}</p>
{% else %}
<p class="empty">{% trans 'nothing so far.' %}</p>
{% endif %}
{% block content %}{% endblock %}
<div class="tldr-box">
<input type="checkbox" id="content-expanded">
{% if item.display_description %}
<p>{{ item.display_description | linebreaksbr }}</p>
{% elif item.parent_item.display_description %}
<p>{{ item.parent_item.display_description | linebreaksbr }}</p>
{% else %}
<p class="empty">{% trans 'nothing so far.' %}</p>
{% endif %}
<label for="content-expanded" role="button" class="outline secondary">{% trans "show more" %}</label>
</div>
<script type="text/javascript">
const ps = document.querySelectorAll('.tldr-box p');
const observer = new ResizeObserver(entries => {
for (let entry of entries) {
entry.target.classList[entry.target.scrollHeight > entry.contentRect.height ? 'add' : 'remove']('truncated');
}
});

ps.forEach(p => {
observer.observe(p);
});
</script>
{% block content %}
{% endblock %}
</section>
<section class="solo-hidden">
<div>
Expand Down
33 changes: 33 additions & 0 deletions common/static/scss/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,39 @@
-webkit-box-orient: vertical;
}

.tldr-box {
input {
opacity: 0;
position: absolute;
pointer-events: none;
}

p {
display: -webkit-box;
-webkit-line-clamp: 10;
-webkit-box-orient: vertical;
overflow: hidden;
}

input:focus ~ label {
outline: -webkit-focus-ring-color auto 5px;
}

input:checked + p {
-webkit-line-clamp: unset;
}

input:checked ~ label,
p:not(.truncated) ~ label{
display: none;
}

label {
padding: 1px 4px
}
}


.longlist {
max-height: 60vh;
overflow-y: scroll;
Expand Down
2 changes: 1 addition & 1 deletion neodb-takahe