瀏覽代碼

[form/list] ui fixes, [note] new table to merge question + answer

version-14
Rushabh Mehta 12 年之前
父節點
當前提交
a83f391c67
共有 9 個檔案被更改,包括 55 行新增35 行删除
  1. +1
    -2
      public/js/legacy/widgets/form/form.js
  2. +14
    -8
      public/js/legacy/widgets/form/print_format.js
  3. +4
    -12
      public/js/wn/form/editors.js
  4. +1
    -1
      public/js/wn/form/grid.js
  5. +4
    -0
      public/js/wn/misc/user.js
  6. +1
    -1
      public/js/wn/ui/button.js
  7. +28
    -9
      public/js/wn/views/listview.js
  8. +1
    -1
      public/js/wn/views/sidebar_stats.js
  9. +1
    -1
      webnotes/widgets/form/load.py

+ 1
- 2
public/js/legacy/widgets/form/form.js 查看文件

@@ -174,7 +174,6 @@ _f.Frm.prototype.setup_print_layout = function() {
this.print_body = $(this.print_wrapper).find(".print-format-area").get(0); this.print_body = $(this.print_wrapper).find(".print-format-area").get(0);
} }



_f.Frm.prototype.onhide = function() { _f.Frm.prototype.onhide = function() {
if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect(); 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 // 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);
} }






+ 14
- 8
public/js/legacy/widgets/form/print_format.js 查看文件

@@ -130,7 +130,7 @@ $.extend(_p, {
+ no_letterhead + no_letterhead
+ only_body + only_body
*/ */
build: function(fmtname, onload, no_letterhead, only_body) {
build: function(fmtname, onload, no_letterhead, only_body, no_heading) {
if(!fmtname) { if(!fmtname) {
fmtname= "Standard"; fmtname= "Standard";
} }
@@ -151,11 +151,12 @@ $.extend(_p, {
var doc = locals[cur_frm.doctype][cur_frm.docname]; var doc = locals[cur_frm.doctype][cur_frm.docname];
if(args.fmtname == 'Standard') { if(args.fmtname == 'Standard') {
args.onload(_p.render({ args.onload(_p.render({
body: _p.print_std(args.no_letterhead),
body: _p.print_std(args.no_letterhead, no_heading),
style: _p.print_style, style: _p.print_style,
doc: doc, doc: doc,
title: doc.name, title: doc.name,
no_letterhead: args.no_letterhead, no_letterhead: args.no_letterhead,
no_heading: no_heading,
only_body: args.only_body only_body: args.only_body
})); }));
} else { } else {
@@ -170,6 +171,7 @@ $.extend(_p, {
doc: doc, doc: doc,
title: doc.name, title: doc.name,
no_letterhead: args.no_letterhead, no_letterhead: args.no_letterhead,
no_heading: no_heading,
only_body: args.only_body only_body: args.only_body
})); }));
} }
@@ -179,10 +181,12 @@ $.extend(_p, {
var container = document.createElement('div'); var container = document.createElement('div');
var stat = ''; 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 // Append args.body's content as a child of container
container.innerHTML = args.body; container.innerHTML = args.body;
@@ -433,7 +437,7 @@ $.extend(_p, {
margin: 8px 0px; \ margin: 8px 0px; \
}", }",
print_std: function(no_letterhead) {
print_std: function(no_letterhead, no_heading) {
// Get doctype, docname, layout for a doctype // Get doctype, docname, layout for a doctype
var docname = cur_frm.docname; var docname = cur_frm.docname;
var doctype = cur_frm.doctype; 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); this.build_data(data, doctype, docname);




+ 4
- 12
public/js/wn/form/editors.js 查看文件

@@ -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-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>\ <a class="btn btn-default btn-small btn-html" title="HTML"><i class="icon-wrench"></i></a>\
</div>\ </div>\
</div>').appendTo(this.opts.parent);
</div><div class="clearfix"></div>').appendTo(this.opts.parent);
this.$parent = $(this.opts.parent); this.$parent = $(this.opts.parent);
this.$editor = $("#" + this.myid); this.$editor = $("#" + this.myid);
this.$parent.find(".btn-add-link").click(function() { this.$parent.find(".btn-add-link").click(function() {
@@ -131,17 +131,6 @@ wn.editors.BootstrapWYSIWYG = Class.extend({
fontName + '</a></li>')); 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 // magic-overlay
this.$parent.find('[data-role=magic-overlay]').each(function () { this.$parent.find('[data-role=magic-overlay]').each(function () {
var overlay = $(this), target = $(overlay.data('target')); var overlay = $(this), target = $(overlay.data('target'));
@@ -188,6 +177,9 @@ wn.editors.BootstrapWYSIWYG = Class.extend({


}, },
set_input: function(value) { set_input: function(value) {
if(this.opts.field.inside_change_event)
return;
if(this.value!=value) { if(this.value!=value) {
this.value = value==null ? "" : value; this.value = value==null ? "" : value;
this.$editor.html(this.value); this.$editor.html(this.value);


+ 1
- 1
public/js/wn/form/grid.js 查看文件

@@ -155,7 +155,7 @@ wn.ui.form.GridRow = Class.extend({
title="'+wn._("Close")+'"\ title="'+wn._("Close")+'"\
style="margin-left: 7px;">\ style="margin-left: 7px;">\
<i class="icon-ok"></i></button>\ <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")+'"\ title="'+wn._("Insert Row")+'"\
style="margin-left: 7px;">\ style="margin-left: 7px;">\
<i class="icon-plus"></i></button>\ <i class="icon-plus"></i></button>\


+ 4
- 0
public/js/wn/misc/user.js 查看文件

@@ -92,6 +92,10 @@ $.extend(wn.user, {
if(wn.boot.allowed_pages.indexOf(wn.modules[m].link)!=-1) if(wn.boot.allowed_pages.indexOf(wn.modules[m].link)!=-1)
ret = m; ret = m;
break; break;
case "list":
if(wn.model.can_read(wn.modules[m].doctype))
ret = m;
break;
case "view": case "view":
ret = m; ret = m;
break; break;


+ 1
- 1
public/js/wn/ui/button.js 查看文件

@@ -24,7 +24,7 @@ wn.ui.Button = function(args) {
var me = this; var me = this;
$.extend(this, { $.extend(this, {
make: function() { 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; me.btn.args = args;


// ajax loading // ajax loading


+ 28
- 9
public/js/wn/views/listview.js 查看文件

@@ -78,6 +78,7 @@ wn.views.ListView = Class.extend({
if(wn.model.is_submittable(this.doctype)) { if(wn.model.is_submittable(this.doctype)) {
this.columns.push({colspan: 0.5, content:'docstatus'}); this.columns.push({colspan: 0.5, content:'docstatus'});
} }
this.columns.push({colspan: 2, content:'name'}); this.columns.push({colspan: 2, content:'name'});


if(this.workflow_state_fieldname) { if(this.workflow_state_fieldname) {
@@ -104,7 +105,9 @@ wn.views.ListView = Class.extend({
colspan = "1"; colspan = "1";
} else if(d.fieldtype=="Check" || d.fieldname=="file_list") { } else if(d.fieldtype=="Check" || d.fieldname=="file_list") {
colspan = "1"; 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"; colspan = "3";
} }
me.columns.push({colspan: colspan, content: d.fieldname, 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) { render: function(row, data) {
@@ -129,7 +136,7 @@ wn.views.ListView = Class.extend({
.appendTo(row).css({"padding": "5px 0px", .appendTo(row).css({"padding": "5px 0px",
"padding-bottom": "0px", "padding-bottom": "0px",
"margin-bottom": "5px", "margin-bottom": "5px",
"border-bottom": "1px solid #f2f2f2"
"border-bottom": "1px solid #eee"
}), }),
colspans = 0, colspans = 0,
me = this; 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 // 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({ var tag_editor = new wn.ui.TagEditor({
parent: tag_col,
parent: row2.find(".list-tag"),
doctype: this.doctype, doctype: this.doctype,
docname: data.name, docname: data.name,
user_tags: data._user_tags 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", me.doclistview.set_filter("_user_tags",
$(this).text()); $(this).text());
})
});
}, },
make_column: function(body, colspan, is_small) { make_column: function(body, colspan, is_small) {
colspan = colspan==0.5 ? "50" : colspan; colspan = colspan==0.5 ? "50" : colspan;


+ 1
- 1
public/js/wn/views/sidebar_stats.js 查看文件

@@ -12,7 +12,7 @@ wn.provide('wn.views');
wn.views.SidebarStats = Class.extend({ wn.views.SidebarStats = Class.extend({
init: function(opts) { init: function(opts) {
$.extend(this, opts); $.extend(this, opts);
this.wrapper = $("<div>").appendTo(this.parent);
this.wrapper = $("<div>").css({"padding-bottom": "15px"}).appendTo(this.parent);
this.get_stats(); this.get_stats();
}, },
get_stats: function() { get_stats: function() {


+ 1
- 1
webnotes/widgets/form/load.py 查看文件

@@ -85,7 +85,7 @@ def load_single_doc(dt, dn, user):
except Exception, e: except Exception, e:
webnotes.errprint(webnotes.utils.getTraceback()) webnotes.errprint(webnotes.utils.getTraceback())
webnotes.msgprint('Error in script while loading')
webnotes.msgprint('Did not load.')
raise e raise e


if dl and not dn.startswith('_'): if dl and not dn.startswith('_'):


Loading…
取消
儲存