UI: Training templates fluid video layouts #104435

Merged
Márton Lente merged 13 commits from ui/training-layout-fluid into main 2024-08-23 16:50:27 +02:00
3 changed files with 91 additions and 60 deletions
Showing only changes of commit 38fd647721 - Show all commits

View File

@ -655,6 +655,42 @@ button,
filter: blur(var(--filter-blur-value)) filter: blur(var(--filter-blur-value))
transform: scale(1.1) transform: scale(1.1)
.training-group
--training-group-item-content-width: 100%
--training-group-item-nav-width: 100%
+media-xl
--training-group-item-content-width: 54.0rem
--training-group-item-nav-width: 40.0rem
.training-group-item
+padding(2, x)
.training-group-item-content
@extend .box
background-color: var(--color-bg-tertiary)
width: var(--training-group-item-content-width)
// TODO: revise training-group-item-nav display toggle on medium and small screens
.training-group-item-nav
+margin(3, bottom)
width: var(--training-group-item-nav-width)
.training-group-item-video
+margin(3, bottom)
width: 100%
+media-xl
align-items: center
display: flex
height: calc(100vh - var(--spacer) * 4)
left: 0
margin-bottom: 0
position: sticky
top: 0
width: calc(100% - var(--training-group-item-content-width) - var(--training-group-item-nav-width))
.training-header-img-helper .training-header-img-helper
align-items: center align-items: center
display: flex display: flex

View File

@ -10,25 +10,22 @@
{% block training_header_image %} {% block training_header_image %}
{% endblock training_header_image %} {% endblock training_header_image %}
<div class="container pt-2 pt-md-3"> <div class="container-fluid pt-2 pt-md-3">
<div class="d-md-none mb-3 pt-2 row"> <div class="d-md-none mb-3 pt-2 row">
<div class="col-12"> <div class="col-12">
<button class="btn js-nav-drawer-btn-toggle"><i class="i-list"></i> Content</button> <button class="btn js-nav-drawer-btn-toggle"><i class="i-list"></i> Content</button>
</div> </div>
</div> </div>
<div class="row"> <div class="row training-group">
<div class="col-lg-3 col-md-4 mb-3 fade-xs js-nav-drawer-helper nav-drawer-helper"> <div class="training-group-item training-group-item-nav fade-xs js-nav-drawer-helper nav-drawer-helper">
<nav class="nav-drawer-nested"> <nav class="nav-drawer-nested">
<div class="nav-drawer-body"> <div class="nav-drawer-body">
{% block nested_nav_drawer_inner %} {% block nested_nav_drawer_inner %}{% endblock nested_nav_drawer_inner %}
{% endblock nested_nav_drawer_inner %}
</div> </div>
</nav> </nav>
</div> </div>
<div class="col col-lg-9 col-md-8">
{% block nexted_content %} {% block nexted_content %}{% endblock nexted_content %}
{% endblock nexted_content %}
</div>
</div> </div>
</div> </div>
{% endblock content %} {% endblock content %}

View File

@ -19,26 +19,22 @@
{% endblock %} {% endblock %}
{% block nexted_content %} {% block nexted_content %}
<div class="row mb-3"> <div class="training-group-item training-group-item-video">
{% if section.preview_youtube_link %} {% if section.preview_youtube_link %}
<div class="col"> <div class="overflow-hidden rounded">
<div class="overflow-hidden rounded"> {% include 'common/components/video_player_embed.html' with url=section.preview_youtube_link rounded=True %}
{% include 'common/components/video_player_embed.html' with url=section.preview_youtube_link rounded=True %}
</div>
</div> </div>
{% elif video %} {% elif video %}
<div class="col"> <div class="overflow-hidden rounded">
<div class="overflow-hidden rounded"> {% if section.is_free or request.user|has_active_subscription %}
{% if section.is_free or request.user|has_active_subscription %} {% if user.is_anonymous %}
{% if user.is_anonymous %} {% include 'common/components/video_player.html' with url=video.source.url poster=section.thumbnail_m_url tracks=section.static_asset.video.tracks.all loop=section.static_asset.video.loop %}
{% include 'common/components/video_player.html' with url=video.source.url poster=section.thumbnail_m_url tracks=section.static_asset.video.tracks.all loop=section.static_asset.video.loop %}
{% else %}
{% include 'common/components/video_player.html' with url=video.source.url progress_url=video.progress_url start_position=video.start_position poster=section.thumbnail_m_url tracks=section.static_asset.video.tracks.all loop=section.static_asset.video.loop %}
{% endif %}
{% else %} {% else %}
{% include 'common/components/content_locked.html' with background=section.thumbnail_m_url %} {% include 'common/components/video_player.html' with url=video.source.url progress_url=video.progress_url start_position=video.start_position poster=section.thumbnail_m_url tracks=section.static_asset.video.tracks.all loop=section.static_asset.video.loop %}
{% endif %} {% endif %}
</div> {% else %}
{% include 'common/components/content_locked.html' with background=section.thumbnail_m_url %}
{% endif %}
</div> </div>
{% else %} {% else %}
<div class="col"> <div class="col">
@ -54,47 +50,49 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="row"> <div class="training-group-item training-group-item-content">
<div class="col"> <div class="row">
<div class="align-items-start row"> <div class="col">
<div class="col-12 col-md mb-2 mb-md-3"> <div class="row">
<div class="d-md-block d-none"> <div class="col mb-2 mb-md-3">
<p class="small text-muted">{{ chapter.name }}</p> <div class="d-md-block d-none">
<h2>{{ section.name }}</h2> <p class="small text-muted">{{ chapter.name }}</p>
<h2>{{ section.name }}</h2>
</div>
<div class="text-muted x-sm">
<p class="d-inline me-2">{{ section.date_created|date:"N jS, Y" }}</p>
{% if section.static_asset.license %}
<a href="{{ section.static_asset.license.url }}" target="_blank" class="d-inline me-2 text-muted" data-bs-toggle="tooltip" data-placement="bottom" title="{{ section.static_asset.license.description }}">
<i class="i-info"></i>
{{ section.static_asset.license }}
</a>
{% endif %}
{% if section.is_free %}
{% include "common/components/cards/pill.html" with label='Free' %}
{% endif %}
</div>
</div> </div>
<div class="text-muted x-sm"> <div class="col-12 col-md-auto mb-2 mb-md-0 mt-0 mt-md-3">
<p class="d-inline me-2">{{ section.date_created|date:"N jS, Y" }}</p> {% include "common/components/navigation/buttons_toolbar.html" with item=section %}
{% if section.static_asset.license %}
<a href="{{ section.static_asset.license.url }}" target="_blank" class="d-inline me-2 text-muted" data-bs-toggle="tooltip" data-placement="bottom" title="{{ section.static_asset.license.description }}">
<i class="i-info"></i>
{{ section.static_asset.license }}
</a>
{% endif %}
{% if section.is_free %}
{% include "common/components/cards/pill.html" with label='Free' %}
{% endif %}
</div> </div>
</div> </div>
<div class="col-12 col-md-auto mb-2 mb-md-0 mt-0 mt-md-3"> <div class="row mb-2">
{% include "common/components/navigation/buttons_toolbar.html" with item=section %} {% if section.static_asset.author_image_url %}
</div> <div style="background-image:url('{{ section.static_asset.author_image_url }}');" class="ms-2 profile-avatar"></div>
</div> {% else %}
<div class="row mb-2"> <div style="background-image:url('{% static 'common/images/blank-profile-pic.png' %}');" class="ms-2 profile-avatar">
{% if section.static_asset.author_image_url %} </div>
<div style="background-image:url('{{ section.static_asset.author_image_url }}');" class="ms-2 profile-avatar"></div> {% endif %}
{% else %}
<div style="background-image:url('{% static 'common/images/blank-profile-pic.png' %}');" class="ms-2 profile-avatar">
</div>
{% endif %}
{% include 'common/components/cards/card_profile.html' with user=section.static_asset.user title="Publisher" %} {% include 'common/components/cards/card_profile.html' with user=section.static_asset.user title="Publisher" %}
</div>
<section class="mb-3 markdown-text">
{% with_shortcodes section.text|markdown_unsafe %}
</section>
<section class="mb-3">
{% include 'comments/components/comment_section.html' %}
</section>
</div> </div>
<section class="mb-3 markdown-text">
{% with_shortcodes section.text|markdown_unsafe %}
</section>
<section class="mb-3">
{% include 'comments/components/comment_section.html' %}
</section>
</div> </div>
</div> </div>
{% endblock nexted_content %} {% endblock nexted_content %}