From fa0e7b69339469ee1caacaea1419c1a6646bb818 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 22 Mar 2012 13:44:04 +0530 Subject: [PATCH] listing/messages fix --- css/all-app.css | 1 - erpnext/utilities/page/messages/messages.css | 4 ++-- erpnext/utilities/page/messages/messages.html | 2 +- erpnext/utilities/page/messages/messages.js | 18 ++++++++++----- js/all-app.js | 14 ++++++------ js/all-web.js | 22 +++++++++---------- version.num | 2 +- 7 files changed, 34 insertions(+), 29 deletions(-) diff --git a/css/all-app.css b/css/all-app.css index cb9940bfdb..a7732322a6 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -1568,7 +1568,6 @@ div.psidebar div.section-item, div.psidebar .section-link { .wnlist .img-load { display: none; - float: left; margin-left: 11px; margin-top: 8px; } diff --git a/erpnext/utilities/page/messages/messages.css b/erpnext/utilities/page/messages/messages.css index 81260ab2d9..49b377170d 100644 --- a/erpnext/utilities/page/messages/messages.css +++ b/erpnext/utilities/page/messages/messages.css @@ -1,9 +1,9 @@ #message-post-text { - height: 3em; + width: 50%; } #message-list { - margin: 0px 40px; + } .message { diff --git a/erpnext/utilities/page/messages/messages.html b/erpnext/utilities/page/messages/messages.html index b645d3f241..7538785faf 100644 --- a/erpnext/utilities/page/messages/messages.html +++ b/erpnext/utilities/page/messages/messages.html @@ -3,7 +3,7 @@ ×

Messages

- +
diff --git a/erpnext/utilities/page/messages/messages.js b/erpnext/utilities/page/messages/messages.js index 4cc7a522db..ef56020291 100644 --- a/erpnext/utilities/page/messages/messages.js +++ b/erpnext/utilities/page/messages/messages.js @@ -43,20 +43,24 @@ wn.pages.messages.onload = function(wrapper) { }); // enable, disable button - $('#message-post-text').keyup(function() { + $('#message-post-text').keyup(function(e) { if($(this).val()) { $('#message-post').attr('disabled', false); } else { $('#message-post').attr('disabled', true); } + + if(e.which==13) { + $('#message-post').click(); + } }) } -wn.pages.messages.onshow = function(wrapper) { +$(wn.pages.messages).bind('show', function() { erpnext.messages.show(); - setTimeout(erpnext.messages.refresh, 5000); + setTimeout(erpnext.messages.refresh, 7000); $('#message-post-text').focus(); -} +}) erpnext.messages = { show: function() { @@ -75,8 +79,8 @@ erpnext.messages = { }, // check for updates every 5 seconds if page is active refresh: function() { - setTimeout(erpnext.messages.refresh, 10000); - if(wn.container.page.label != 'messages') return; + setTimeout(erpnext.messages.refresh, 7000); + if(wn.container.page.label != 'Messages') return; erpnext.messages.show(); }, get_contact: function() { @@ -98,6 +102,8 @@ erpnext.messages = { contact: null }, render_row: function(wrapper, data) { + $(wrapper).removeClass('list-row'); + data.creation = dateutil.comment_when(data.creation); data.comment_by_fullname = wn.user_info(data.owner).fullname; diff --git a/js/all-app.js b/js/all-app.js index 28f0e45013..0867923e69 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -270,9 +270,9 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\ New\ \ Filter\ + \
\ - \
\ \
\ @@ -288,7 +288,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \ \ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();this.make_filters();},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();} if(!me.show_filters){this.$w.find('.btn-filter').remove();} if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();} @@ -296,7 +296,7 @@ this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-tool if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) -this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading,btn:this.run_btn});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} +this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}} if(this.args) $.extend(args,this.args) @@ -341,7 +341,8 @@ return[me.$w.find('.fieldname_select option:selected').attr('table'),me.field.df */ wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('
').appendTo(this.container).get(0);if(onshow) $(page).bind('show',onshow);if(onshow) -$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];} +$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){if(this.page&&this.page.label==label){return;} +var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];} if(!page){console.log('Page not found '+label);return;} if(this.page){$(this.page).toggle(false);$(this.page).trigger('hide');} this.page=page;$(this.page).fadeIn();$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;return this.page;}}) @@ -423,8 +424,7 @@ if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';da */ wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){wn.views.pageview.with_page(name,function(){if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);} wn.container.change_to(name);});}} -wn.views.Page=Class.extend({init:function(name){this.name=name;this.render();},render:function(){var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');});},trigger:function(event){var me=this;try{if(pscript[event+'_'+this.name]){pscript[event+'_'+this.name](me.wrapper);} -if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}}) +wn.views.Page=Class.extend({init:function(name){this.name=name;this.render();},render:function(){var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');console.log(1)});},trigger:function(event){var me=this;try{if(pscript[event+'_'+this.name]){pscript[event+'_'+this.name](me.wrapper);}else if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}}) /* * lib/js/wn/views/formview.js */ diff --git a/js/all-web.js b/js/all-web.js index 19a63e65db..46d5354e2c 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -184,9 +184,9 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\ New\ \ Filter\ + \ \ - \
\ \
\ @@ -202,7 +202,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \ \ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();this.make_filters();},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();} if(!me.show_filters){this.$w.find('.btn-filter').remove();} if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();} @@ -210,7 +210,7 @@ this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-tool if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) -this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading,btn:this.run_btn});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} +this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}} if(this.args) $.extend(args,this.args) @@ -255,7 +255,8 @@ return[me.$w.find('.fieldname_select option:selected').attr('table'),me.field.df */ wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('
').appendTo(this.container).get(0);if(onshow) $(page).bind('show',onshow);if(onshow) -$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];} +$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){if(this.page&&this.page.label==label){return;} +var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];} if(!page){console.log('Page not found '+label);return;} if(this.page){$(this.page).toggle(false);$(this.page).trigger('hide');} this.page=page;$(this.page).fadeIn();$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;return this.page;}}) @@ -337,8 +338,7 @@ if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';da */ wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){wn.views.pageview.with_page(name,function(){if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);} wn.container.change_to(name);});}} -wn.views.Page=Class.extend({init:function(name){this.name=name;this.render();},render:function(){var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');});},trigger:function(event){var me=this;try{if(pscript[event+'_'+this.name]){pscript[event+'_'+this.name](me.wrapper);} -if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}}) +wn.views.Page=Class.extend({init:function(name){this.name=name;this.render();},render:function(){var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');console.log(1)});},trigger:function(event){var me=this;try{if(pscript[event+'_'+this.name]){pscript[event+'_'+this.name](me.wrapper);}else if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}}) /* * lib/js/wn/views/formview.js */ @@ -907,9 +907,9 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\ New\ \ Filter\ + \ \ - \
\ \
\ @@ -925,7 +925,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \ \ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();this.make_filters();},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();} if(!me.show_filters){this.$w.find('.btn-filter').remove();} if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();} @@ -933,7 +933,7 @@ this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-tool if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) -this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading,btn:this.run_btn});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} +this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}} if(this.args) $.extend(args,this.args) diff --git a/version.num b/version.num index 438ea09fbb..2796f968cf 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1341 \ No newline at end of file +1352 \ No newline at end of file