Fixed Letter Head permissions, pjax only when .htm(l) or no extension, dragging issue in grid

This commit is contained in:
Anand Doshi 2014-05-07 17:22:00 +05:30
parent a35174399e
commit 8d0e90fef0
3 changed files with 23 additions and 13 deletions

View file

@ -1,7 +1,7 @@
{
"allow_attach": 1,
"autoname": "field:letter_head_name",
"creation": "2012-11-22 17:45:46.000000",
"creation": "2012-11-22 17:45:46",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -9,6 +9,7 @@
"fieldname": "letter_head_name",
"fieldtype": "Data",
"in_filter": 0,
"in_list_view": 1,
"label": "Letter Head Name",
"oldfieldname": "letter_head_name",
"oldfieldtype": "Data",
@ -19,6 +20,7 @@
"depends_on": "letter_head_name",
"fieldname": "disabled",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Disabled",
"oldfieldname": "disabled",
"oldfieldtype": "Check",
@ -29,6 +31,7 @@
"description": "Check this to make this the default letter head in all prints",
"fieldname": "is_default",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Is Default",
"oldfieldname": "is_default",
"oldfieldtype": "Check",
@ -39,6 +42,7 @@
"description": "Letter Head in HTML",
"fieldname": "content",
"fieldtype": "Text Editor",
"in_list_view": 1,
"label": "Content",
"oldfieldname": "content",
"oldfieldtype": "Text Editor",
@ -48,7 +52,7 @@
"icon": "icon-font",
"idx": 1,
"max_attachments": 3,
"modified": "2014-01-20 17:48:56.000000",
"modified": "2014-05-07 06:03:07.760995",
"modified_by": "Administrator",
"module": "Core",
"name": "Letter Head",
@ -69,11 +73,11 @@
},
{
"delete": 0,
"email": 1,
"email": 0,
"permlevel": 0,
"print": 1,
"print": 0,
"read": 1,
"report": 1,
"report": 0,
"role": "All"
}
]

View file

@ -109,13 +109,14 @@ frappe.ui.form.Grid = Class.extend({
var me =this;
$rows.sortable({
handle: ".data-row, .panel-heading",
helper: 'clone',
update: function(event, ui) {
me.frm.doc[me.df.parentfield] = [];
me.frm.doc[me.df.fieldname] = [];
$rows.find(".grid-row").each(function(i, item) {
var doc = $(item).data("doc");
doc.idx = i + 1;
$(this).find(".row-index").html(i + 1);
me.frm.doc[me.df.parentfield].push(doc);
me.frm.doc[me.df.fieldname].push(doc);
});
me.frm.dirty();
}

View file

@ -214,29 +214,34 @@ $.extend(frappe, {
var link = event.currentTarget
if (link.tagName.toUpperCase() !== 'A')
throw "using pjax requires an anchor element"
throw "using pjax requires an anchor element";
// Middle click, cmd click, and ctrl click should open
// links in a new tab as normal.
if ( event.which > 1 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey )
return
return;
// Ignore cross origin links
if ( location.protocol !== link.protocol || location.hostname !== link.hostname )
return
return;
// Ignore anchors on the same page
if (link.hash && link.href.replace(link.hash, '') ===
location.href.replace(location.hash, ''))
return
return;
// Ignore empty anchor "foo.html#"
if (link.href === location.href + '#')
return
return;
// our custom logic
if (link.href.indexOf("cmd=")!==-1 || link.hasAttribute("no-pjax"))
return
return;
// has an extension, but is not htm/html
var last_part = (link.href.split("/").slice(-1)[0] || "");
if (last_part.indexOf(".")!==-1 && (last_part.indexOf(".htm")===-1))
return;
event.preventDefault()
frappe.load_via_ajax(link.href);