("input#todo-title-input").val()?.trim();
+
+ if (title === "") {
+ title = "Task list";
+ }
+ const todo_str = `/todo ${title}\n`;
+
+ const todos: string[] = [];
+
+ $(".option-row").each(function () {
+ const todo_name = $(this).find(".todo-input").val()?.toString().trim() ?? "";
+ const todo_description =
+ $(this).find(".todo-description-input").val()?.toString().trim() ?? "";
+
+ if (todo_name) {
+ let todo = "";
+
+ if (todo_name && todo_description) {
+ todo = `${todo_name}: ${todo_description}`;
+ } else if (todo_name && !todo_description) {
+ todo = todo_name;
+ }
+ todos.push(todo);
+ }
+ });
+
+ return todo_str + todos.join("\n");
+}
diff --git a/web/styles/modal.css b/web/styles/modal.css
index e31ade7db0..269677967b 100644
--- a/web/styles/modal.css
+++ b/web/styles/modal.css
@@ -466,7 +466,8 @@
width: 14em;
}
-#add-poll-modal {
+#add-poll-modal,
+#add-todo-modal {
/* this height allows 3-4 option rows
to fit in without need for scrolling */
height: 32.1428em; /* 450px / 14px em */
@@ -481,27 +482,32 @@
}
}
- #add-poll-form {
+ #add-poll-form,
+ #add-todo-form {
display: flex;
flex-direction: column;
overflow: hidden;
height: 100%;
- .poll-label {
+ .poll-label,
+ .todo-label {
font-weight: bold;
margin: 5px 0;
}
- .poll-question-input-container {
+ .poll-question-input-container,
+ .todo-title-input-container {
display: flex;
margin-bottom: 10px;
- #poll-question-input {
+ #poll-question-input,
+ #todo-title-input {
flex-grow: 1;
}
}
- .poll-options-list {
+ .poll-options-list,
+ .todo-options-list {
margin: 0;
height: 0;
overflow: auto;
@@ -525,6 +531,22 @@
margin-bottom: 0;
flex-grow: 1;
}
+
+ .todo-input {
+ flex: 1 1 auto;
+ margin-bottom: 0;
+ max-width: 30%;
+ }
+
+ .todo-description-container {
+ flex: 1 1 auto;
+ display: flex;
+
+ .todo-description-input {
+ flex-grow: 1;
+ margin-bottom: 0;
+ }
+ }
}
.option-row:first-child {
@@ -543,6 +565,22 @@
}
}
}
+
+ @media (max-width: $sm_min) {
+ .option-row {
+ .todo-input {
+ width: 100%;
+ min-width: 90px;
+ }
+
+ .todo-description-container {
+ .todo-description-input {
+ width: 100%;
+ min-width: 90px;
+ }
+ }
+ }
+ }
}
}
diff --git a/web/templates/add_todo_list_modal.hbs b/web/templates/add_todo_list_modal.hbs
new file mode 100644
index 0000000000..25c654e36a
--- /dev/null
+++ b/web/templates/add_todo_list_modal.hbs
@@ -0,0 +1,13 @@
+
diff --git a/web/templates/compose_control_buttons.hbs b/web/templates/compose_control_buttons.hbs
index de5a90e7e0..c757320f0c 100644
--- a/web/templates/compose_control_buttons.hbs
+++ b/web/templates/compose_control_buttons.hbs
@@ -56,7 +56,10 @@
{{#unless message_id}}
+
{{/unless}}
diff --git a/web/templates/todo_modal_task.hbs b/web/templates/todo_modal_task.hbs
new file mode 100644
index 0000000000..21288ac660
--- /dev/null
+++ b/web/templates/todo_modal_task.hbs
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/web/templates/tooltip_templates.hbs b/web/templates/tooltip_templates.hbs
index 7786d133ba..74269f7ddc 100644
--- a/web/templates/tooltip_templates.hbs
+++ b/web/templates/tooltip_templates.hbs
@@ -68,6 +68,12 @@
{{t "A poll must be an entire message." }}
+
+
+ {{t "Add to-do list" }}
+ {{t "A to-do list must be an entire message." }}
+
+
{{t "Add saved snippet" }}
{{tooltip_hotkey_hints "Ctrl" "'"}}