From fa0e7b69339469ee1caacaea1419c1a6646bb818 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 22 Mar 2012 13:44:04 +0530 Subject: [PATCH 1/4] 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 From c4d77e7e6c5d417d744e4a6fce680c774b5115fa Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 22 Mar 2012 13:52:40 +0530 Subject: [PATCH 2/4] listing ajax indicator fix --- js/all-app.js | 8 ++++---- js/all-web.js | 14 +++++++------- version.num | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/js/all-app.js b/js/all-app.js index 0867923e69..c1b073a7e8 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -263,16 +263,16 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\ \ \
\ -
\ + \ + \
\ \
\ @@ -424,7 +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');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);}}}) +wn.views.Page=Class.extend({init:function(name){this.name=name;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(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](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 46d5354e2c..a1e0424825 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -177,16 +177,16 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ + \ + \
\ \
\ @@ -338,7 +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');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);}}}) +wn.views.Page=Class.extend({init:function(name){this.name=name;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(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}}) /* * lib/js/wn/views/formview.js */ @@ -900,16 +900,16 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ + \ + \
\ \
\ diff --git a/version.num b/version.num index 2796f968cf..c6778f8867 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1352 \ No newline at end of file +1355 \ No newline at end of file From 842f7822530718cb95294a3e38a6056c3d3ba798 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 22 Mar 2012 14:24:49 +0530 Subject: [PATCH 3/4] listing - ajax icon --- css/all-app.css | 4 ++-- js/all-app.js | 9 +++++---- js/all-web.js | 18 ++++++++++-------- version.num | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/css/all-app.css b/css/all-app.css index a7732322a6..790887eacc 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -1568,8 +1568,8 @@ div.psidebar div.section-item, div.psidebar .section-link { .wnlist .img-load { display: none; - margin-left: 11px; - margin-top: 8px; + float: left; + margin-bottom: 8px; } /* list-row */ diff --git a/js/all-app.js b/js/all-app.js index 4e47b160a3..ea41c4fbf7 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -263,7 +263,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ \
\ @@ -292,7 +293,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\ 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();} -this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){this.$w.find('.list-toolbar').addClass('btn-group')} +this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){var w=0;this.$w.find('.list-toolbar a').each(function(i,e){w+=$(this).outerWidth();});this.$w.find('.list-toolbar').css('width',(w+10)+'px');} 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)) diff --git a/js/all-web.js b/js/all-web.js index a1e0424825..34d4b6d3c1 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -177,7 +177,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ \
\ @@ -206,7 +207,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\ 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();} -this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){this.$w.find('.list-toolbar').addClass('btn-group')} +this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){var w=0;this.$w.find('.list-toolbar a').each(function(i,e){w+=$(this).outerWidth();});this.$w.find('.list-toolbar').css('width',(w+10)+'px');} 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)) @@ -900,7 +901,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ \
\ @@ -929,7 +931,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\ 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();} -this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){this.$w.find('.list-toolbar').addClass('btn-group')} +this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){var w=0;this.$w.find('.list-toolbar a').each(function(i,e){w+=$(this).outerWidth();});this.$w.find('.list-toolbar').css('width',(w+10)+'px');} 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)) diff --git a/version.num b/version.num index 4422c3ed26..0bfd2262b7 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1355 +1386 \ No newline at end of file From 9662cb85645a03af883e92b653691ba56f6837bc Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 22 Mar 2012 14:27:05 +0530 Subject: [PATCH 4/4] doclistview --- js/all-app.js | 4 ++-- js/all-web.js | 4 ++-- version.num | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/all-app.js b/js/all-app.js index ea41c4fbf7..a79741b711 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -416,8 +416,8 @@ $(parent).html(repl('\ ',args));} else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('',v);});var tr=$(row).html(''+rowhtml+'
').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];var diff=dateutil.get_diff(dateutil.get_today(),data.modified.split(' ')[0]);if(diff==0){data.when='Today'} -if(diff==-1){data.when='Yesterday'} -if(diff==-2){data.when='2 days ago'} +if(diff==1){data.when='Yesterday'} +if(diff==2){data.when='2 days ago'} if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('' +strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}}) /* diff --git a/js/all-web.js b/js/all-web.js index 34d4b6d3c1..d1b5b18573 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -330,8 +330,8 @@ $(parent).html(repl('\ ',args));} else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('',v);});var tr=$(row).html(''+rowhtml+'
').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];var diff=dateutil.get_diff(dateutil.get_today(),data.modified.split(' ')[0]);if(diff==0){data.when='Today'} -if(diff==-1){data.when='Yesterday'} -if(diff==-2){data.when='2 days ago'} +if(diff==1){data.when='Yesterday'} +if(diff==2){data.when='2 days ago'} if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('' +strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}}) /* diff --git a/version.num b/version.num index 0bfd2262b7..777d295183 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1386 \ No newline at end of file +1387 \ No newline at end of file