slides ok

This commit is contained in:
jr-k 2024-07-16 03:48:50 +02:00
parent cac3be82a9
commit 2db3689b79
4 changed files with 64 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@ -19,13 +19,18 @@
margin: 0 0 2px 0; margin: 0 0 2px 0;
&.disabled { &.disabled {
.body { .infos {
background: #111; .title {
color: #555; color: #333;
border: 1px solid rgba($white, .05);
.range {
opacity: .2;
} }
.type {
i {
color: #333 !important;
}
}
}
.body {
opacity: 0;
} }
} }
@ -47,28 +52,47 @@
} }
} }
.infos {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
color: #AAA;
font-size: 12px;
margin-right: 5px;
flex: 1;
max-width: 120px;
background: $black;
border: 1px solid #333;
border-radius: $baseRadius;
padding: 3px 7px;
&:hover {
.title {
color: white;
}
}
.title { .title {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
flex: 1;
max-width: 120px;
align-self: stretch; align-self: stretch;
word-break: break-all;
a {
font-size: 13px; font-size: 13px;
color: #AAA; color: #AAA;
&:hover {
color: white;
text-decoration: underline;
} }
i { .type {
margin-left: 3px; display: flex;
font-size: 10px; flex-direction: row;
} justify-content: flex-start;
align-items: center;
color: #AAA;
font-size: 12px;
margin-right: 5px;
} }
} }

View File

@ -1,5 +1,7 @@
from enum import Enum from enum import Enum
from typing import Union
from src.util.utils import str_to_enum
class ContentInputType(Enum): class ContentInputType(Enum):
@ -33,7 +35,10 @@ class ContentType(Enum):
return ContentInputType.TEXT return ContentInputType.TEXT
@staticmethod @staticmethod
def get_fa_icon(value: Enum) -> str: def get_fa_icon(value: Union[Enum, str]) -> str:
if isinstance(value, str):
value = str_to_enum(value, ContentType)
if value == ContentType.PICTURE: if value == ContentType.PICTURE:
return 'fa-regular fa-image' return 'fa-regular fa-image'
elif value == ContentType.VIDEO: elif value == ContentType.VIDEO:
@ -47,6 +52,9 @@ class ContentType(Enum):
@staticmethod @staticmethod
def get_color_icon(value: Enum) -> str: def get_color_icon(value: Enum) -> str:
if isinstance(value, str):
value = str_to_enum(value, ContentType)
if value == ContentType.PICTURE: if value == ContentType.PICTURE:
return 'info' return 'info'
elif value == ContentType.VIDEO: elif value == ContentType.VIDEO:

View File

@ -1,17 +1,23 @@
<ul class="slides"> <ul class="slides">
{% for slide in slides %} {% for slide in slides %}
{% set content = contents[slide.content_id] %}
<li class="slide-item {{ 'disabled' if not slide.enabled }}" data-level="{{ slide.id }}" <li class="slide-item {{ 'disabled' if not slide.enabled }}" data-level="{{ slide.id }}"
data-entity="{{ slide.to_json({"content": contents[slide.content_id]}) }}"> data-entity="{{ slide.to_json({"content": content}) }}">
<div class="sort"> <div class="sort">
<a href="javascript:void(0);" class="item-sort slide-sort"> <a href="javascript:void(0);" class="item-sort slide-sort">
<i class="fa fa-bars icon-left"></i> <i class="fa fa-bars icon-left"></i>
</a> </a>
</div> </div>
<div class="title"> <a href="javascript:void(0);" class="infos item-edit slide-edit">
<a href="javascript:void(0);" class="item-edit slide-edit"> <div class="type">
{{ truncate(contents[slide.content_id].name|default(l.common_empty), 30, '...') }} <i class="fa fa-pencil"></i> {% set icon = enum_content_type.get_fa_icon(content.type) %}
</a> {% set color = enum_content_type.get_color_icon(content.type) %}
<i class="fa {{ icon }} {{ color }}"></i>
</div> </div>
<div class="title">
{{ truncate(content.name|default(l.common_empty), 30, '...') }}
</div>
</a>
<div class="body"> <div class="body">
<div class="range"> <div class="range">
<div class="start"> <div class="start">