show assigned to others list in todo
diff --git a/erpnext/utilities/page/todo/todo.css b/erpnext/utilities/page/todo/todo.css
index 704e600..0b00b39 100644
--- a/erpnext/utilities/page/todo/todo.css
+++ b/erpnext/utilities/page/todo/todo.css
@@ -1,8 +1,6 @@
.todoitem {
- padding-bottom: 11px;
- border-bottom: 1px solid #DEB85F;
- margin-bottom: 5px;
- height: 14px;
+ padding-bottom: 3px;
+ min-height: 45px;
clear: both;
}
@@ -10,23 +8,42 @@
width: 50px;
display: inline-block;
text-align: center;
- margin-right: 7px;
+ margin-right: 11px;
+ margin-top: 3px;
+ float: left;
}
.todoitem .close {
margin-left: 14px;
- font-size: 14px;
- float: left;
+ font-size: 17px;
+}
+
+.todoitem .close-span {
+ display: inline-block;
+ float: right;
}
.todoitem .ref_link {
- float: left;
- margin-left: 10px;
- display: inline-block;
line-height: 18px;
}
.todoitem .description {
cursor: pointer;
- float: left;
+ padding: 3px 0px;
+ display: inline-block;
}
+
+#todo-list, #assigned-todo-list {
+ float: left;
+ width: 50%;
+}
+
+.todo-separator {
+ border-bottom: 1px solid #DEB85F;
+ margin-bottom: 5px;
+ clear: both;
+}
+
+.todo-content {
+ padding-right: 15px;
+}
\ No newline at end of file
diff --git a/erpnext/utilities/page/todo/todo.html b/erpnext/utilities/page/todo/todo.html
index 32a0a78..8c50218 100644
--- a/erpnext/utilities/page/todo/todo.html
+++ b/erpnext/utilities/page/todo/todo.html
@@ -2,7 +2,15 @@
<a class="close" onclick="window.history.back();">×</a>
<h1>To Do</h1>
<br>
- <div id="todo-list">
+ <div>
+ <div id="todo-list">
+ <h4>My List</h4><br>
+ <div class="todo-content"></div>
+ </div>
+ <div id="assigned-todo-list">
+ <h4>Assigned to others</h4><br>
+ <div class="todo-content"></div>
+ </div>
</div>
<div style="margin-top: 21px; clear: both">
<button id="add-todo" class="btn btn-small"><i class="icon-plus"></i> Add</button>
diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js
index 9a90ce3..bbac46d 100644
--- a/erpnext/utilities/page/todo/todo.js
+++ b/erpnext/utilities/page/todo/todo.js
@@ -20,7 +20,8 @@
wn.call({
method: 'utilities.page.todo.todo.get',
callback: function(r,rt) {
- $('#todo-list').empty();
+ $('#todo-list div.todo-content').empty();
+ $('#assigned-todo-list div.todo-content').empty();
if(r.message) {
for(var i in r.message) {
new erpnext.todo.ToDoItem(r.message[i]);
@@ -46,11 +47,23 @@
}
todo.labelclass = label_map[todo.priority];
todo.userdate = dateutil.str_to_user(todo.date) || '';
+
+ todo.fullname = '';
if(todo.assigned_by) {
todo.fullname = repl("[By %(fullname)s] ", {
fullname: wn.boot.user_info[todo.assigned_by].fullname
- })
- } else { todo.fullname = ''; }
+ });
+ }
+
+ var parent_list = "#todo-list";
+ if(todo.owner !== user) {
+ parent_list = "#assigned-todo-list";
+ todo.fullname = repl("[To %(fullname)s] ", {
+ fullname: wn.boot.user_info[todo.owner].fullname
+ });
+ }
+ parent_list += " div.todo-content";
+
if(todo.reference_name && todo.reference_type) {
todo.link = repl('<a href="#!Form/%(reference_type)s/%(reference_name)s">\
%(reference_type)s: %(reference_name)s</a>', todo);
@@ -61,16 +74,22 @@
todo.link = '';
}
if(!todo.description) todo.description = '';
- $('#todo-list').append(repl('<div class="todoitem">\
+
+ todo.desc = todo.description.replace(/\n/g, "<br>");
+
+ $(parent_list).append(repl('\
+ <div class="todoitem">\
+ <span class="label %(labelclass)s">%(priority)s</span>\
<span class="description">\
- <span class="label %(labelclass)s">%(priority)s</span>\
<span class="help" style="margin-right: 7px">%(userdate)s</span>\
- %(fullname)s%(description)s</span>\
- <span class="ref_link">→ \
+ %(fullname)s%(desc)s\
+ <span class="ref_link"><br>\
%(link)s</span>\
- <a href="#" class="close">×</a>\
- </div>', todo));
- $todo = $('div.todoitem:last');
+ </span>\
+ <span class="close-span"><a href="#" class="close">×</a></span>\
+ </div>\
+ <div class="todo-separator"></div>', todo));
+ $todo = $(parent_list + ' div.todoitem:last');
if(todo.checked) {
$todo.find('.description').css('text-decoration', 'line-through');
diff --git a/erpnext/utilities/page/todo/todo.py b/erpnext/utilities/page/todo/todo.py
index 73bd0b0..1b54478 100644
--- a/erpnext/utilities/page/todo/todo.py
+++ b/erpnext/utilities/page/todo/todo.py
@@ -22,9 +22,9 @@
"""get todo list"""
return webnotes.conn.sql("""select name, owner, description, date,
priority, checked, reference_type, reference_name, assigned_by
- from `tabToDo` where owner=%s
+ from `tabToDo` where (owner=%s or assigned_by=%s)
order by field(priority, 'High', 'Medium', 'Low') asc, date asc""",
- webnotes.session['user'], as_dict=1)
+ (webnotes.session['user'], webnotes.session['user']), as_dict=1)
@webnotes.whitelist()
def edit(arg=None):
@@ -35,7 +35,7 @@
d.date = args['date']
d.priority = args['priority']
d.checked = args.get('checked', 0)
- d.owner = webnotes.session['user']
+ if not d.owner: d.owner = webnotes.session['user']
d.save(not args.get('name') and 1 or 0)
if args.get('name') and d.checked: