slides ok

This commit is contained in:
jr-k 2024-07-16 03:48:50 +02:00
parent 27c229b676
commit 22598a79eb
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;
&.disabled {
.body {
background: #111;
color: #555;
border: 1px solid rgba($white, .05);
.range {
opacity: .2;
.infos {
.title {
color: #333;
}
.type {
i {
color: #333 !important;
}
}
}
.body {
opacity: 0;
}
}
@ -47,28 +52,47 @@
}
}
.title {
.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;
align-self: stretch;
background: $black;
border: 1px solid #333;
border-radius: $baseRadius;
padding: 3px 7px;
a {
&:hover {
.title {
color: white;
}
}
.title {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
align-self: stretch;
word-break: break-all;
font-size: 13px;
color: #AAA;
}
&:hover {
color: white;
text-decoration: underline;
}
i {
margin-left: 3px;
font-size: 10px;
}
.type {
display: flex;
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 typing import Union
from src.util.utils import str_to_enum
class ContentInputType(Enum):
@ -33,7 +35,10 @@ class ContentType(Enum):
return ContentInputType.TEXT
@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:
return 'fa-regular fa-image'
elif value == ContentType.VIDEO:
@ -47,6 +52,9 @@ class ContentType(Enum):
@staticmethod
def get_color_icon(value: Enum) -> str:
if isinstance(value, str):
value = str_to_enum(value, ContentType)
if value == ContentType.PICTURE:
return 'info'
elif value == ContentType.VIDEO:

View File

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