moved to bootstrap 2.1 and some ui fixes in todo and messages

This commit is contained in:
Rushabh Mehta 2012-10-03 11:56:38 +05:30
parent 079df382f9
commit 3009c46ba5
12 changed files with 52 additions and 64 deletions

View File

@ -1290,7 +1290,7 @@ d.set_search=function(dt){if(d.style!='Search'){d.rows['Result'].innerHTML='';d.
d.style='Search';if(d.input){d.input=null;sel_type=null;} d.style='Search';if(d.input){d.input=null;sel_type=null;}
d.sel_type=get_label_doctype(dt);d.set_title('Quick Search for '+dt);} d.sel_type=get_label_doctype(dt);d.set_title('Quick Search for '+dt);}
$(inp).keydown(function(e){if(e.which==13){if(!btn.disabled)btn.onclick();}}) $(inp).keydown(function(e){if(e.which==13){if(!btn.disabled)btn.onclick();}})
d.set_query_description=function(txt){txt=d.input&&d.input.query_description||txt;if(txt){d.rows['Help'].innerHTML='<div class="help-box" style="margin-top:0px">'+txt+'</div>';}else{d.rows['Help'].innerHTML=''}} d.set_query_description=function(txt){txt=d.input&&d.input.query_description||txt;if(txt){d.rows['Help'].innerHTML='<div class="alert" style="margin-top:0px">'+txt+'</div>';}else{d.rows['Help'].innerHTML=''}}
d.onshow=function(){if(d.set_doctype!=d.sel_type){d.rows['Result'].innerHTML='';d.values_len=0;} d.onshow=function(){if(d.set_doctype!=d.sel_type){d.rows['Result'].innerHTML='';d.values_len=0;}
inp.value='';if(d.input&&d.input.txt.value){inp.value=d.input.txt.value;} inp.value='';if(d.input&&d.input.txt.value){inp.value=d.input.txt.value;}
try{inp.focus();}catch(e){} try{inp.focus();}catch(e){}
@ -1808,9 +1808,9 @@ this.setup_print();}
_f.Frm.prototype.setup_sidebar=function(){this.sidebar=new wn.widgets.form.sidebar.Sidebar(this);} _f.Frm.prototype.setup_sidebar=function(){this.sidebar=new wn.widgets.form.sidebar.Sidebar(this);}
_f.Frm.prototype.setup_footer=function(){var me=this;var f=this.page_layout.footer;f.save_area=$a(this.page_layout.footer,'div','',{display:'none',marginTop:'11px'});f.help_area=$a(this.page_layout.footer,'div');var b=$btn(f.save_area,'Save',function(){cur_frm.save('Save');},{marginLeft:'0px'},'green');f.show_save=function(){$ds(me.page_layout.footer.save_area);} _f.Frm.prototype.setup_footer=function(){var me=this;var f=this.page_layout.footer;f.save_area=$a(this.page_layout.footer,'div','',{display:'none',marginTop:'11px'});f.help_area=$a(this.page_layout.footer,'div');var b=$btn(f.save_area,'Save',function(){cur_frm.save('Save');},{marginLeft:'0px'},'green');f.show_save=function(){$ds(me.page_layout.footer.save_area);}
f.hide_save=function(){$dh(me.page_layout.footer.save_area);}} f.hide_save=function(){$dh(me.page_layout.footer.save_area);}}
_f.Frm.prototype.set_intro=function(txt){if(!this.intro_area){this.intro_area=$('<div class="help-box form-intro-area">').insertBefore(this.page_layout.body.firstChild);} _f.Frm.prototype.set_intro=function(txt){if(!this.intro_area){this.intro_area=$('<div class="alert form-intro-area">').insertBefore(this.page_layout.body.firstChild);}
if(txt){if(txt.search(/<p>/)==-1)txt='<p>'+txt+'</p>';this.intro_area.html(txt);}else{this.intro_area.remove();this.intro_area=null;}} if(txt){if(txt.search(/<p>/)==-1)txt='<p>'+txt+'</p>';this.intro_area.html(txt);}else{this.intro_area.remove();this.intro_area=null;}}
_f.Frm.prototype.set_footnote=function(txt){if(!this.footnote_area){this.footnote_area=$('<div class="help-box form-intro-area">').insertAfter(this.page_layout.body.lastChild);} _f.Frm.prototype.set_footnote=function(txt){if(!this.footnote_area){this.footnote_area=$('<div class="alert form-intro-area">').insertAfter(this.page_layout.body.lastChild);}
if(txt){if(txt.search(/<p>/)==-1)txt='<p>'+txt+'</p>';this.footnote_area.html(txt);}else{this.footnote_area.remove();this.footnote_area=null;}} if(txt){if(txt.search(/<p>/)==-1)txt='<p>'+txt+'</p>';this.footnote_area.html(txt);}else{this.footnote_area.remove();this.footnote_area=null;}}
_f.Frm.prototype.setup_fields_std=function(){var fl=wn.meta.docfield_list[this.doctype];fl.sort(function(a,b){return a.idx-b.idx});if(fl[0]&&fl[0].fieldtype!="Section Break"||get_url_arg('embed')){this.layout.addrow();if(fl[0].fieldtype!="Column Break"){var c=this.layout.addcell();$y(c.wrapper,{padding:'8px'});}} _f.Frm.prototype.setup_fields_std=function(){var fl=wn.meta.docfield_list[this.doctype];fl.sort(function(a,b){return a.idx-b.idx});if(fl[0]&&fl[0].fieldtype!="Section Break"||get_url_arg('embed')){this.layout.addrow();if(fl[0].fieldtype!="Column Break"){var c=this.layout.addcell();$y(c.wrapper,{padding:'8px'});}}
var sec;for(var i=0;i<fl.length;i++){var f=fl[i];if(f.fieldtype=='Section Break'&&fl[i+1]&&fl[i+1].fieldtype=='Section Break') var sec;for(var i=0;i<fl.length;i++){var f=fl[i];if(f.fieldtype=='Section Break'&&fl[i+1]&&fl[i+1].fieldtype=='Section Break')

View File

@ -21,7 +21,7 @@ wn.require('lib/js/lib/jQuery.Gantt/js/jquery.fn.gantt.min.js');
erpnext.show_task_gantt = function(parent, project) { erpnext.show_task_gantt = function(parent, project) {
$(parent).css('min-height', '300px').html('<div class="help-box">Loading...</div>') $(parent).css('min-height', '300px').html('<div class="alert">Loading...</div>')
var get_source = function(r) { var get_source = function(r) {
var source = []; var source = [];
@ -56,7 +56,7 @@ erpnext.show_task_gantt = function(parent, project) {
callback: function(r) { callback: function(r) {
$(parent).empty(); $(parent).empty();
if(!r.message.length) { if(!r.message.length) {
$(parent).html('<div class="help-box">No Tasks Yet.</div>'); $(parent).html('<div class="alert">No Tasks Yet.</div>');
} else { } else {
var gantt_area = $('<div class="gantt">').appendTo(parent); var gantt_area = $('<div class="gantt">').appendTo(parent);
gantt_area.gantt({ gantt_area.gantt({

View File

@ -139,7 +139,7 @@ var set_sales_bom_help = function(doc) {
$(cur_frm.fields_dict.packing_list.row.wrapper).toggle(true); $(cur_frm.fields_dict.packing_list.row.wrapper).toggle(true);
if (inList(['Delivery Note', 'Sales Invoice'], doc.doctype)) { if (inList(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
help_msg = "<div class='help-box'> \ help_msg = "<div class='alert'> \
For 'Sales BOM' items, warehouse, serial no and batch no \ For 'Sales BOM' items, warehouse, serial no and batch no \
will be considered from the 'Packing List' table. \ will be considered from the 'Packing List' table. \
If warehouse and batch no are same for all packing items for any 'Sales BOM' item, \ If warehouse and batch no are same for all packing items for any 'Sales BOM' item, \

View File

@ -1,7 +1,5 @@
// render // render
wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
me: this,
init: function(d) { init: function(d) {
this._super(d) this._super(d)
this.fields = this.fields.concat([ this.fields = this.fields.concat([
@ -13,22 +11,22 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
this.show_hide_check_column(); this.show_hide_check_column();
}, },
label_style: {
"status": {
"Open": "danger",
"Closed": "success",
"Hold": "info",
"Waiting for Customer": "info"
}
},
prepare_data: function(data) { prepare_data: function(data) {
this._super(data); this._super(data);
if(data.status=='Open' || data.status=='To Reply') {
data.label_type = 'important' data.label_style = this.label_style.status[data.status];
}
else if(data.status=='Closed') { data.status_html = repl('<span class="label \
data.label_type = 'success' label-%(label_style)s">%(status)s</span>', data);
}
else if(data.status=='Hold') {
data.label_type = 'info'
}
else if(data.status=='Waiting for Customer') {
data.label_type = 'info'
data.status = 'Waiting'
}
data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
// escape double quotes // escape double quotes
data.description = cstr(data.subject) data.description = cstr(data.subject)

View File

@ -24,7 +24,7 @@ wn.pages.messages.onload = function(wrapper) {
$('<h3 id="message-title">Everyone</h3>\ $('<h3 id="message-title">Everyone</h3>\
<div id="show-everyone" style="display: none;">\ <div id="show-everyone" style="display: none;">\
<a href="#messages" style="font-size: 80%;">\ <a href="#messages/'+user+'" style="font-size: 80%;">\
Show messages from everyone</a></div><hr>\ Show messages from everyone</a></div><hr>\
<div id="post-message" style="display: none">\ <div id="post-message" style="display: none">\
<textarea style="width: 100%; height: 24px;"></textarea>\ <textarea style="width: 100%; height: 24px;"></textarea>\
@ -36,6 +36,9 @@ wn.pages.messages.onload = function(wrapper) {
} }
$(wn.pages.messages).bind('show', function() { $(wn.pages.messages).bind('show', function() {
// remove alerts
$('#alert-container .alert').remove();
erpnext.messages.show(); erpnext.messages.show();
setTimeout("erpnext.messages.refresh()", 7000); setTimeout("erpnext.messages.refresh()", 7000);
}) })
@ -78,7 +81,7 @@ erpnext.Messages = Class.extend({
}); });
}, },
show: function() { show: function() {
var contact = this.get_contact(); var contact = this.get_contact() || this.contact || user;
$('#message-title').text(contact==user ? "Everyone" : $('#message-title').text(contact==user ? "Everyone" :
wn.boot.user_info[contact].fullname) wn.boot.user_info[contact].fullname)
@ -108,7 +111,6 @@ erpnext.Messages = Class.extend({
} }
return name; return name;
} }
return user;
}, },
make_list: function() { make_list: function() {
this.list = new wn.ui.Listing({ this.list = new wn.ui.Listing({

View File

@ -1,6 +1,5 @@
.todoitem { .todoitem {
padding-bottom: 3px; padding-bottom: 3px;
min-height: 45px;
clear: both; clear: both;
} }
@ -25,13 +24,10 @@
.todoitem .description { .todoitem .description {
padding: 3px 0px; padding: 3px 0px;
display: inline-block;
width: 80%;
} }
#todo-list, #assigned-todo-list { #todo-list {
float: left;
width: 50%;
} }
.todo-separator { .todo-separator {
@ -47,4 +43,8 @@
.todo-layout { .todo-layout {
background-color: #FFFDC9; background-color: #FFFDC9;
min-height: 300px; min-height: 300px;
}
.popup-on-click {
margin: 0px 6px;
} }

View File

@ -3,11 +3,6 @@
<div class="layout-main todo-layout"> <div class="layout-main todo-layout">
<div> <div>
<div id="todo-list"> <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 class="todo-content"></div>
</div> </div>
</div> </div>

View File

@ -27,24 +27,17 @@ erpnext.todo.refresh = function() {
var nothing_to_do = function() { var nothing_to_do = function() {
$('#todo-list div.todo-content') $('#todo-list div.todo-content')
.html('<div class="help-box">Nothing to do :)</div>'); .html('<div class="alert">Nothing to do :)</div>');
} }
var nothing_delegated = function() {
$('#assigned-todo-list div.todo-content')
.html('<div class="help-box">Nothing assigned to other users. \
Use "Assign To" in a form to delegate work.</div>');
}
if(r.message) { if(r.message) {
for(var i in r.message) { for(var i in r.message) {
new erpnext.todo.ToDoItem(r.message[i]); new erpnext.todo.ToDoItem(r.message[i]);
} }
if (!todo_list.html()) { nothing_to_do(); } if (!todo_list.html()) { nothing_to_do(); }
if (!assigned_todo_list.html()) { nothing_delegated(); }
} else { } else {
nothing_to_do(); nothing_to_do();
nothing_delegated();
} }
} }
}); });
@ -70,7 +63,6 @@ erpnext.todo.ToDoItem = Class.extend({
var parent_list = "#todo-list"; var parent_list = "#todo-list";
if(todo.owner !== user) { if(todo.owner !== user) {
parent_list = "#assigned-todo-list";
var owner = wn.boot.user_info[todo.owner]; var owner = wn.boot.user_info[todo.owner];
todo.fullname = repl("[To %(fullname)s] &nbsp;", { todo.fullname = repl("[To %(fullname)s] &nbsp;", {
fullname: (owner ? owner.fullname : todo.owner), fullname: (owner ? owner.fullname : todo.owner),
@ -79,7 +71,7 @@ erpnext.todo.ToDoItem = Class.extend({
parent_list += " div.todo-content"; parent_list += " div.todo-content";
if(todo.reference_name && todo.reference_type) { if(todo.reference_name && todo.reference_type) {
todo.link = repl('<br><a href="#!Form/%(reference_type)s/%(reference_name)s">\ todo.link = repl('<a href="#!Form/%(reference_type)s/%(reference_name)s">\
%(reference_type)s: %(reference_name)s</a>', todo); %(reference_type)s: %(reference_name)s</a>', todo);
} else if(todo.reference_type) { } else if(todo.reference_type) {
todo.link = repl('<br><a href="#!List/%(reference_type)s">\ todo.link = repl('<br><a href="#!List/%(reference_type)s">\
@ -88,16 +80,14 @@ erpnext.todo.ToDoItem = Class.extend({
todo.link = ''; todo.link = '';
} }
if(!todo.description) todo.description = ''; if(!todo.description) todo.description = '';
todo.desc = wn.markdown(todo.description);
$(parent_list).append(repl('\ $(parent_list).append(repl('\
<div class="todoitem">\ <div class="todoitem">\
<span class="label %(labelclass)s">%(priority)s</span>\ <span class="label %(labelclass)s">%(priority)s</span>\
<span class="popup-on-click"><a href="#">[edit]</a></span>\
<span class="description">\ <span class="description">\
<span class="help" style="margin-right: 7px">%(userdate)s</span>\ <span class="help" style="margin-right: 7px">%(userdate)s</span>\
%(fullname)s%(desc)s\ %(fullname)s: %(description)s\
<span class="popup-on-click"><a href="#"> [edit]</a></span>\
<span class="ref_link">%(link)s</span>\ <span class="ref_link">%(link)s</span>\
</span>\ </span>\
<span class="close-span"><a href="#" class="close">&times;</a></span>\ <span class="close-span"><a href="#" class="close">&times;</a></span>\
@ -142,8 +132,7 @@ erpnext.todo.make_dialog = function(det) {
title: 'To Do', title: 'To Do',
fields: [ fields: [
{fieldtype:'Text', fieldname:'description', label:'Description', {fieldtype:'Text', fieldname:'description', label:'Description',
reqd:1, description:'Use <a href="#markdown-reference">markdown</a> to \ reqd:1},
format content'},
{fieldtype:'Date', fieldname:'date', label:'Event Date', reqd:1}, {fieldtype:'Date', fieldname:'date', label:'Event Date', reqd:1},
{fieldtype:'Check', fieldname:'checked', label:'Completed'}, {fieldtype:'Check', fieldname:'checked', label:'Completed'},
{fieldtype:'Select', fieldname:'priority', label:'Priority', reqd:1, 'options':['Medium','High','Low'].join('\n')}, {fieldtype:'Select', fieldname:'priority', label:'Priority', reqd:1, 'options':['Medium','High','Low'].join('\n')},

View File

@ -7,4 +7,8 @@
.login-banner { .login-banner {
margin-bottom: 20px; margin-bottom: 20px;
} }
.login-box td {
padding: 8px;
}
</style> </style>

View File

@ -7,7 +7,7 @@
{% block body %} {% block body %}
<header> <header>
<div class="navbar navbar-fixed-top"> <div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
<a class="brand" href="index.html">{{ brand }}</a> <a class="brand" href="index.html">{{ brand }}</a>

View File

@ -51,8 +51,8 @@ erpnext.login.doLogin = function(){
var args = {}; var args = {};
args['usr']=$i("login_id").value; args['usr']=$i("login_id").value;
args['pwd']=$i("password").value; args['pwd']=$i("password").value;
if($i('remember_me').checked) //if($i('remember_me').checked)
args['remember_me'] = 1; //args['remember_me'] = 1;
$('#login_btn').set_working(); $('#login_btn').set_working();
$('#login_message').empty(); $('#login_message').empty();

View File

@ -21,7 +21,7 @@
</div> </div>
<div class="layout-main" style="padding: 15px;"> <div class="layout-main" style="padding: 15px;">
<form autocomplete="on"> <form autocomplete="on">
<table border="0" cellspacing="8"> <table border="0" class="login-box">
<tbody> <tbody>
<tr> <tr>
<td>Login Id</td> <td>Login Id</td>
@ -31,21 +31,21 @@
<td>Password</td> <td>Password</td>
<td><input id="password" type="password" style="width: 180px" /></td> <td><input id="password" type="password" style="width: 180px" /></td>
</tr> </tr>
<tr> <!--<tr>
<td style="text-align:right"><input id="remember_me" type="checkbox" /></td> <td style="text-align:right"><input id="remember_me" type="checkbox" /></td>
<td>Remember Me</td> <td>Remember Me</td>
</tr> </tr>-->
<tr>
<td>&nbsp;</td>
<td id="login_message">&nbsp;</td>
</tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<button type="submit" id="login_btn" class="btn btn-small btn-primary">Login</button> <button type="submit" id="login_btn" class="btn btn-small btn-primary">Login</button>
</td> </td>
</tr> </tr>
</tbody> <tr>
<td>&nbsp;</td>
<td id="login_message">&nbsp;</td>
</tr>
</tbody>
</table> </table>
</form> </form>
<p style="margin-left: 72px;"><span class="link_type" <p style="margin-left: 72px;"><span class="link_type"