Ver a proveniência

added patch for account and cleanups to breadcrumbs and msgprint

version-14
Rushabh Mehta há 13 anos
ascendente
cometimento
b8b79cb2f6
12 ficheiros alterados com 212 adições e 44 eliminações
  1. +8
    -0
      css/legacy/messages.css
  2. +105
    -0
      css/ui/ribbons.css
  3. +2
    -1
      css/ui/views.css
  4. +36
    -3
      js/legacy/utils/msgprint.js
  5. +4
    -1
      js/legacy/widgets/form/form.js
  6. +3
    -9
      js/legacy/widgets/form/form_fields.js
  7. +13
    -4
      js/legacy/widgets/form/form_header.js
  8. +0
    -9
      js/legacy/wn/widgets/form/sidebar.js
  9. +29
    -3
      js/wn/ui/appframe.js
  10. +4
    -3
      js/wn/ui/dialog.js
  11. +7
    -9
      js/wn/views/breadcrumbs.js
  12. +1
    -2
      js/wn/views/doclistview.js

+ 8
- 0
css/legacy/messages.css Ver ficheiro

@@ -5,6 +5,14 @@

div.fetching { color: #888; text-align:right; }

.msgprint {
min-height: 60px;
max-height: 500px;
padding: 9px;
color: #333;
overflow: auto;
}

div.notice {
postion: absolute;
background-color: #000;


+ 105
- 0
css/ui/ribbons.css Ver ficheiro

@@ -0,0 +1,105 @@
/* ribbons */

.ribbon-holder {
position: relative;
top: 0;
overflow: hidden;
height: 10em;
float: right;
}

.ribbon,
.ribbon:hover {
text-decoration: none;
}

.ribbon {
font-family: Arial, sans-serif;
letter-spacing: -.1px;
opacity: 0.95;

padding: 0.25em 0;
position: relative;
top: 2.5em;

/* Defaults friendly for white pages. */
-moz-box-shadow: 0 0 13px #888;
-webkit-box-shadow: 0 0 13px #888;
color: #FFF;
display: block;
line-height: 1.35em;
}

.ribbon .text {
padding: 0.1em 3em;
}

.ribbon-right .ribbon {
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
right: -2.6em;
}

.ribbon-left .ribbon {
-moz-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
left: -2.6em;
}

.white.ribbon {
color: #111;
background-color: #F5F5F5;
background: -webkit-gradient(linear, left bottom, left top, from(#f3f3f3), to(#fff));
-moz-box-shadow: 0 0 13px #999;
-webkit-box-shadow: 0 0 13px #999;
text-shadow: 0 0 .05em;
}

.white.ribbon .text {
border: 1px solid #cecece;
}

.red.ribbon {
background-color: #9a0000;
background: -webkit-gradient(linear, left bottom, left top, from(#9a0000), to(#a90000));
}

.red.ribbon .text {
border: 1px solid #bf6060;
}

.green.ribbon {
background-color: #006e00;
background: -webkit-gradient(linear, left bottom, left top, from(#006e00), to(#007200));
}

.green.ribbon .text {
border: 1px solid #6bac6b;
}

.darkblue.ribbon {
background-color: #121621;
color: #ecedee;
}

.darkblue.ribbon .text {
border: 1px solid #53565e;
}

.orange.ribbon {
background-color: #E57504;
background: -webkit-gradient(linear, left bottom, left top, from(#dc7202), to(#ee7906));
}

.orange.ribbon .text {
border: 1px solid #ebaa65;
}

.gray.ribbon {
background-color: #6d6d6d;
background: -webkit-gradient(linear, left bottom, left top, from(#6a6a6a) to(#6d6d6d));
}

.gray.ribbon .text {
border: 1px solid #a4a4a4;
}

+ 2
- 1
css/ui/views.css Ver ficheiro

@@ -33,4 +33,5 @@ div.appframe-toolbar {
background: #eeeeee;
border-top: 1px solid #f8f8f8;
border-bottom: 1px solid #ccc;
}
}


+ 36
- 3
js/legacy/utils/msgprint.js Ver ficheiro

@@ -21,6 +21,39 @@
//

var msg_dialog;

function msgprint(msg, title) {
if(!msg) return;
if(typeof(msg)!='string')
msg = JSON.stringify(msg);

// small message
if(msg.substr(0,8)=='__small:') {
show_alert(msg.substr(8)); return;
}

if(!msg_dialog) {
msg_dialog = new wn.ui.Dialog({
title:"Message",
onhide: function() {
msg_dialog.msg_area.empty();
}
});
msg_dialog.msg_area = $('<div class="msgprint">')
.appendTo(msg_dialog.body);
}

if(msg.search(/<br>|<p>/)==-1)
msg = replace_newlines(msg);

msg_dialog.set_title(title || 'Message')
msg_dialog.msg_area.append(msg);
msg_dialog.show();
}

/*
function msgprint(msg, issmall, callback) {
if(!msg) return;
@@ -67,8 +100,8 @@ function msgprint(msg, issmall, callback) {
msg_dialog.msg_icon.src = 'images/lib/icons/accept.gif'; $di(msg_dialog.msg_icon); msg = msg.substr(3);
}

m.innerHTML = replace_newlines(msg);
if(msg.search(/<br>|<p>/)==-1)
m.innerHTML = replace_newlines(msg);

if(m.offsetHeight > 200) {
$y(m, {height:'200px', width:'400px', overflow:'auto'})
@@ -76,7 +109,7 @@ function msgprint(msg, issmall, callback) {
msg_dialog.custom_onhide = callback;
}
}*/


// Floating Message


+ 4
- 1
js/legacy/widgets/form/form.js Ver ficheiro

@@ -318,7 +318,8 @@ _f.Frm.prototype.set_intro = function(txt) {
.insertBefore(this.page_layout.body.firstChild);
}
if(txt) {
this.intro_area.html(txt);
if(txt.search(/<p>/)==-1) txt = '<p>' + txt + '</p>';
this.intro_area.html(txt);
} else {
this.intro_area.remove();
this.intro_area = null;
@@ -1096,6 +1097,8 @@ _f.set_value = function(dt, dn, fn, v) {
if(changed && (d[fn]==null || v==null) && (cstr(d[fn])==cstr(v))) changed = 0;

if(changed) {
//console.log('value changed for ' + dt + ', ' + dn + ', ' + fn)
var prev_unsaved = d.__unsaved
d[fn] = v;
d.__unsaved = 1;


+ 3
- 9
js/legacy/widgets/form/form_fields.js Ver ficheiro

@@ -152,14 +152,7 @@ _f.SectionBreak.prototype.refresh = function(from_form) {
if(hidden) {
if(this.row)this.row.hide();
} else {
if(this.collapsible) {
//this.section_expand(from_form);
//if(this.df.reqd || this.has_data()) {
// this.section_expand(from_form);
//} else {
// this.section_collapse();
//}
}
if(this.row)this.row.show();
}
}

@@ -241,7 +234,8 @@ _f.TableField.prototype.make_body = function() {
// description
if(this.df.description) {
this.desc_area = $a(this.parent, 'div', 'help small', '', this.df.description)
this.desc_area = $a(this.parent, 'div', 'help small',
{marginBottom:'9px', marginTop:'0px'}, this.df.description)
}
}
}


+ 13
- 4
js/legacy/widgets/form/form_header.js Ver ficheiro

@@ -31,14 +31,17 @@
_f.FrmHeader = Class.extend({
init: function(parent, frm) {
this.appframe = new wn.ui.AppFrame(parent)
this.appframe.$titlebar.append('</span>\
<span class="breadcrumb-area"></span>');
this.$w = this.appframe.$w;
},
refresh: function() {
// refresh breadcrumbs
wn.views.breadcrumbs($(this.$w.find('.breadcrumb-area')),
cur_frm.meta.module, cur_frm.meta.name, cur_frm.docname);
if(cur_frm.cscript.set_breadcrumbs) {
this.appframe.clear_breadcrumbs();
cur_frm.cscript.set_breadcrumbs();
} else {
wn.views.breadcrumbs(this.appframe,
cur_frm.meta.module, cur_frm.meta.name, cur_frm.docname);
}
this.refresh_labels();
this.refresh_toolbar();
@@ -116,6 +119,12 @@ _f.FrmHeader = Class.extend({
// Amend
if(docstatus==2 && p[AMEND])
this.appframe.add_button('Amend', function() { cur_frm.amend_doc() }, 'icon-pencil');
// Help
if(cur_frm.meta.description) {
this.appframe.add_help_button(wn.markdown('## ' + cur_frm.doctype + '\n<br>\n'
+ cur_frm.meta.description));
}

},
show: function() {


+ 0
- 9
js/legacy/wn/widgets/form/sidebar.js Ver ficheiro

@@ -160,15 +160,6 @@ wn.widgets.form.sidebar = { Sidebar: function(form) {
}));
},
display: function() { return !me.form.doc.__islocal }
},

{
title: 'Help',
render: function(wrapper) {
$(wrapper).html('<div class="help small">'
+ wn.markdown(me.form.meta.description) + '</div>')
},
display: function() { return me.form.meta.description }
}
]
}


+ 29
- 3
js/wn/ui/appframe.js Ver ficheiro

@@ -18,10 +18,12 @@ wn.ui.AppFrame = Class.extend({
title: function(txt) {
this.$titlebar.find('.appframe-title').html(txt);
},
add_button: function(label, click, icon) {
make_toolbar: function() {
if(!this.$w.find('.appframe-toolbar').length)
this.$w.append('<div class="appframe-toolbar"></div>');

this.$w.append('<div class="appframe-toolbar"></div>');
},
add_button: function(label, click, icon) {
this.make_toolbar();
args = { label: label, icon:'' };
if(icon) {
args.icon = '<i class="icon '+icon+'"></i>';
@@ -32,8 +34,32 @@ wn.ui.AppFrame = Class.extend({
.appendTo(this.$w.find('.appframe-toolbar'));
return this.buttons[label];
},
add_help_button: function(txt) {
this.make_toolbar();
$('<button class="btn btn-small" style="float:right;" button-type="help">\
<b>?</b></button>')
.data('help-text', txt)
.click(function() { msgprint($(this).data('help-text'), 'Help'); })
.appendTo(this.$w.find('.appframe-toolbar'));
},
clear_buttons: function() {
this.$w.find('.appframe-toolbar').empty();
},
add_breadcrumb: function(html) {
if(!this.$breadcrumbs)
this.$breadcrumbs = $('</span>\
<span class="breadcrumb-area"></span>').appendTo(this.$titlebar);
var crumb = $('<span>').html(html);
// first breadcrumb is a title
if(!this.$breadcrumbs.find('span').length) {
crumb.addClass('appframe-title');
}
crumb.appendTo(this.$breadcrumbs);
},
clear_breadcrumbs: function() {
this.$breadcrumbs && this.$breadcrumbs.empty();
}
});



+ 4
- 3
js/wn/ui/dialog.js Ver ficheiro

@@ -99,12 +99,13 @@ wn.widgets.FieldGroup = function() {

wn.widgets.Dialog = function(opts) {
this.opts = opts;
this.display = false;
this.make = function(opts) {
if(opts)
if(opts) {
this.opts = opts;
$.extend(this, opts);
}
if(!this.opts.width) this.opts.width = 480;
if(!$('#dialog-container').length) {
@@ -183,7 +184,7 @@ wn.widgets.Dialog = function(opts) {
this.appframe.$titlebar.find('.close').toggle(false);
}

if(opts) this.make();
if(opts) this.make(opts);

}



+ 7
- 9
js/wn/views/breadcrumbs.js Ver ficheiro

@@ -1,24 +1,22 @@
wn.provide('wn.views');
wn.views.breadcrumbs = function(parent, module, doctype, name) {
$(parent).empty();
var $bspan = $(parent);
wn.views.breadcrumbs = function(appframe, module, doctype, name) {
appframe.clear_breadcrumbs();

if(name) {
$bspan.append('<span class="appframe-title">' + name + '</span>');
appframe.add_breadcrumb(name);
} else if(doctype) {
$bspan.append('<span class="appframe-title">' + doctype + ' List </span>');
appframe.add_breadcrumb(doctype + ' List');
} else if(module) {
$bspan.append('<span class="appframe-title">' + module + '</span>');
appframe.add_breadcrumb(module);
}

if(name && doctype && (!locals['DocType'][doctype].issingle)) {
$bspan.append(repl('<span> in <a href="#!List/%(doctype)s">%(doctype)s List</a></span>',
appframe.add_breadcrumb(repl(' in <a href="#!List/%(doctype)s">%(doctype)s List</a>',
{doctype: doctype}))
};
if(doctype && module && wn.modules && wn.modules[module]) {
$bspan.append(repl('<span> in <a href="#!%(module_page)s">%(module)s</a></span>',
appframe.add_breadcrumb(repl(' in <a href="#!%(module_page)s">%(module)s</a>',
{module: module, module_page: wn.modules[module] }))
}
//$bspan.appendTo(parent);
}

+ 1
- 2
js/wn/views/doclistview.js Ver ficheiro

@@ -74,8 +74,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
</div>');
this.appframe = new wn.ui.AppFrame(this.$page.find('.appframe-area'));
wn.views.breadcrumbs($('<span class="breadcrumb-area">').appendTo(this.appframe.$titlebar),
locals.DocType[this.doctype].module, this.doctype);
wn.views.breadcrumbs(this.appframe, locals.DocType[this.doctype].module, this.doctype);
},

setup: function() {


Carregando…
Cancelar
Guardar