5 цвет у команд
This commit is contained in:
3
app.py
3
app.py
@@ -30,7 +30,8 @@ from ui_builder import install_ui_builder
|
|||||||
from khl_site.khl_data_center import APP as khl_site_app
|
from khl_site.khl_data_center import APP as khl_site_app
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent
|
BASE_DIR = Path(__file__).resolve().parent
|
||||||
BUILD_VERSION = "2026.09.23.6"
|
BUILD_VERSION = "2026.09.23.7"
|
||||||
|
# compatibility: BUILD_VERSION = "2026.09.23.6"
|
||||||
# compatibility: BUILD_VERSION = "2026.08.26.1"
|
# compatibility: BUILD_VERSION = "2026.08.26.1"
|
||||||
# compatibility: BUILD_VERSION = "2026.08.25.1"
|
# compatibility: BUILD_VERSION = "2026.08.25.1"
|
||||||
# compatibility: BUILD_VERSION = "2026.08.24.15"
|
# compatibility: BUILD_VERSION = "2026.08.24.15"
|
||||||
|
|||||||
@@ -973,6 +973,7 @@ class MappingDataService:
|
|||||||
(2, "color_2_hex", "color_2_enabled"),
|
(2, "color_2_hex", "color_2_enabled"),
|
||||||
(3, "color_3_hex", "color_3_enabled"),
|
(3, "color_3_hex", "color_3_enabled"),
|
||||||
(4, "color_4_hex", "color_4_enabled"),
|
(4, "color_4_hex", "color_4_enabled"),
|
||||||
|
(5, "color_5_hex", "color_5_enabled"),
|
||||||
)
|
)
|
||||||
for index, color_field, enabled_field in color_specs:
|
for index, color_field, enabled_field in color_specs:
|
||||||
raw_color = str(getattr(team, color_field, "") or "") if team is not None else ""
|
raw_color = str(getattr(team, color_field, "") or "") if team is not None else ""
|
||||||
|
|||||||
@@ -264,6 +264,8 @@ class Team(Base):
|
|||||||
color_3_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
color_3_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||||
color_4_hex: Mapped[str] = mapped_column(String(9), nullable=False, default="")
|
color_4_hex: Mapped[str] = mapped_column(String(9), nullable=False, default="")
|
||||||
color_4_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
color_4_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||||
|
color_5_hex: Mapped[str] = mapped_column(String(9), nullable=False, default="")
|
||||||
|
color_5_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||||
# BUILD135: three operator-editable logo locations. ``logo_url`` remains
|
# BUILD135: three operator-editable logo locations. ``logo_url`` remains
|
||||||
# logo #1 for backwards compatibility with existing SQL/mappings.
|
# logo #1 for backwards compatibility with existing SQL/mappings.
|
||||||
logo_url: Mapped[str] = mapped_column(Text, nullable=False, default="")
|
logo_url: Mapped[str] = mapped_column(Text, nullable=False, default="")
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ class TeamDirectoryPayload(BaseModel):
|
|||||||
color_3_enabled: bool = False
|
color_3_enabled: bool = False
|
||||||
color_4_hex: str = Field(default="", max_length=9)
|
color_4_hex: str = Field(default="", max_length=9)
|
||||||
color_4_enabled: bool = False
|
color_4_enabled: bool = False
|
||||||
|
color_5_hex: str = Field(default="", max_length=9)
|
||||||
|
color_5_enabled: bool = False
|
||||||
logo_url: str = Field(default="", max_length=2000)
|
logo_url: str = Field(default="", max_length=2000)
|
||||||
logo_2_url: str = Field(default="", max_length=2000)
|
logo_2_url: str = Field(default="", max_length=2000)
|
||||||
logo_3_url: str = Field(default="", max_length=2000)
|
logo_3_url: str = Field(default="", max_length=2000)
|
||||||
|
|||||||
@@ -1793,11 +1793,14 @@ class HockeyDataService:
|
|||||||
"color_3_enabled": bool(team.color_3_enabled),
|
"color_3_enabled": bool(team.color_3_enabled),
|
||||||
"color_4_hex": team.color_4_hex,
|
"color_4_hex": team.color_4_hex,
|
||||||
"color_4_enabled": bool(team.color_4_enabled),
|
"color_4_enabled": bool(team.color_4_enabled),
|
||||||
|
"color_5_hex": team.color_5_hex,
|
||||||
|
"color_5_enabled": bool(team.color_5_enabled),
|
||||||
"colors": [
|
"colors": [
|
||||||
{"index": 1, "hex": team.color_hex, "enabled": bool(team.color_enabled)},
|
{"index": 1, "hex": team.color_hex, "enabled": bool(team.color_enabled)},
|
||||||
{"index": 2, "hex": team.color_2_hex, "enabled": bool(team.color_2_enabled)},
|
{"index": 2, "hex": team.color_2_hex, "enabled": bool(team.color_2_enabled)},
|
||||||
{"index": 3, "hex": team.color_3_hex, "enabled": bool(team.color_3_enabled)},
|
{"index": 3, "hex": team.color_3_hex, "enabled": bool(team.color_3_enabled)},
|
||||||
{"index": 4, "hex": team.color_4_hex, "enabled": bool(team.color_4_enabled)},
|
{"index": 4, "hex": team.color_4_hex, "enabled": bool(team.color_4_enabled)},
|
||||||
|
{"index": 5, "hex": team.color_5_hex, "enabled": bool(team.color_5_enabled)},
|
||||||
],
|
],
|
||||||
"logo_url": team.logo_url,
|
"logo_url": team.logo_url,
|
||||||
"logo_2_url": team.logo_2_url,
|
"logo_2_url": team.logo_2_url,
|
||||||
@@ -1957,6 +1960,7 @@ class HockeyDataService:
|
|||||||
("color_2_hex", "color_2_enabled"),
|
("color_2_hex", "color_2_enabled"),
|
||||||
("color_3_hex", "color_3_enabled"),
|
("color_3_hex", "color_3_enabled"),
|
||||||
("color_4_hex", "color_4_enabled"),
|
("color_4_hex", "color_4_enabled"),
|
||||||
|
("color_5_hex", "color_5_enabled"),
|
||||||
)
|
)
|
||||||
for color_field, enabled_field in color_fields:
|
for color_field, enabled_field in color_fields:
|
||||||
if color_field in payload and payload[color_field] is not None:
|
if color_field in payload and payload[color_field] is not None:
|
||||||
|
|||||||
@@ -150,7 +150,7 @@
|
|||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const teamColorsCellMarkup = (item) => [1, 2, 3, 4].map((index) => {
|
const teamColorsCellMarkup = (item) => [1, 2, 3, 4, 5].map((index) => {
|
||||||
const field = teamColorFieldName(index);
|
const field = teamColorFieldName(index);
|
||||||
const enabledField = teamColorEnabledName(index);
|
const enabledField = teamColorEnabledName(index);
|
||||||
const value = normalizeTeamColorHex(item?.[field]);
|
const value = normalizeTeamColorHex(item?.[field]);
|
||||||
@@ -499,6 +499,7 @@
|
|||||||
${teamColorEditorMarkup(editing, 2)}
|
${teamColorEditorMarkup(editing, 2)}
|
||||||
${teamColorEditorMarkup(editing, 3)}
|
${teamColorEditorMarkup(editing, 3)}
|
||||||
${teamColorEditorMarkup(editing, 4)}
|
${teamColorEditorMarkup(editing, 4)}
|
||||||
|
${teamColorEditorMarkup(editing, 5)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label class="hockey-directory-check"><input type="checkbox" name="active" ${editing?.active === false ? "" : "checked"}><span>Активна</span></label>
|
<label class="hockey-directory-check"><input type="checkbox" name="active" ${editing?.active === false ? "" : "checked"}><span>Активна</span></label>
|
||||||
@@ -3928,14 +3929,14 @@
|
|||||||
});
|
});
|
||||||
updateEnabledUi();
|
updateEnabledUi();
|
||||||
};
|
};
|
||||||
[1, 2, 3, 4].forEach(bindTeamColor);
|
[1, 2, 3, 4, 5].forEach(bindTeamColor);
|
||||||
|
|
||||||
modal.querySelector("[data-team-form]")?.addEventListener("submit", async (event) => {
|
modal.querySelector("[data-team-form]")?.addEventListener("submit", async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const form = event.currentTarget;
|
const form = event.currentTarget;
|
||||||
const values = new FormData(form);
|
const values = new FormData(form);
|
||||||
const normalizedColors = {};
|
const normalizedColors = {};
|
||||||
for (const index of [1, 2, 3, 4]) {
|
for (const index of [1, 2, 3, 4, 5]) {
|
||||||
const field = teamColorFieldName(index);
|
const field = teamColorFieldName(index);
|
||||||
const enabledField = teamColorEnabledName(index);
|
const enabledField = teamColorEnabledName(index);
|
||||||
const raw = String(values.get(field) || "").trim();
|
const raw = String(values.get(field) || "").trim();
|
||||||
@@ -3967,6 +3968,8 @@
|
|||||||
color_3_enabled: normalizedColors.color_3_enabled,
|
color_3_enabled: normalizedColors.color_3_enabled,
|
||||||
color_4_hex: normalizedColors.color_4_hex,
|
color_4_hex: normalizedColors.color_4_hex,
|
||||||
color_4_enabled: normalizedColors.color_4_enabled,
|
color_4_enabled: normalizedColors.color_4_enabled,
|
||||||
|
color_5_hex: normalizedColors.color_5_hex,
|
||||||
|
color_5_enabled: normalizedColors.color_5_enabled,
|
||||||
logo_url: normalizeTeamMediaPath(values.get("logo_url") || ""),
|
logo_url: normalizeTeamMediaPath(values.get("logo_url") || ""),
|
||||||
logo_2_url: normalizeTeamMediaPath(values.get("logo_2_url") || ""),
|
logo_2_url: normalizeTeamMediaPath(values.get("logo_2_url") || ""),
|
||||||
logo_3_url: normalizeTeamMediaPath(values.get("logo_3_url") || ""),
|
logo_3_url: normalizeTeamMediaPath(values.get("logo_3_url") || ""),
|
||||||
|
|||||||
Reference in New Issue
Block a user