Browse Source

bugfix in delete and clicking link in list will filter it

version-14
Rushabh Mehta 11 years ago
parent
commit
87db982cb9
6 changed files with 36 additions and 11 deletions
  1. +6
    -3
      webnotes/core/doctype/doctype/doctype.txt
  2. +4
    -4
      webnotes/profile.py
  3. +4
    -1
      webnotes/public/js/lib/slickgrid/slick-default-theme.css
  4. +1
    -1
      webnotes/public/js/wn/form/control.js
  5. +7
    -2
      webnotes/public/js/wn/form/linked_with.js
  6. +14
    -0
      webnotes/public/js/wn/views/listview.js

+ 6
- 3
webnotes/core/doctype/doctype/doctype.txt View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-18 13:36:19",
"docstatus": 0,
"modified": "2014-01-24 11:25:15",
"modified": "2014-01-27 11:57:14",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -33,7 +33,6 @@
},
{
"cancel": 0,
"delete": 0,
"doctype": "DocPerm",
"email": 1,
"name": "__common__",
@@ -64,11 +63,13 @@
"doctype": "DocField",
"fieldname": "module",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Module",
"oldfieldname": "module",
"oldfieldtype": "Link",
"options": "Module Def",
"reqd": 1
"reqd": 1,
"search_index": 1
},
{
"description": "Child Tables are shown as a Grid in other DocTypes.",
@@ -360,11 +361,13 @@
"search_index": 0
},
{
"delete": 0,
"doctype": "DocPerm",
"role": "System Manager"
},
{
"create": 1,
"delete": 1,
"doctype": "DocPerm",
"role": "Administrator",
"write": 1


+ 4
- 4
webnotes/profile.py View File

@@ -48,8 +48,8 @@ class Profile:
def build_perm_map(self):
"""build map of permissions at level 0"""
self.perm_map = {}
for r in webnotes.conn.sql("""select parent, `read`, `write`, `create`, `submit`, `cancel`,
`report`, `import`, `export`, `print`, `email`, `restrict`
for r in webnotes.conn.sql("""select parent, `read`, `write`, `create`, `delete`, `submit`,
`cancel`,`report`, `import`, `export`, `print`, `email`, `restrict`
from tabDocPerm where docstatus=0
and ifnull(permlevel,0)=0
and parent not like "old_parent:%%"
@@ -59,11 +59,11 @@ class Profile:
if not dt in self.perm_map:
self.perm_map[dt] = {}
for k in ('read', 'write', 'create', 'submit', 'cancel', 'amend',
for k in ('read', 'write', 'create', 'submit', 'cancel', 'amend', 'delete',
'report', 'import', 'export', 'print', 'email', 'restrict'):
if not self.perm_map[dt].get(k):
self.perm_map[dt][k] = r.get(k)
def build_permissions(self):
"""build lists of what the user can read / write / create
quirks:


+ 4
- 1
webnotes/public/js/lib/slickgrid/slick-default-theme.css View File

@@ -45,7 +45,10 @@ classes should alter those!
}

.slick-cell {
padding: 0px 4px;
padding: 1px 4px 0px 5px;
border-top: 0px;
border-left: 0px;
border-right: 1px solid silver;
}

.slick-group {


+ 1
- 1
webnotes/public/js/wn/form/control.js View File

@@ -462,7 +462,7 @@ wn.ui.form.ControlCheck = wn.ui.form.ControlData.extend({
input_type: "checkbox",
make_wrapper: function() {
this.$wrapper = $('<div class="form-group row" style="margin: 0px;">\
<div class="col-md-offset-3 col-md-8">\
<div class="col-md-offset-4 col-md-8">\
<div class="checkbox" style="margin: 5px 0px">\
<label>\
<span class="input-area"></span>\


+ 7
- 2
webnotes/public/js/wn/form/linked_with.js View File

@@ -65,11 +65,16 @@ wn.ui.form.LinkedWith = Class.extend({
$.each(keys(r.message).sort(), function(i, doctype) {
var listview = wn.views.get_listview(doctype, me);
listview.no_delete = true;
$("<h4>").html(wn._(doctype)).appendTo(parent);
var wrapper = $('<div class="panel panel-default"><div>').appendTo(parent);
$('<div class="panel-heading">').html(wn._(doctype).bold()).appendTo(wrapper);
var body = $('<div class="panel-body">').appendTo(wrapper)
.css({"padding-top": "0px", "padding-bottom": "0px"});
$.each(r.message[doctype], function(i, d) {
d.doctype = doctype;
listview.render($("<div>").appendTo(parent), d, me);
listview.render($("<div>")
.appendTo(body), d, me);
})
})
} else {


+ 14
- 0
webnotes/public/js/wn/views/listview.js View File

@@ -342,6 +342,20 @@ wn.views.ListView = Class.extend({
})
.appendTo(parent.css({"overflow":"hidden"}));
}
else if(opts.type=="link" && data[opts.content]) {
$("<span>")
.html(wn.format(data[opts.content], opts.df, null, data))
.appendTo(parent.css({"overflow":"hidden"}))
.click(function() {
me.doclistview.set_filter($(this).attr("data-fieldname"),
$(this).attr("data-value"));
return false;
})
.attr("data-fieldname", opts.content)
.attr("data-value", data[opts.content])
.find("a").attr("href", "#");
}
else if(data[opts.content]) {
$("<span>")
.html(wn.format(data[opts.content], opts.df, null, data))


Loading…
Cancel
Save