@@ -174,7 +174,6 @@ _f.Frm.prototype.setup_print_layout = function() { | |||
this.print_body = $(this.print_wrapper).find(".print-format-area").get(0); | |||
} | |||
_f.Frm.prototype.onhide = function() { | |||
if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect(); | |||
} | |||
@@ -333,7 +332,7 @@ _f.Frm.prototype.refresh_print_layout = function() { | |||
} | |||
// create print format here | |||
_p.build(this.$print_view_select.val(), print_callback, null, 1); | |||
_p.build(this.$print_view_select.val(), print_callback, false, true, true); | |||
} | |||
@@ -130,7 +130,7 @@ $.extend(_p, { | |||
+ no_letterhead | |||
+ only_body | |||
*/ | |||
build: function(fmtname, onload, no_letterhead, only_body) { | |||
build: function(fmtname, onload, no_letterhead, only_body, no_heading) { | |||
if(!fmtname) { | |||
fmtname= "Standard"; | |||
} | |||
@@ -151,11 +151,12 @@ $.extend(_p, { | |||
var doc = locals[cur_frm.doctype][cur_frm.docname]; | |||
if(args.fmtname == 'Standard') { | |||
args.onload(_p.render({ | |||
body: _p.print_std(args.no_letterhead), | |||
body: _p.print_std(args.no_letterhead, no_heading), | |||
style: _p.print_style, | |||
doc: doc, | |||
title: doc.name, | |||
no_letterhead: args.no_letterhead, | |||
no_heading: no_heading, | |||
only_body: args.only_body | |||
})); | |||
} else { | |||
@@ -170,6 +171,7 @@ $.extend(_p, { | |||
doc: doc, | |||
title: doc.name, | |||
no_letterhead: args.no_letterhead, | |||
no_heading: no_heading, | |||
only_body: args.only_body | |||
})); | |||
} | |||
@@ -179,10 +181,12 @@ $.extend(_p, { | |||
var container = document.createElement('div'); | |||
var stat = ''; | |||
// if draft/archived, show draft/archived banner | |||
stat += _p.show_draft(args); | |||
stat += _p.show_archived(args); | |||
stat += _p.show_cancelled(args); | |||
if(!args.no_heading) { | |||
// if draft/archived, show draft/archived banner | |||
stat += _p.show_draft(args); | |||
stat += _p.show_archived(args); | |||
stat += _p.show_cancelled(args); | |||
} | |||
// Append args.body's content as a child of container | |||
container.innerHTML = args.body; | |||
@@ -433,7 +437,7 @@ $.extend(_p, { | |||
margin: 8px 0px; \ | |||
}", | |||
print_std: function(no_letterhead) { | |||
print_std: function(no_letterhead, no_heading) { | |||
// Get doctype, docname, layout for a doctype | |||
var docname = cur_frm.docname; | |||
var doctype = cur_frm.doctype; | |||
@@ -597,7 +601,9 @@ $.extend(_p, { | |||
} | |||
}); | |||
this.build_head(data, doctype, docname); | |||
if(!no_heading) { | |||
this.build_head(data, doctype, docname); | |||
} | |||
this.build_data(data, doctype, docname); | |||
@@ -76,7 +76,7 @@ wn.editors.BootstrapWYSIWYG = Class.extend({ | |||
<a class="btn btn-default btn-small btn-info btn-rich-text" title="Rich Text" disabled="disabled"><i class="icon-reorder"></i></a>\ | |||
<a class="btn btn-default btn-small btn-html" title="HTML"><i class="icon-wrench"></i></a>\ | |||
</div>\ | |||
</div>').appendTo(this.opts.parent); | |||
</div><div class="clearfix"></div>').appendTo(this.opts.parent); | |||
this.$parent = $(this.opts.parent); | |||
this.$editor = $("#" + this.myid); | |||
this.$parent.find(".btn-add-link").click(function() { | |||
@@ -131,17 +131,6 @@ wn.editors.BootstrapWYSIWYG = Class.extend({ | |||
fontName + '</a></li>')); | |||
}); | |||
//this.$parent.find('a[title]').tooltip({container:'body'}); | |||
this.$parent.find('.dropdown-menu input').click(function() {return false;}) | |||
.change(function () { | |||
$(this).parent('.dropdown-menu').siblings('.dropdown-toggle') | |||
.dropdown('toggle'); | |||
}) | |||
.keydown('esc', function () { | |||
this.value='';$(this).change(); | |||
}); | |||
// magic-overlay | |||
this.$parent.find('[data-role=magic-overlay]').each(function () { | |||
var overlay = $(this), target = $(overlay.data('target')); | |||
@@ -188,6 +177,9 @@ wn.editors.BootstrapWYSIWYG = Class.extend({ | |||
}, | |||
set_input: function(value) { | |||
if(this.opts.field.inside_change_event) | |||
return; | |||
if(this.value!=value) { | |||
this.value = value==null ? "" : value; | |||
this.$editor.html(this.value); | |||
@@ -155,7 +155,7 @@ wn.ui.form.GridRow = Class.extend({ | |||
title="'+wn._("Close")+'"\ | |||
style="margin-left: 7px;">\ | |||
<i class="icon-ok"></i></button>\ | |||
<button class="btn pull-right grid-insert-row" \ | |||
<button class="btn btn-default pull-right grid-insert-row" \ | |||
title="'+wn._("Insert Row")+'"\ | |||
style="margin-left: 7px;">\ | |||
<i class="icon-plus"></i></button>\ | |||
@@ -92,6 +92,10 @@ $.extend(wn.user, { | |||
if(wn.boot.allowed_pages.indexOf(wn.modules[m].link)!=-1) | |||
ret = m; | |||
break; | |||
case "list": | |||
if(wn.model.can_read(wn.modules[m].doctype)) | |||
ret = m; | |||
break; | |||
case "view": | |||
ret = m; | |||
break; | |||
@@ -24,7 +24,7 @@ wn.ui.Button = function(args) { | |||
var me = this; | |||
$.extend(this, { | |||
make: function() { | |||
me.btn = wn.dom.add(args.parent, 'button', 'btn ' + (args.css_class || '')); | |||
me.btn = wn.dom.add(args.parent, 'button', 'btn ' + (args.css_class || 'btn-default')); | |||
me.btn.args = args; | |||
// ajax loading | |||
@@ -78,6 +78,7 @@ wn.views.ListView = Class.extend({ | |||
if(wn.model.is_submittable(this.doctype)) { | |||
this.columns.push({colspan: 0.5, content:'docstatus'}); | |||
} | |||
this.columns.push({colspan: 2, content:'name'}); | |||
if(this.workflow_state_fieldname) { | |||
@@ -104,7 +105,9 @@ wn.views.ListView = Class.extend({ | |||
colspan = "1"; | |||
} else if(d.fieldtype=="Check" || d.fieldname=="file_list") { | |||
colspan = "1"; | |||
} else if(d.fieldname=="subject") { // subjects are longer | |||
} else if(d.fieldname=="subject" || d.fieldname=="title") { // subjects are longer | |||
colspan = "3"; | |||
} else if(d.fieldtype=="Text Editor" || d.fieldtype=="Text") { | |||
colspan = "3"; | |||
} | |||
me.columns.push({colspan: colspan, content: d.fieldname, | |||
@@ -118,9 +121,13 @@ wn.views.ListView = Class.extend({ | |||
}); | |||
} | |||
this.columns.push({colspan: 2, content:'modified', | |||
css: {'text-align': 'right', 'color':'#222'}}); | |||
// expand "name" if there are few columns | |||
var total_colspan = 0; | |||
$.each(this.columns, function(i, c) { total_colspan += c.colspan }); | |||
if(total_colspan < 8) { | |||
$.each(this.columns, | |||
function(i, c) { if(c.content==="name") { c.colspan = 4; return false; } }); | |||
} | |||
}, | |||
render: function(row, data) { | |||
@@ -129,7 +136,7 @@ wn.views.ListView = Class.extend({ | |||
.appendTo(row).css({"padding": "5px 0px", | |||
"padding-bottom": "0px", | |||
"margin-bottom": "5px", | |||
"border-bottom": "1px solid #f2f2f2" | |||
"border-bottom": "1px solid #eee" | |||
}), | |||
colspans = 0, | |||
me = this; | |||
@@ -151,18 +158,30 @@ wn.views.ListView = Class.extend({ | |||
} | |||
}); | |||
// row #2 | |||
var row2 = $('<div class="col col-lg-12 hidden-sm">\ | |||
<div class="row">\ | |||
<div class="col col-lg-6 col-offset-3 list-tag"></div>\ | |||
<div class="col col-lg-3" style="font-size: 90%; padding-right: 0px;\ | |||
color: #aaa; margin-top: -3px; text-align: right;">\ | |||
</div>\ | |||
</div>\ | |||
</div>').appendTo(body); | |||
// modified | |||
row2.find(".col-lg-3").html(comment_when(data.modified)); | |||
// add tags | |||
var tag_col = $('<div class="col col-lg-12 col-offset-4 list-tag"></div>').appendTo(body); | |||
var tag_editor = new wn.ui.TagEditor({ | |||
parent: tag_col, | |||
parent: row2.find(".list-tag"), | |||
doctype: this.doctype, | |||
docname: data.name, | |||
user_tags: data._user_tags | |||
}); | |||
tag_editor.$w.addClass("hidden-sm").on("click", ".tagit-label", function() { | |||
tag_editor.$w.on("click", ".tagit-label", function() { | |||
me.doclistview.set_filter("_user_tags", | |||
$(this).text()); | |||
}) | |||
}); | |||
}, | |||
make_column: function(body, colspan, is_small) { | |||
colspan = colspan==0.5 ? "50" : colspan; | |||
@@ -12,7 +12,7 @@ wn.provide('wn.views'); | |||
wn.views.SidebarStats = Class.extend({ | |||
init: function(opts) { | |||
$.extend(this, opts); | |||
this.wrapper = $("<div>").appendTo(this.parent); | |||
this.wrapper = $("<div>").css({"padding-bottom": "15px"}).appendTo(this.parent); | |||
this.get_stats(); | |||
}, | |||
get_stats: function() { | |||
@@ -85,7 +85,7 @@ def load_single_doc(dt, dn, user): | |||
except Exception, e: | |||
webnotes.errprint(webnotes.utils.getTraceback()) | |||
webnotes.msgprint('Error in script while loading') | |||
webnotes.msgprint('Did not load.') | |||
raise e | |||
if dl and not dn.startswith('_'): | |||