show assigned to others list in todo

This commit is contained in:
Anand Doshi 2012-06-12 19:24:12 +05:30
parent 4f4f58293f
commit 64ddb9f069
4 changed files with 69 additions and 25 deletions

View File

@ -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;
}

View File

@ -2,7 +2,15 @@
<a class="close" onclick="window.history.back();">&times;</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>

View File

@ -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('<a href="#!Form/%(reference_type)s/%(reference_name)s">\
%(reference_type)s: %(reference_name)s</a>', todo);
@ -61,16 +74,22 @@ erpnext.todo.ToDoItem = Class.extend({
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">&rarr; &nbsp;\
%(fullname)s%(desc)s\
<span class="ref_link"><br>\
%(link)s</span>\
<a href="#" class="close">&times;</a>\
</div>', todo));
$todo = $('div.todoitem:last');
</span>\
<span class="close-span"><a href="#" class="close">&times;</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');

View File

@ -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: