cleanup of form, rename, route, added fonts
This commit is contained in:
parent
f198765668
commit
e9a3daf572
24 changed files with 157 additions and 130 deletions
|
|
@ -1,4 +1,5 @@
|
|||
.close {
|
||||
font-family: Helvetica, Sans;
|
||||
float: right;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
|
|
|
|||
BIN
css/fonts/droidsans.woff
Normal file
BIN
css/fonts/droidsans.woff
Normal file
Binary file not shown.
BIN
css/fonts/pontanosans.woff
Normal file
BIN
css/fonts/pontanosans.woff
Normal file
Binary file not shown.
|
|
@ -213,6 +213,7 @@ div.std-footer-item {
|
|||
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
background-color: #fff;
|
||||
padding: 15px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.layout-wrapper-background {
|
||||
|
|
@ -225,7 +226,7 @@ div.std-footer-item {
|
|||
float: left;
|
||||
padding: 15px;
|
||||
background-color: #FFF;
|
||||
min-height: 450px;
|
||||
min-height: 600px;
|
||||
-moz-box-shadow: 7px 0px 6px -2px #ddd;
|
||||
-webkit-box-shadow: 7px 0px 6px -2px #ddd;
|
||||
box-shadow: 7px 0px 6px -2px #ddd;
|
||||
|
|
@ -237,7 +238,7 @@ div.std-footer-item {
|
|||
color: #606060;
|
||||
overflow-x: hidden;
|
||||
padding: 15px;
|
||||
min-height: 450px;
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
/* from bootstrap */
|
||||
|
|
|
|||
|
|
@ -14,9 +14,8 @@ div.psidebar div.section {
|
|||
}
|
||||
|
||||
div.psidebar div.section-head {
|
||||
font-size: 12px;
|
||||
padding: 5px 11px;
|
||||
border-bottom: 2px solid #444;
|
||||
border-bottom: 2px solid #777;
|
||||
}
|
||||
|
||||
div.psidebar div.section-body {
|
||||
|
|
|
|||
13
css/ui/fonts.css
Normal file
13
css/ui/fonts.css
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
@font-face {
|
||||
font-family: 'Pontano Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url('../lib/css/fonts/pontanosans.woff') format('woff');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Droid Sans';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local('Droid Sans'), local('DroidSans'), url('../lib/css/fonts/droidsans.woff') format('woff');
|
||||
}
|
||||
9
js/core.min.js
vendored
9
js/core.min.js
vendored
|
|
@ -48,7 +48,7 @@ wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==
|
|||
/*
|
||||
* lib/js/wn/model.js
|
||||
*/
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{if(name&&name.indexOf('New '+doctype)!=-1){name=LocalDB.create(doctype);callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{if(name&&name.indexOf('New '+doctype)!=-1){name=LocalDB.create(doctype);callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
/*
|
||||
* lib/js/wn/misc/user.js
|
||||
*/
|
||||
|
|
@ -95,7 +95,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit
|
|||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.set_route=function(route){window.location.hash=route;}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;}
|
||||
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
|
||||
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
|
||||
/*
|
||||
|
|
@ -144,7 +144,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
|
|||
</div>\
|
||||
</div>\
|
||||
',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);}
|
||||
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype,me.new_doc_onload,true,me.new_doc_onsave);})}else{this.$w.find('.btn-new').remove();}
|
||||
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')}
|
||||
|
|
@ -270,7 +270,8 @@ if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}
|
|||
/*
|
||||
* lib/js/wn/views/formview.js
|
||||
*/
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){if(wn.model.new_names[dn])
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})}}
|
||||
/*
|
||||
* lib/js/wn/views/reportview.js
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ function startup() {
|
|||
// open an existing page or record
|
||||
var t = to_open();
|
||||
if(t) {
|
||||
wn.set_route(t);
|
||||
window.location.hash = t;
|
||||
} else if(home_page) {
|
||||
loadpage(home_page);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,12 +86,6 @@ function save_doclist(dt, dn, save_action, onsave, onerr) {
|
|||
}
|
||||
}
|
||||
|
||||
var f = frms[dt];
|
||||
if(f && !all_clear) { // has errors
|
||||
if(f)f.savingflag = false;
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
var _save = function() {
|
||||
//console.log(compress_doclist(doclist));
|
||||
$c('webnotes.widgets.form.save.savedocs', {'docs':compress_doclist(doclist), 'docname':dn, 'action': save_action, 'user':user },
|
||||
|
|
|
|||
|
|
@ -107,8 +107,11 @@ LocalDB.sync = function(list) {
|
|||
fields[d.parent][d.label] = d;
|
||||
}
|
||||
}
|
||||
if(d.localname)
|
||||
notify_rename_observers(d.doctype, d.localname, d.name);
|
||||
if(d.localname) {
|
||||
wn.model.new_names[d.localname] = d.name;
|
||||
$(document).trigger('rename', [d.doctype, d.localname, d.name]);
|
||||
delete locals[d.doctype][d.localname];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,17 +148,6 @@ LocalDB.set_default_values = function(doc) {
|
|||
}
|
||||
return fields_to_refresh;
|
||||
}
|
||||
// ======================================================================================
|
||||
|
||||
LocalDB.is_doc_loaded = function(dt, dn) {
|
||||
var exists = false;
|
||||
if(locals[dt] && locals[dt][dn]) exists = true;
|
||||
if(exists && dt=='DocType' // if it is a doctype
|
||||
&& !locals[dt][dn].__islocal // and not copied
|
||||
&& !frms[dt]) // and not loaded
|
||||
exists = false; // reload
|
||||
return exists;
|
||||
}
|
||||
|
||||
// ======================================================================================
|
||||
|
||||
|
|
@ -315,25 +307,6 @@ function make_doclist(dt, dn, deleted) {
|
|||
return dl;
|
||||
}
|
||||
|
||||
// Renaming notification list
|
||||
// ======================================================================================
|
||||
|
||||
var rename_observers = [];
|
||||
function notify_rename_observers(dt, old_name, new_name) {
|
||||
// delete from local
|
||||
try {
|
||||
delete locals[dt][old_name];
|
||||
} catch(e) {
|
||||
alert("[rename_from_local] No Document for: "+ old_name);
|
||||
}
|
||||
|
||||
// everyone who observers
|
||||
for(var i=0; i<rename_observers.length;i++) {
|
||||
if(rename_observers[i])
|
||||
rename_observers[i].rename_notify(dt, old_name, new_name);
|
||||
}
|
||||
}
|
||||
|
||||
// Meta Data
|
||||
// ======================================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -22,20 +22,33 @@
|
|||
|
||||
function loadreport(dt, rep_name, onload) {
|
||||
if(rep_name)
|
||||
wn.set_route('Report/' + encodeURIComponent(dt) + '/' + encodeURIComponent(rep_name));
|
||||
wn.set_route('Report', dt, rep_name);
|
||||
else
|
||||
wn.set_route('Report/' + encodeURIComponent(dt));
|
||||
wn.set_route('Report', dt);
|
||||
}
|
||||
|
||||
function loaddoc(doctype, name, onload) {
|
||||
doctype = get_label_doctype(doctype);
|
||||
wn.set_route(['Form', encodeURIComponent(doctype), encodeURIComponent(name)].join('/'));
|
||||
wn.model.with_doctype(doctype, function() {
|
||||
if(locals.DocType[doctype].in_dialog) {
|
||||
console.log(1)
|
||||
_f.edit_record(doctype, name);
|
||||
} else {
|
||||
wn.set_route('Form', doctype, name);
|
||||
}
|
||||
})
|
||||
}
|
||||
var load_doc = loaddoc;
|
||||
|
||||
function new_doc(doctype, onload, in_dialog, on_save_callback, cdt, cdn, cnic) {
|
||||
doctype = get_label_doctype(doctype);
|
||||
wn.set_route(['Form', encodeURIComponent(doctype), encodeURIComponent('New ' + doctype)].join('/'));
|
||||
wn.model.with_doctype(doctype, function() {
|
||||
if(locals.DocType[doctype].in_dialog) {
|
||||
_f.edit_record(doctype, 'New ' + doctype);
|
||||
} else {
|
||||
wn.set_route('Form', doctype, 'New ' + doctype);
|
||||
}
|
||||
})
|
||||
}
|
||||
var newdoc = new_doc;
|
||||
|
||||
|
|
@ -44,6 +57,6 @@ function loadpage(page_name, call_back, no_history) {
|
|||
wn.set_route(page_name);
|
||||
}
|
||||
|
||||
function loaddocbrowser(dt, label, fields) {
|
||||
wn.set_route('List/' + encodeURICompontent(dt));
|
||||
function loaddocbrowser(dt) {
|
||||
wn.set_route('List', dt);
|
||||
}
|
||||
|
|
@ -42,37 +42,6 @@
|
|||
wn.provide('_f');
|
||||
|
||||
_f.frms = {};
|
||||
// called from table edit
|
||||
_f.edit_record = function(dt, dn) {
|
||||
if(!_f.frm_dialog) {
|
||||
// make by twin
|
||||
_f.frm_dialog = new _f.FrmDialog();
|
||||
}
|
||||
var d = _f.frm_dialog;
|
||||
|
||||
wn.model.with_doctype(dt, function() {
|
||||
wn.model.with_doc(dt, dn, function(dn) {
|
||||
// load
|
||||
if(!_f.frms[dt]) {
|
||||
_f.frms[dt] = new _f.Frm(dt, d.body);
|
||||
}
|
||||
var f = _f.frms[dt];
|
||||
if(f.meta.istable) {
|
||||
f.parent_doctype = cur_frm.doctype;
|
||||
f.parent_docname = cur_frm.docname;
|
||||
}
|
||||
|
||||
d.cur_frm = f;
|
||||
d.dn = dn;
|
||||
d.table_form = f.meta.istable;
|
||||
|
||||
// show the form
|
||||
f.refresh(dn);
|
||||
|
||||
d.dialog.show();
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
_f.Frm = function(doctype, parent) {
|
||||
this.docname = '';
|
||||
|
|
@ -93,7 +62,11 @@ _f.Frm = function(doctype, parent) {
|
|||
this.setup_meta(doctype);
|
||||
|
||||
// notify on rename
|
||||
rename_observers.push(this);
|
||||
var me = this;
|
||||
$(document).bind('rename', function(event, dt, old_name, new_name) {
|
||||
if(dt==me.doctype)
|
||||
me.rename_notify(dt, old_name, new_name)
|
||||
});
|
||||
}
|
||||
|
||||
// ======================================================================================
|
||||
|
|
@ -142,7 +115,10 @@ _f.Frm.prototype.setup = function() {
|
|||
_f.Frm.prototype.setup_print_layout = function() {
|
||||
this.print_wrapper = $a(this.wrapper, 'div');
|
||||
this.print_head = $a(this.print_wrapper, 'div');
|
||||
this.print_body = $a(this.print_wrapper,'div', 'layout_wrapper', {padding:'23px'});
|
||||
this.print_body = $a(this.print_wrapper,'div', 'layout_wrapper', {
|
||||
padding:'23px',
|
||||
minHeight: '800px'
|
||||
});
|
||||
|
||||
var t= make_table(this.print_head, 1 ,2, '100%', [], {padding: '6px'});
|
||||
this.view_btn_wrapper = $a($td(t,0,0) , 'span', 'green_buttons');
|
||||
|
|
@ -163,8 +139,8 @@ _f.Frm.prototype.onhide = function() { if(_f.cur_grid_cell) _f.cur_grid_cell.gri
|
|||
_f.Frm.prototype.setup_std_layout = function() {
|
||||
this.page_layout = new wn.PageLayout({
|
||||
parent: this.wrapper,
|
||||
main_width: this.in_dialog ? '100%' : '75%',
|
||||
sidebar_width: this.in_dialog ? '0%' : '25%'
|
||||
main_width: this.meta.in_dialog ? '100%' : '75%',
|
||||
sidebar_width: this.meta.in_dialog ? '0%' : '25%'
|
||||
})
|
||||
|
||||
// only tray
|
||||
|
|
@ -174,7 +150,7 @@ _f.Frm.prototype.setup_std_layout = function() {
|
|||
this.layout = new Layout(this.page_layout.body, '100%');
|
||||
|
||||
// sidebar
|
||||
if(this.in_dialog) {
|
||||
if(this.meta.in_dialog) {
|
||||
// hide sidebar
|
||||
$(this.page_layout.wrapper).removeClass('layout-wrapper-background');
|
||||
$(this.page_layout.main).removeClass('layout-main-section');
|
||||
|
|
@ -262,9 +238,7 @@ _f.Frm.prototype.email_doc = function() {
|
|||
|
||||
// ======================================================================================
|
||||
|
||||
_f.Frm.prototype.rename_notify = function(dt, old, name) {
|
||||
if(this.doctype != dt) return;
|
||||
|
||||
_f.Frm.prototype.rename_notify = function(dt, old, name) {
|
||||
// editable
|
||||
this.is_editable[name] = this.is_editable[old];
|
||||
delete this.is_editable[old];
|
||||
|
|
@ -280,10 +254,11 @@ _f.Frm.prototype.rename_notify = function(dt, old, name) {
|
|||
local_dt[dt][name] = local_dt[dt][old];
|
||||
local_dt[dt][old] = null;
|
||||
}
|
||||
|
||||
this.opendocs[old] = false;
|
||||
|
||||
delete this.opendocs[old];
|
||||
this.opendocs[name] = true;
|
||||
}
|
||||
|
||||
// refresh the heading labels
|
||||
// ======================================================================================
|
||||
|
||||
|
|
@ -587,7 +562,7 @@ _f.Frm.prototype.refresh = function(docname) {
|
|||
// trigger global trigger
|
||||
// to use this
|
||||
// $(docuemnt).bind('form_refresh', function() { })
|
||||
$(document).trigger('form_refresh')
|
||||
$(document).trigger('form_refresh');
|
||||
|
||||
// fields
|
||||
this.refresh_fields();
|
||||
|
|
@ -602,8 +577,12 @@ _f.Frm.prototype.refresh = function(docname) {
|
|||
if(this.layout) this.layout.show();
|
||||
|
||||
// call onload post render for callbacks to be fired
|
||||
if(cur_frm.cscript.is_onload)
|
||||
this.runclientscript('onload_post_render', this.doctype, this.docname);
|
||||
if(cur_frm.cscript.is_onload) {
|
||||
this.runclientscript('onload_post_render', this.doctype, this.docname);
|
||||
}
|
||||
|
||||
// focus on first input
|
||||
$(this.wrapper).find('.form-layout-row :input:first').focus();
|
||||
|
||||
} else {
|
||||
// show print layout
|
||||
|
|
@ -837,6 +816,7 @@ _f.Frm.prototype.save = function(save_action, call_back) {
|
|||
|
||||
|
||||
var ret_fn = function(r) {
|
||||
me.savingflag = false;
|
||||
if(user=='Guest' && !r.exc) {
|
||||
// if user is guest, show a message after succesful saving
|
||||
$dh(me.page_layout.wrapper);
|
||||
|
|
@ -853,7 +833,6 @@ _f.Frm.prototype.save = function(save_action, call_back) {
|
|||
}
|
||||
|
||||
if(call_back){
|
||||
if(call_back == 'home'){ loadpage('_home'); return; }
|
||||
call_back(r);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ CommentList.prototype.add_comment = function() {
|
|||
// --------------------
|
||||
CommentList.prototype.make_lst = function() {
|
||||
if(!this.lst) {
|
||||
wn.require('lib/js/legacy/widgets/listing.js');
|
||||
var l = new Listing('Comments', 1);
|
||||
var me = this;
|
||||
// define the columns etc
|
||||
|
|
|
|||
|
|
@ -85,6 +85,43 @@ _f.FrmDialog = function() {
|
|||
if(wn.container.page.frm) {
|
||||
cur_frm = wn.container.page.frm;
|
||||
}
|
||||
|
||||
// call onhide
|
||||
if(me.cur_frm.cscript.hide_dialog) {
|
||||
me.cur_frm.cscript.hide_dialog();
|
||||
}
|
||||
}
|
||||
this.dialog = d;
|
||||
}
|
||||
|
||||
// called from table edit
|
||||
_f.edit_record = function(dt, dn) {
|
||||
if(!_f.frm_dialog) {
|
||||
// make by twin
|
||||
_f.frm_dialog = new _f.FrmDialog();
|
||||
}
|
||||
var d = _f.frm_dialog;
|
||||
|
||||
wn.model.with_doctype(dt, function() {
|
||||
wn.model.with_doc(dt, dn, function(dn) {
|
||||
// load
|
||||
if(!_f.frms[dt]) {
|
||||
_f.frms[dt] = new _f.Frm(dt, d.body);
|
||||
}
|
||||
var f = _f.frms[dt];
|
||||
if(f.meta.istable) {
|
||||
f.parent_doctype = cur_frm.doctype;
|
||||
f.parent_docname = cur_frm.docname;
|
||||
}
|
||||
|
||||
d.cur_frm = f;
|
||||
d.dn = dn;
|
||||
d.table_form = f.meta.istable;
|
||||
|
||||
// show the form
|
||||
f.refresh(dn);
|
||||
|
||||
d.dialog.show();
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -38,9 +38,6 @@ _f.FrmHeader = function(parent, frm) {
|
|||
|
||||
// status
|
||||
this.status_area = $a(div, 'span', '', {marginRight:'8px', marginBottom:'2px', cursor:'pointer', textShadow:'none'})
|
||||
|
||||
// timestamp
|
||||
this.timestamp_area = $a($a(div,'div','',{marginTop:'3px'}), 'span', 'field_description', {fontSize:'11px'});
|
||||
}
|
||||
_f.FrmHeader.prototype.show = function() { $ds(this.wrapper); }
|
||||
_f.FrmHeader.prototype.hide = function() { $dh(this.wrapper); }
|
||||
|
|
@ -119,22 +116,6 @@ _f.FrmHeader.prototype.refresh_toolbar = function() {
|
|||
}
|
||||
|
||||
|
||||
// refresh heading and labels
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
_f.FrmHeader.prototype.get_timestamp = function(doc) {
|
||||
var scrub_date = function(d) {
|
||||
if(d)t=d.split(' ');else return '';
|
||||
return dateutil.str_to_user(t[0]) + ' ' + t[1];
|
||||
}
|
||||
|
||||
return repl("Created: %(c_by)s %(c_on)s %(m_by)s %(m_on)s",
|
||||
{c_by:doc.owner
|
||||
,c_on:scrub_date(doc.creation ? doc.creation:'')
|
||||
,m_by:doc.modified_by?(' | Modified: '+doc.modified_by):''
|
||||
,m_on:doc.modified ? ('on '+scrub_date(doc.modified)) : ''} );
|
||||
}
|
||||
|
||||
// make the status tag
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
|
@ -218,6 +199,8 @@ _f.FrmHeader.prototype.refresh_labels = function(f) {
|
|||
// main title
|
||||
this.dt_area.innerHTML = get_doctype_label(f.doctype);
|
||||
|
||||
if(f.meta.issingle) $(this.dn_area).toggle(false);
|
||||
|
||||
// sub title
|
||||
this.dn_area.innerHTML = '';
|
||||
if(!f.meta.issingle)
|
||||
|
|
@ -242,9 +225,6 @@ _f.FrmHeader.prototype.refresh_labels = function(f) {
|
|||
t.appendChild(sl[0]);
|
||||
if(sl[1])t.appendChild(sl[1]);
|
||||
|
||||
// timestamp
|
||||
this.timestamp_area.innerHTML = me.get_timestamp(doc);
|
||||
|
||||
setTimeout('$(cur_frm.frm_head.dn_area).addClass("background-fade-in")\
|
||||
.css("background-color", "white")', 1500)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ wn.widgets.form.file_upload_done = function(doctype, docname, fileid, filename,
|
|||
doc.modified = new_timestamp;
|
||||
|
||||
// update file_list
|
||||
var frm = frms[doctype];
|
||||
var frm = wn.views.formview[doctype].frm;
|
||||
frm.attachments.dialog.hide();
|
||||
msgprint('File Uploaded Sucessfully.');
|
||||
frm.refresh();
|
||||
|
|
|
|||
|
|
@ -135,6 +135,32 @@ wn.widgets.form.sidebar = { Sidebar: function(form) {
|
|||
},
|
||||
display: function() { return !me.form.doc.__islocal }
|
||||
},
|
||||
|
||||
{
|
||||
title: 'Users',
|
||||
render: function(wrapper) {
|
||||
var doc = cur_frm.doc;
|
||||
var scrub_date = function(d) {
|
||||
if(d)t=d.split(' ');else return '';
|
||||
return dateutil.str_to_user(t[0]) + ' ' + t[1];
|
||||
}
|
||||
|
||||
$(wrapper).html(repl('<p>Created:<br> <span class="avatar-small">\
|
||||
<img title="%(created_by)s" src="%(avatar_created)s" /></span> \
|
||||
<span class="help">%(creation)s</span></p>\
|
||||
<p>Modified:<br> <span class="avatar-small">\
|
||||
<img title="%(modified_by)s" src="%(avatar_modified)s" /></span> \
|
||||
<span class="help">%(modified)s</span></p>', {
|
||||
created_by: wn.user_info(doc.owner).fullname,
|
||||
avatar_created: wn.user_info(doc.owner).image,
|
||||
creation: scrub_date(doc.creation),
|
||||
modified_by: wn.user_info(doc.modified_by).fullname,
|
||||
avatar_modified: wn.user_info(doc.modified_by).image,
|
||||
modified: scrub_date(doc.modified)
|
||||
}));
|
||||
},
|
||||
display: function() { return !me.form.doc.__islocal }
|
||||
},
|
||||
|
||||
{
|
||||
title: 'Help',
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ wn.model = {
|
|||
no_value_type: ['Section Break', 'Column Break', 'HTML', 'Table',
|
||||
'Button', 'Image'],
|
||||
|
||||
new_names: {},
|
||||
|
||||
with_doctype: function(doctype, callback) {
|
||||
if(locals.DocType[doctype]) {
|
||||
callback();
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ wn.get_route = function(route) {
|
|||
return $.map(route.split('/'), function(r) { return decodeURIComponent(r); });
|
||||
}
|
||||
|
||||
wn.set_route = function(route) {
|
||||
wn.set_route = function() {
|
||||
route = $.map(arguments, function(a) { return encodeURIComponent(a) }).join('/');
|
||||
window.location.hash = route;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@
|
|||
// page_length (20)
|
||||
// hide_refresh (False)
|
||||
// new_doctype
|
||||
// new_doc_onload
|
||||
// new_doc_onsave
|
||||
// [function] render_row(parent, data)
|
||||
// [function] onrun
|
||||
// no_loading (no ajax indicator)
|
||||
|
|
@ -158,7 +156,7 @@ wn.ui.Listing = Class.extend({
|
|||
// new
|
||||
if(this.new_doctype) {
|
||||
this.$w.find('.btn-new').toggle(true).click(function() {
|
||||
newdoc(me.new_doctype, me.new_doc_onload, true, me.new_doc_onsave);
|
||||
newdoc(me.new_doctype);
|
||||
})
|
||||
} else {
|
||||
this.$w.find('.btn-new').remove();
|
||||
|
|
|
|||
2
js/wn/ui/toolbar.min.js
vendored
2
js/wn/ui/toolbar.min.js
vendored
|
|
@ -24,7 +24,7 @@ wn.ui.toolbar.RecentDocs=Class.extend({init:function(){$('.navbar .nav:first').a
|
|||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
|
||||
onclick="return false;">Recent<b class="caret"></b></a>\
|
||||
<ul class="dropdown-menu" id="toolbar-recent"></ul>\
|
||||
</li>');this.setup();this.bind_events();},bind_events:function(){rename_observers.push(this);},rename_notify:function(dt,old,name){this.remove(dt,old);this.add(dt,name,1);},add:function(dt,dn,on_top){if(this.istable(dt))return;this.remove(dt,dn);var html=repl('<li data-docref="%(dt)s/%(dn)s">\
|
||||
</li>');this.setup();this.bind_events();},bind_events:function(){var me=this;$(document).bind('rename',function(event,dt,old_name,new_name){me.rename_notify(dt,old_name,new_name)});},rename_notify:function(dt,old,name){this.remove(dt,old);this.add(dt,name,1);},add:function(dt,dn,on_top){if(this.istable(dt))return;this.remove(dt,dn);var html=repl('<li data-docref="%(dt)s/%(dn)s">\
|
||||
<a href="#Form/%(dt)s/%(dn)s">\
|
||||
%(dn)s <span style="font-size: 10px">(%(dt)s)</span>\
|
||||
</a></li>',{dt:dt,dn:dn});if(on_top){$('#toolbar-recent').prepend(html);}else{$('#toolbar-recent').append(html);}},istable:function(dt){return locals.DocType[dt]&&locals.DocType[dt].istable||false;},remove:function(dt,dn){$(repl('#toolbar-recent li[data-docref="%(dt)s/%(dn)s"]',{dt:dt,dn:dn})).remove();},setup:function(){try{var rlist=JSON.parse(profile.recent);}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,12 @@ wn.ui.toolbar.RecentDocs = Class.extend({
|
|||
this.setup();
|
||||
this.bind_events();
|
||||
},
|
||||
bind_events: function() {
|
||||
rename_observers.push(this);
|
||||
bind_events: function() {
|
||||
// notify on rename
|
||||
var me = this;
|
||||
$(document).bind('rename', function(event, dt, old_name, new_name) {
|
||||
me.rename_notify(dt, old_name, new_name)
|
||||
});
|
||||
},
|
||||
rename_notify: function(dt, old, name) {
|
||||
this.remove(dt, old);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ wn.provide('wn.views.formview');
|
|||
|
||||
wn.views.formview = {
|
||||
show: function(dt, dn) {
|
||||
// renamed (on save)?
|
||||
if(wn.model.new_names[dn])
|
||||
dn = wn.model.new_names[dn];
|
||||
|
||||
// show doctype
|
||||
wn.model.with_doctype(dt, function() {
|
||||
wn.model.with_doc(dt, dn, function(dn) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ def upload():
|
|||
if not webnotes.form['filedata'].filename:
|
||||
webnotes.response['result'] = """
|
||||
<script type='text/javascript'>
|
||||
window.parent.frms['%s'].attachments.dialog.hide();
|
||||
window.parent.wn.views.fomrview['%s'].frm.attachments.dialog.hide();
|
||||
window.parent.msgprint("Please select a file!");
|
||||
</script>""" % dt
|
||||
return
|
||||
|
|
@ -53,7 +53,7 @@ def upload():
|
|||
webnotes.response['result'] = """
|
||||
<script type='text/javascript'>
|
||||
window.parent.wn.widgets.form.file_upload_done('%(dt)s', '%(dn)s', '%(fid)s', '%(fname)s', '%(at_id)s', '%(mod)s');
|
||||
window.parent.frms['%(dt)s'].show_doc('%(dn)s');
|
||||
window.parent.wn.views.formview['%(dt)s'].frm.show_doc('%(dn)s');
|
||||
</script>
|
||||
""" % {
|
||||
'dt': dt,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue