mirror of https://github.com/zulip/zulip.git
todo_list: Add task description and index numbers.
The user can pass description along with the task name by splitting the input string with hyphen. Eg: Task Title - Task Description todo_list: Add index numbers to task.
This commit is contained in:
parent
ba2f11f78c
commit
68dcdcd28e
|
@ -28,11 +28,12 @@ exports.task_data_holder = function () {
|
|||
|
||||
self.handle = {
|
||||
new_task: {
|
||||
outbound: function (task) {
|
||||
outbound: function (task, desc) {
|
||||
const event = {
|
||||
type: 'new_task',
|
||||
key: my_idx,
|
||||
task: task,
|
||||
desc: desc,
|
||||
completed: false,
|
||||
};
|
||||
my_idx += 1;
|
||||
|
@ -46,10 +47,12 @@ exports.task_data_holder = function () {
|
|||
inbound: function (sender_id, data) {
|
||||
const idx = data.key;
|
||||
const task = data.task;
|
||||
const desc = data.desc;
|
||||
const completed = data.completed;
|
||||
|
||||
const task_data = {
|
||||
task: task,
|
||||
desc: desc,
|
||||
user_id: sender_id,
|
||||
key: idx,
|
||||
completed: completed,
|
||||
|
@ -126,12 +129,14 @@ exports.activate = function (opts) {
|
|||
e.stopPropagation();
|
||||
elem.find(".widget-error").text('');
|
||||
const task = elem.find("input.add-task").val().trim();
|
||||
const desc = elem.find("input.add-desc").val().trim();
|
||||
|
||||
if (task === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
elem.find(".add-task").val('').focus();
|
||||
elem.find(".add-desc").val('').focus();
|
||||
|
||||
const task_exists = task_data.check_task.task_exists(task);
|
||||
if (task_exists) {
|
||||
|
@ -139,7 +144,7 @@ exports.activate = function (opts) {
|
|||
return;
|
||||
}
|
||||
|
||||
const data = task_data.handle.new_task.outbound(task);
|
||||
const data = task_data.handle.new_task.outbound(task, desc);
|
||||
callback(data);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ img.task-completed {
|
|||
input,
|
||||
button {
|
||||
&.add-task,
|
||||
&.add-desc,
|
||||
&.poll-option,
|
||||
&.poll-question {
|
||||
padding: 4px 6px;
|
||||
|
@ -94,6 +95,7 @@ button {
|
|||
|
||||
button {
|
||||
&.add-task,
|
||||
&.add-desc,
|
||||
&.poll-option,
|
||||
&.poll-question {
|
||||
border-radius: 3px;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<h4>Task list</h4>
|
||||
<div class="add-task-bar">
|
||||
<input type="text" class="add-task" placeholder="{{t 'New task'}}" />
|
||||
<input type="text" class="add-desc" placeholder="{{t 'Description'}}" />
|
||||
<button class="add-task">{{t "Add task" }}</button>
|
||||
<div class="widget-error"></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue