看板UI更新,主要是弹窗的大BUG

This commit is contained in:
zephyr
2026-06-02 07:14:11 -07:00
parent 54a842f4ab
commit 7edf905185
8 changed files with 1104 additions and 102 deletions
+687 -1
View File
@@ -1,3 +1,25 @@
/* =========================================================
custom_dashboard.css — 全站自定义样式(登录页除外)
---------------------------------------------------------
主题色变量 (--login-* / --color-*) 定义在 custom_login.css
本文件直接引用它们(layout.php 先加载 login 再加载本文件)。
章节顺序:
1. 全局背景
2. 顶栏 Headerlogo / 标题 / 项目切换器)
3. 侧边栏 Sidebar
4. 页面头部标签 Page header
5. 列表 / 卡片 / 提示 / 搜索框
6. 顶栏注入组件(视图切换 / 过滤)
7. 项目概览仪表盘(KPI + 标签页)
8. 看板 Kanban board
9. 任务【编辑】弹窗表单布局 (.task-form-*)
10. 任务【新建】弹窗表单布局 (.custom-task-form-*)
11. 弹窗通用外观(所有 #modal-box
约定:弹窗样式只在本文件里改;task_creation/show.php 不再内联 <style>。
========================================================= */
/* custom_dashboard.css */
/* Global Dashboard Background */
@@ -735,7 +757,9 @@ header {
}
/* =========================================================
New Task / Form Modal Redesign
9. 任务【编辑】弹窗 — 表单布局 (.task-form-*)
对应模板:app/Template/task_modification/show.php
(结构与第 10 节的新建任务弹窗相似,但类名不同;将来可考虑合并成一套)
========================================================= */
/* Use CSS Grid for the form container */
@@ -832,3 +856,665 @@ header {
border-radius: 0 0 6px 6px !important;
border-top: none !important;
}
/* =========================================================
10. 任务【新建】弹窗 — 表单布局 (.custom-task-form-*)
对应模板:app/Template/task_creation/show.php
(以前这段是内联在 show.php 里的,现统一搬到这里维护)
========================================================= */
.custom-task-form-container {
display: flex;
gap: 12px;
align-items: stretch;
max-width: 100%;
box-sizing: border-box;
}
.custom-task-form-main { flex: 34; min-width: 0; }
.custom-task-form-secondary { flex: 42; min-width: 0; }
.custom-task-form-tertiary { flex: 24; min-width: 0;
display: flex;
flex-direction: column;
font-size: 0; /* 消除子元素之间的 inline 空白间隙 */
}
.custom-task-form-secondary > *,
.custom-task-form-tertiary > * { font-size: 14px; }
/* 并排布局 & 拼接组件 */
.form-row-top {
display: flex;
align-items: flex-start;
width: 100%;
}
.form-row-gap {
gap: 15px;
}
.form-col {
flex: 1;
min-width: 0;
}
.joined-input-group {
display: flex;
width: 100%;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
background: #fff;
align-items: stretch;
box-sizing: border-box;
}
.joined-input-group .form-col {
flex: 1;
min-width: 0;
margin: 0;
}
.joined-input-group .form-col:first-child {
border-right: 1px solid #ccc;
}
/* 剥除原生边框,使其融合为一个整体组件 (增加权重以覆盖 #modal-box 样式) */
#modal-box .joined-input-group select,
#modal-box .joined-input-group input,
#modal-box .joined-input-group .color-picker-select,
#modal-box .joined-input-group .select2-container--default .select2-selection--single,
#modal-box .joined-input-group .select2-selection {
border: none !important;
border-radius: 0 !important;
box-shadow: none !important;
background: transparent !important;
height: 38px !important;
width: 100% !important;
margin: 0 !important;
padding-left: 10px !important;
padding-right: 10px !important;
outline: none !important;
}
#modal-box .joined-input-group .color-picker-select {
display: flex;
align-items: center;
padding-left: 10px !important;
}
/* 附件区域对齐与编辑器高度 */
.text-editor textarea {
height: 380px !important;
resize: none !important;
overflow-y: auto;
}
.text-editor textarea::-webkit-scrollbar {
width: 8px;
}
.text-editor textarea::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 4px;
}
.text-editor textarea::-webkit-scrollbar-track {
background-color: #f5f5f5;
}
.attachment-area-wrapper {
display: flex;
flex-direction: column;
margin-top: 84px; /* 精确下移以对齐标签栏顶部 */
flex-grow: 1; /* 自动撑满剩余高度,让底部严丝合缝地对齐 */
height: auto !important; /* 放弃硬编码高度,改用弹性盒子自动对齐 */
border: 1px dashed #ccc;
border-radius: 8px;
background: #fafafa;
}
.form-col-selectors {
flex: 1;
}
.form-col-assignee {
flex: 1;
}
/* 附件区域占据剩余高度 */
.attachment-area-wrapper {
flex-grow: 1;
display: flex;
flex-direction: column;
margin-top: 15px;
border: 1px dashed #ccc;
border-radius: 8px;
background: #fafafa;
min-height: 250px;
}
.attachment-area-title {
padding: 10px 15px;
font-size: 14px;
font-weight: 600;
color: #444;
border-bottom: 1px solid #eee;
}
.custom-attachments-content {
flex-grow: 1;
}
/* 覆盖默认的内联样式和 49% 宽度,让附件框纵向铺满 */
.custom-task-form-secondary .task-form-bottom-column {
width: 100% !important;
display: block !important;
margin: 0 !important;
flex-grow: 1;
position: relative;
}
.custom-task-form-secondary .task-form-bottom-column:first-child {
border-bottom: 1px dashed #ccc;
}
.custom-task-form-secondary .dropzone {
height: 100%;
min-height: 120px;
border: none;
background: transparent;
display: flex;
align-items: center;
justify-content: center;
}
#screenshot-zone {
height: 100%;
min-height: 120px;
display: flex;
align-items: center;
justify-content: center;
}
.form-actions-wrapper { margin-top: auto; padding-top: 15px; display: flex; flex-direction: column; gap: 15px; }
/* 复选框样式按钮化 */
.checkbox-group label {
display: flex;
align-items: center;
border: 1px solid #ccc;
border-radius: 4px;
padding: 8px 12px;
margin-bottom: 10px;
font-size: 14px !important;
font-weight: normal;
background: #fff;
cursor: pointer;
box-sizing: border-box;
width: 100%;
}
.checkbox-group input[type="checkbox"] {
margin: 0 10px 0 0 !important;
}
.submit-buttons-wrapper { margin-top: auto; display: flex; justify-content: flex-end; gap: 10px; align-items: center; flex-wrap: wrap; }
.submit-buttons-wrapper .btn {
padding: 8px 20px;
font-size: 14px;
border-radius: 4px;
text-decoration: none;
font-weight: 500;
}
#modal-box .submit-buttons-wrapper .btn-cancel {
border: 1px solid #ccc !important;
background: #fff !important;
color: #333 !important;
}
#modal-box .submit-buttons-wrapper .btn-cancel:hover {
background: #f5f5f5 !important;
}
.submit-buttons-wrapper .btn-blue {
background: #007bff;
color: #fff;
border: 1px solid #007bff;
}
.submit-buttons-wrapper .btn-blue:hover {
background: #0056b3;
}
.custom-task-form-container label {
display: block;
font-size: 13px;
font-weight: 600;
color: #444;
margin-bottom: 4px;
margin-top: 8px;
}
.custom-task-form-container input[type="text"],
.custom-task-form-container input[type="number"],
.custom-task-form-container input[type="password"],
.custom-task-form-container select,
.custom-task-form-container textarea {
width: 100%;
max-width: 100%;
padding: 6px 10px;
border: 1px solid #d1d5db;
border-radius: 6px;
box-sizing: border-box;
font-size: 14px;
color: #333;
transition: all 0.2s ease;
background-color: #fff;
}
.custom-task-form-container input[type="text"]:focus,
.custom-task-form-container input[type="number"]:focus,
.custom-task-form-container input[type="password"]:focus,
.custom-task-form-container select:focus,
.custom-task-form-container textarea:focus {
border-color: var(--color-primary, #3468C0);
box-shadow: 0 0 0 3px rgba(52, 104, 192, 0.1);
outline: none;
}
/* 横向滚动条根因修复(标注图问题①):
Kanboard 核心给 markdown 编辑器写死了 .text-editor textarea{width:700px}
放进三列网格后这 700px 会把整张表撑到约 1440px,于是 #modal-box(核心设了
overflow:auto)冒出横向滚动条。这里把编辑器/预览区强制改成 100%,让它随所在列
自适应——从根上消除溢出,而不是把内容裁掉。 */
.custom-task-form-container .text-editor,
.custom-task-form-container .text-editor textarea,
.custom-task-form-container .text-editor .text-editor-preview-area,
.task-form-container .text-editor,
.task-form-container .text-editor textarea,
.task-form-container .text-editor .text-editor-preview-area {
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
}
/* 把网格锁死在父容器宽度内,配合各列 min-width:0,fr 轨道只在可用宽度里分配 */
.custom-task-form-container,
.task-form-container { width: 100%; min-width: 0; box-sizing: border-box; }
.custom-task-form-container *,
.task-form-container * { box-sizing: border-box; }
/* 核心给日期/数字/参考等字段写死了 150px 等小宽度,让它们填满所在列,列更整齐 */
.custom-task-form-container input.form-datetime,
.custom-task-form-container input.form-date,
.custom-task-form-container input.form-numeric,
.custom-task-form-container input.form-input-small,
.custom-task-form-container input.form-input-large,
.task-form-container input.form-datetime,
.task-form-container input.form-date,
.task-form-container input.form-numeric,
.task-form-container input.form-input-small,
.task-form-container input.form-input-large {
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
}
/* 收掉那条“幽灵”横向滚动条:强制无视子元素溢出 */
#modal-box { overflow-x: hidden !important; overflow-y: auto !important; }
/* =========================================================
11. 弹窗通用外观(所有 #modal-box:新建 / 编辑 / 其它弹窗共用)
========================================================= */
/* Overlay: Glassmorphism effect & Positioning */
#modal-overlay {
background: rgba(0, 0, 0, 0.45) !important;
backdrop-filter: blur(5px) !important;
-webkit-backdrop-filter: blur(5px) !important;
transition: opacity 0.3s ease;
display: flex !important;
flex-direction: column !important;
align-items: center !important;
justify-content: flex-start !important;
padding-top: 20vh !important; /* 整体位置偏下 */
padding-bottom: 5vh !important; /* 保证底部不会贴死,留出滚动空间 */
overflow-y: auto !important;
}
/* Modal Container */
#modal-box {
margin: 0 !important; /* 移除 Kanboard 默认的上边距 */
flex-shrink: 0 !important; /* 防止在小屏幕下被挤压变形 */
box-sizing: border-box !important;
width: 950px !important;
max-width: 95vw !important;
border-radius: 12px !important;
box-shadow: 0 12px 36px rgba(0,0,0,0.15) !important;
border: none !important;
background: #ffffff !important;
padding: 20px 25px !important;
animation: modalSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes modalSlideUp {
from {
opacity: 0;
transform: translate(-50%, 20px) scale(0.98);
}
to {
opacity: 1;
transform: translate(-50%, 0) scale(1);
}
}
/* Modal Header */
#modal-box .page-header {
border-bottom: 1px solid #eaeaea !important;
padding-bottom: 10px !important;
margin-bottom: 15px !important;
}
#modal-box .page-header h2 {
font-size: 22px !important;
font-weight: 600 !important;
color: #2c3e50 !important;
margin: 0 !important;
}
/* Generic Form Elements inside Modal (catching everything) */
#modal-box input[type="text"],
#modal-box input[type="password"],
#modal-box input[type="email"],
#modal-box input[type="number"],
#modal-box select,
#modal-box textarea {
width: 100% !important;
max-width: 100% !important;
padding: 6px 10px !important;
border: 1px solid #d1d5db !important;
border-radius: 6px !important;
box-sizing: border-box !important;
font-size: 14px !important;
color: #333 !important;
transition: all 0.2s ease !important;
background-color: #fff !important;
margin-top: 2px !important;
margin-bottom: 6px !important;
}
#modal-box input:focus,
#modal-box select:focus,
#modal-box textarea:focus {
border-color: var(--color-primary, #3468C0) !important;
box-shadow: 0 0 0 3px rgba(52, 104, 192, 0.15) !important;
outline: none !important;
}
/* Labels */
#modal-box label {
display: block; /* 移除 !important,允许 JS 隐藏 label */
font-size: 13px !important;
font-weight: 600 !important;
color: #555 !important;
margin-bottom: 2px !important;
margin-top: 6px !important;
}
/* 特殊的类,用于 JS 隐藏 label 强行覆盖 */
#modal-box label.hide-placeholder-label {
display: none !important;
}
/* Buttons inside Modal */
#modal-box .btn {
padding: 10px 20px !important;
font-size: 14px !important;
font-weight: 600 !important;
border-radius: 6px !important;
transition: all 0.2s ease !important;
border: none !important;
cursor: pointer !important;
}
#modal-box .btn:hover {
transform: translateY(-1px) !important;
box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
}
#modal-box .btn-blue {
background: var(--color-primary, #3468C0) !important;
color: white !important;
}
#modal-box .btn-blue:hover {
background: #2a56a0 !important; /* Slightly darker on hover */
}
#modal-box .btn-red {
background: #e74c3c !important;
color: white !important;
}
#modal-box .btn-red:hover {
background: #c0392b !important;
}
/* Cancel Links */
#modal-box .form-actions a {
color: #888 !important;
text-decoration: none !important;
margin-left: 15px !important;
font-size: 14px !important;
font-weight: 500 !important;
}
#modal-box .form-actions a:hover {
color: #333 !important;
}
/* Fix close button at top right */
#modal-close-button {
color: #999 !important;
font-size: 24px !important;
line-height: 1 !important;
transition: color 0.2s !important;
top: 18px !important;
right: 25px !important;
}
#modal-close-button:hover {
color: #333 !important;
}
/* Fix color picker dropdown menu positioning & transparency */
#select-dropdown-menu {
background: #fff !important;
border-radius: 6px !important;
box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
border: 1px solid #e2e8f0 !important;
z-index: 99999 !important;
margin-top: 4px !important;
}
.select-dropdown-input-container #select-dropdown-menu {
top: 100% !important;
left: 0 !important;
min-width: 100% !important;
}
/* =========================================================
12. 任务详情页 UI 优化 (Task View)
========================================================= */
/* 1. 左侧侧边栏 (Sidebar) 现代化 */
#task-view .sidebar {
background-color: #f8fafc !important;
border-right: 1px solid #e2e8f0 !important;
padding: 20px 15px !important;
border-radius: 12px 0 0 12px;
}
#task-view .sidebar > ul > li {
margin-bottom: 4px !important;
}
#task-view .sidebar > ul > li > a {
display: flex !important;
align-items: center !important;
padding: 10px 14px !important;
color: #475569 !important;
font-weight: 500 !important;
text-align: left !important;
}
#task-view .sidebar > ul > li > a i {
position: static !important;
transform: none !important;
margin-right: 10px !important;
color: #64748b;
}
#task-view .sidebar > ul > li > a .sidebar-text {
width: auto !important;
text-align: left !important;
}
#task-view .sidebar > ul > li:hover,
#task-view .sidebar > ul > li.active {
background: transparent !important; /* Remove old yellow hover */
}
#task-view .sidebar > ul > li > a:hover {
background-color: #f1f5f9 !important;
color: #1e293b !important;
}
#task-view .sidebar > ul > li.active > a {
background-color: #e0f2fe !important;
color: #0284c7 !important;
font-weight: 600 !important;
}
#task-view .sidebar > ul > li.active > a i {
color: #0284c7 !important;
}
#task-view .sidebar-title h2 {
font-size: 12px !important;
text-transform: uppercase !important;
color: #94a3b8 !important;
letter-spacing: 0.05em !important;
margin-top: 20px !important;
margin-bottom: 8px !important;
padding-left: 14px !important;
border-bottom: none !important;
font-weight: 700 !important;
}
/* 2. 顶部元数据框 (黄框重构) */
#task-summary .task-summary-container {
background: #ffffff !important;
border: 1px solid #e2e8f0 !important;
border-radius: 10px !important;
padding: 20px 25px !important;
box-shadow: 0 4px 12px rgba(0,0,0,0.03) !important;
position: relative;
overflow: hidden;
margin-bottom: 25px !important;
}
/* 左侧彩色提示线 - 缩小颜色面积 */
#task-summary .task-summary-container[class*="color-"] {
border-left-width: 5px !important;
}
#task-summary .task-summary-container.color-yellow { border-left-color: #f59e0b !important; }
#task-summary .task-summary-container.color-blue { border-left-color: #3b82f6 !important; }
#task-summary .task-summary-container.color-green { border-left-color: #10b981 !important; }
#task-summary .task-summary-container.color-purple { border-left-color: #8b5cf6 !important; }
#task-summary .task-summary-container.color-red { border-left-color: #ef4444 !important; }
#task-summary .task-summary-container.color-orange { border-left-color: #f97316 !important; }
#task-summary .task-summary-container.color-grey { border-left-color: #64748b !important; }
#task-summary .task-summary-container.color-brown { border-left-color: #78350f !important; }
#task-summary .task-summary-container.color-deep_orange { border-left-color: #ea580c !important; }
#task-summary .task-summary-container.color-dark_grey { border-left-color: #334155 !important; }
#task-summary .task-summary-container.color-pink { border-left-color: #ec4899 !important; }
#task-summary .task-summary-container.color-teal { border-left-color: #14b8a6 !important; }
#task-summary .task-summary-container.color-cyan { border-left-color: #06b6d4 !important; }
#task-summary .task-summary-container.color-lime { border-left-color: #84cc16 !important; }
#task-summary .task-summary-container.color-light_green { border-left-color: #22c55e !important; }
#task-summary .task-summary-container.color-light_blue { border-left-color: #0ea5e9 !important; }
#task-summary h2 {
font-size: 22px !important;
font-weight: 700 !important;
color: #1e293b !important;
margin-bottom: 20px !important;
}
/* 元数据排版重塑: 改为上下结构 */
#task-summary .task-summary-columns {
display: flex !important;
flex-wrap: nowrap !important;
gap: 30px !important;
}
#task-summary .task-summary-column {
flex: 1 !important;
}
#task-summary .task-summary-column ul.no-bullet {
padding-left: 0 !important;
margin: 0 !important;
}
#task-summary .task-summary-column ul.no-bullet li {
display: flex !important;
flex-direction: column !important;
margin-bottom: 16px !important;
line-height: 1.4 !important;
}
#task-summary .task-summary-column ul.no-bullet li strong {
font-size: 12px !important;
color: #64748b !important;
font-weight: 500 !important;
margin-bottom: 4px !important;
text-transform: capitalize !important;
}
#task-summary .task-summary-column ul.no-bullet li span {
font-size: 14px !important;
color: #0f172a !important;
font-weight: 600 !important;
}
#task-summary .task-summary-column ul.no-bullet li small {
margin-top: 8px !important;
}
#task-summary .task-summary-column ul.no-bullet li small a {
color: #3b82f6 !important;
text-decoration: none !important;
font-size: 13px !important;
font-weight: 500 !important;
}
/* 3. 折叠面板 (Accordions) 视觉升级 */
.accordion-section {
margin-top: 25px !important;
background: #ffffff !important;
border-radius: 10px !important;
border: 1px solid #e2e8f0 !important;
box-shadow: 0 2px 8px rgba(0,0,0,0.02) !important;
overflow: hidden !important;
}
.accordion-title {
font-size: 16px !important;
font-weight: 600 !important;
color: #1e293b !important;
padding: 16px 20px !important;
background: #f8fafc !important;
border-bottom: 1px solid #e2e8f0 !important;
cursor: pointer !important;
list-style: none !important; /* 隐藏浏览器原生三角 */
display: flex !important;
align-items: center !important;
margin: 0 !important;
}
/* 隐藏 Safari 原生三角 */
.accordion-title::-webkit-details-marker {
display: none !important;
}
/* 自定义右侧箭头 */
.accordion-title::before {
content: "\f105" !important; /* FontAwesome fa-angle-right */
font-family: FontAwesome !important;
display: inline-block !important;
width: 24px !important;
transition: transform 0.2s ease !important;
color: #94a3b8 !important;
font-size: 18px !important;
}
details[open] > .accordion-title::before {
transform: rotate(90deg) !important;
}
.accordion-content {
padding: 20px !important;
}
+109
View File
@@ -0,0 +1,109 @@
/* =========================================================
custom_dashboard.css — 全站自定义样式(登录页除外)
---------------------------------------------------------
主题色变量 (--login-* / --color-*) 定义在 custom_login.css
本文件直接引用它们(layout.php 先加载 login 再加载本文件)。
章节顺序:
1. 全局背景
2. 顶栏 Headerlogo / 标题 / 项目切换器)
3. 侧边栏 Sidebar
4. 页面头部标签 Page header
5. 列表 / 卡片 / 提示 / 搜索框
6. 顶栏注入组件(视图切换 / 过滤)
7. 项目概览仪表盘(KPI + 标签页)
8. 看板 Kanban board
9. 任务【编辑】弹窗表单布局 (.task-form-*)
10. 任务【新建】弹窗表单布局 (.custom-task-form-*)
11. 弹窗通用外观(所有 #modal-box
约定:弹窗样式只在本文件里改;task_creation/show.php 不再内联 <style>。
========================================================= */
/* custom_dashboard.css */
/* Global Dashboard Background */
body {
background: var(--login-bg) !important;
color: var(--login-text-color) !important;
}
/* Header & Title Stack Restructuring */
.header-left {
display: flex;
align-items: center;
}
.header-left .logo {
font-size: 32px;
margin-right: 15px;
line-height: 1;
}
.header-titles-stack {
display
margin-bottom: 4px;
}
.task-board-title a {
color: #222 !important;
}
.task-board-title a:hover {
color: var(--color-primary) !important;
text-decoration: none;
}
/* Clean up add button */
.board-add-icon {
color: var(--color-primary) !important;
font-size: 16px;
opacity: 0.8;
}
.board-add-icon:hover {
opacity: 1;
}
/* =========================================================
9. 任务【编辑】弹窗 — 表单布局 (.task-form-*)
对应模板:app/Template/task_modification/show.php
(结构与第 10 节的新建任务弹窗相似,但类名不同;将来可考虑合并成一套)
========================================================= */
/* Use CSS Grid for the form container */
.task-form-container {
display: grid !important;
grid-template-columns: 2fr 1fr 1fr;
gap: 20px;
}
/* Make columns fill their grid cells */
.task-form-main-column,
.task-form-secondary-column {
width: 100% !important;
float: none !important;
}
/* Bottom area spans across all columns */
.task-form-bottom {
grid-column: 1 / -1;
margin-top: 15px;
padding-top: 20px;
border-top: 1px solid #f0f0f0;
}
/* Labels */
.task-form-container label {
display: block;
font-size: 13px;
font-weight: 600;
color: #444;
margin-bottom: 6px;
margin-top: 12px;
}
/* Inputs, Selects, Textareas */
.task-form-container input[type="text"],
.task-form-container input[type="number"],
.task-form-container input[type="password"],
+8
View File
@@ -1,3 +1,11 @@
/* =========================================================
custom_login.css — 登录页样式 +【全站主题色变量】
下面 :root 里的 --login-* 是全站通用的主题令牌,
custom_dashboard.css 等文件都直接引用它们。
layout.php 在 custom_dashboard.css 之前加载本文件,
所以这些变量对后者可见。改主题色就改这里。
========================================================= */
/* custom_login.css */
/* Define variables for Light Theme */
+101
View File
@@ -0,0 +1,101 @@
document.addEventListener("DOMContentLoaded", function() {
var processForm = function(container) {
if (container.dataset.processed === 'true') return;
container.dataset.processed = 'true';
// 1. Hide red stars aggressively
container.querySelectorAll('.form-required').forEach(function(ast) {
ast.remove();
});
// 2. Convert Labels to Placeholders
var labels = container.querySelectorAll('label');
labels.forEach(function(label) {
if (label.closest('.accordion-section') || label.closest('details') || label.closest('.checkbox-group')) return;
var id = label.getAttribute('for');
var input = id ? document.getElementById(id) : null;
if (!input) {
input = label.nextElementSibling;
if (input && input.tagName === 'DIV') input = input.querySelector('input, select, textarea');
}
if (input) {
var cleanText = label.innerText.replace(/\*/g, '').replace(/:/g, '').trim();
var placeholderText = cleanText;
if (input.tagName === 'INPUT' || input.tagName === 'TEXTAREA') {
if (!(input.type === 'hidden' && input.classList.contains('tag-autocomplete'))) {
input.placeholder = placeholderText;
} else {
input.setAttribute('data-placeholder', placeholderText);
}
} else if (input.tagName === 'SELECT') {
if (input.multiple) {
input.setAttribute('data-placeholder', placeholderText);
} else {
var firstOption = input.options[0];
if (firstOption && firstOption.value === "") {
firstOption.text = placeholderText;
}
}
}
// Hide the label after setting placeholder
label.style.display = 'none';
}
});
// 3. Move "Assign to me" (游离的我) inside the Assignee selector
var assignMe = container.querySelector('.assign-me');
if (assignMe) {
var ownerSelect = document.getElementById('form-owner_id');
if (ownerSelect && ownerSelect.parentElement) {
var wrapper = document.createElement('div');
wrapper.className = 'assign-me-wrapper';
wrapper.style.position = 'relative';
wrapper.style.display = 'block';
wrapper.style.width = '100%';
ownerSelect.parentNode.insertBefore(wrapper, ownerSelect);
wrapper.appendChild(ownerSelect);
// Style the 'me' button
assignMe.innerText = 'me';
assignMe.style.position = 'absolute';
assignMe.style.right = '32px'; // Position it inside the select box, before the dropdown arrow
assignMe.style.top = '50%';
assignMe.style.transform = 'translateY(-50%)';
assignMe.style.zIndex = '10';
assignMe.style.margin = '0';
assignMe.style.background = '#e6f4ea';
assignMe.style.color = '#1e8e3e';
assignMe.style.padding = '2px 6px';
assignMe.style.borderRadius = '4px';
assignMe.style.fontSize = '12px';
assignMe.style.fontWeight = 'bold';
assignMe.style.textDecoration = 'none';
wrapper.appendChild(assignMe);
// Hide the extra "Assign to me" text node if any
var small = assignMe.closest('small');
if (small && small !== wrapper) {
small.childNodes.forEach(function(node) {
if (node.nodeType === 3) node.textContent = ''; // Clear text nodes
});
}
}
}
};
// Initialize already present containers
document.querySelectorAll('.custom-task-form-container').forEach(processForm);
// Watch for newly added containers (e.g. AJAX modals)
var observer = new MutationObserver(function(mutations) {
document.querySelectorAll('.custom-task-form-container').forEach(processForm);
});
observer.observe(document.body, { childList: true, subtree: true });
});