From 64ddb9f069041fdcbed2f5d31ad4a658718ec29c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 12 Jun 2012 19:24:12 +0530 Subject: [PATCH] show assigned to others list in todo --- erpnext/utilities/page/todo/todo.css | 39 +++++++++++++++++++-------- erpnext/utilities/page/todo/todo.html | 10 ++++++- erpnext/utilities/page/todo/todo.js | 39 ++++++++++++++++++++------- erpnext/utilities/page/todo/todo.py | 6 ++--- 4 files changed, 69 insertions(+), 25 deletions(-) diff --git a/erpnext/utilities/page/todo/todo.css b/erpnext/utilities/page/todo/todo.css index 704e6007e1..0b00b3988a 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 32a0a785a8..8c50218b77 100644 --- a/erpnext/utilities/page/todo/todo.html +++ b/erpnext/utilities/page/todo/todo.html @@ -2,7 +2,15 @@ ×

To Do


-
+
+
+

My List


+
+
+
+

Assigned to others


+
+
diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js index 9a90ce3655..bbac46db7c 100644 --- a/erpnext/utilities/page/todo/todo.js +++ b/erpnext/utilities/page/todo/todo.js @@ -20,7 +20,8 @@ erpnext.todo.refresh = function() { 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 @@ erpnext.todo.ToDoItem = Class.extend({ } 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('\ %(reference_type)s: %(reference_name)s', todo); @@ -61,16 +74,22 @@ erpnext.todo.ToDoItem = Class.extend({ todo.link = ''; } if(!todo.description) todo.description = ''; - $('#todo-list').append(repl('
\ + + todo.desc = todo.description.replace(/\n/g, "
"); + + $(parent_list).append(repl('\ +
\ + %(priority)s\ \ - %(priority)s\ %(userdate)s\ - %(fullname)s%(description)s\ - →  \ + %(fullname)s%(desc)s\ +
\ %(link)s
\ - ×\ -
', todo)); - $todo = $('div.todoitem:last'); + \ + ×\ +
\ +
', 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 73bd0b0957..1b54478eca 100644 --- a/erpnext/utilities/page/todo/todo.py +++ b/erpnext/utilities/page/todo/todo.py @@ -22,9 +22,9 @@ def get(arg=None): """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 @@ def edit(arg=None): 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: