[added] print styleversion-14
@@ -178,7 +178,8 @@ def handle_exception(e): | |||
make_error_snapshot(e) | |||
if return_as_message: | |||
response = frappe.website.render.render("message", http_status_code=http_status_code) | |||
response = frappe.website.render.render("message", | |||
http_status_code=http_status_code) | |||
return response | |||
@@ -124,7 +124,7 @@ def get_data(): | |||
{ | |||
"type": "doctype", | |||
"name": "Deleted Document", | |||
"label": _("Deleted Documents"), | |||
"label": _("Deleted Documents"), | |||
"description": _("Restore or permanently delete a document.") | |||
}, | |||
] | |||
@@ -180,6 +180,11 @@ def get_data(): | |||
"name": "Print Format", | |||
"description": _("Customized HTML Templates for printing transactions.") | |||
}, | |||
{ | |||
"type": "doctype", | |||
"name": "Print Style", | |||
"description": _("Stylesheets for Print Formats") | |||
}, | |||
] | |||
}, | |||
{ | |||
@@ -8,13 +8,9 @@ | |||
} | |||
@media (min-width: 768px) { | |||
.setup-wizard-slide.single-column { | |||
.setup-wizard-slide { | |||
max-width: 500px; | |||
} | |||
.setup-wizard-slide.two-column { | |||
max-width: 768px; | |||
} | |||
} | |||
.setup-wizard-slide .lead { | |||
@@ -45,7 +41,7 @@ | |||
} | |||
.setup-wizard-slide.with-form { | |||
margin: 30px auto; | |||
margin: 60px auto; | |||
padding: 10px 50px; | |||
border: 1px solid #d1d8dd; | |||
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1); | |||
@@ -145,7 +141,6 @@ | |||
cursor: pointer; | |||
} | |||
.setup-wizard-message-image { | |||
margin: 15px auto; | |||
} |
@@ -56,8 +56,9 @@ def sync_for(app_name, force=0, sync_everything = False, verbose=False, reset_pe | |||
def get_doc_files(files, start_path, force=0, sync_everything = False, verbose=False): | |||
"""walk and sync all doctypes and pages""" | |||
document_type = ['doctype', 'page', 'report', 'print_format', 'website_theme', 'web_form', 'email_alert'] | |||
for doctype in document_type: | |||
document_types = ['doctype', 'page', 'report', 'print_format', | |||
'website_theme', 'web_form', 'email_alert', 'print_style'] | |||
for doctype in document_types: | |||
doctype_path = os.path.join(start_path, doctype) | |||
if os.path.exists(doctype_path): | |||
@@ -87,7 +87,8 @@ def read_doc_from_file(path): | |||
ignore_values = { | |||
"Report": ["disabled"], | |||
"Print Format": ["disabled"], | |||
"Email Alert": ["enabled"] | |||
"Email Alert": ["enabled"], | |||
"Print Style": ["disabled"] | |||
} | |||
ignore_doctypes = [""] | |||
@@ -10,8 +10,9 @@ import frappe.utils | |||
from frappe import _ | |||
lower_case_files_for = ['DocType', 'Page', 'Report', | |||
"Workflow", 'Module Def', 'Desktop Item', 'Workflow State', 'Workflow Action', 'Print Format', | |||
"Website Theme", 'Web Form', 'Email Alert'] | |||
"Workflow", 'Module Def', 'Desktop Item', 'Workflow State', | |||
'Workflow Action', 'Print Format', "Website Theme", 'Web Form', | |||
'Email Alert', 'Print Style'] | |||
def export_module_json(doc, is_standard, module): | |||
"""Make a folder for the given doc and add its json file (make it a standard | |||
@@ -23,8 +23,8 @@ class TestPrintFormat(unittest.TestCase): | |||
def test_print_user_modern(self): | |||
print_html = self.test_print_user("Modern") | |||
self.assertTrue("/* modern format: don't remove this line */" in print_html) | |||
self.assertTrue("/* modern format: for-test */" in print_html) | |||
def test_print_user_classic(self): | |||
print_html = self.test_print_user("Classic") | |||
self.assertTrue("font-family: serif;" in print_html) | |||
self.assertTrue("/* classic format: for-test */" in print_html) |
@@ -2,8 +2,15 @@ | |||
// For license information, please see license.txt | |||
frappe.ui.form.on("Print Settings", "print_style", function (frm) { | |||
frm.get_field("print_style_preview").html('<img src="/assets/frappe/images/help/print-style-' + | |||
frm.doc.print_style.toLowerCase() + '.png" class="img-responsive">'); | |||
frappe.db.get_value('Print Style', frm.doc.print_style, 'preview').then((r) => { | |||
if(r.message.preview) { | |||
frm.get_field("print_style_preview").$wrapper.html( | |||
`<img src="${r.message.preview}" class="img-responsive">`); | |||
} else { | |||
frm.get_field("print_style_preview").$wrapper.html( | |||
`<p style="margin: 60px 0px" class="text-center text-muted">${__("No Preview")}</p>`); | |||
} | |||
}); | |||
}); | |||
frappe.ui.form.on("Print Settings", "onload", function (frm) { | |||
@@ -177,6 +177,7 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Page Settings", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
@@ -199,7 +200,7 @@ | |||
"columns": 0, | |||
"default": "1", | |||
"description": "", | |||
"fieldname": "attach_view_link", | |||
"fieldname": "with_letterhead", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
@@ -208,11 +209,10 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Send document web view link in email", | |||
"label": "Print with letterhead", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -229,8 +229,10 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "print_style_section", | |||
"fieldtype": "Section Break", | |||
"default": "1", | |||
"description": "", | |||
"fieldname": "allow_print_for_draft", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -238,10 +240,11 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Print Style", | |||
"label": "Allow Print for Draft", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -258,21 +261,22 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"default": "Modern", | |||
"fieldname": "print_style", | |||
"fieldtype": "Select", | |||
"default": "1", | |||
"description": "", | |||
"fieldname": "attach_view_link", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_global_search": 0, | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Print Style", | |||
"label": "Send document web view link in email", | |||
"length": 0, | |||
"no_copy": 0, | |||
"options": "Modern\nClassic\nStandard\nMonochrome", | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -289,9 +293,8 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"default": "Default", | |||
"fieldname": "font", | |||
"fieldtype": "Select", | |||
"fieldname": "column_break_10", | |||
"fieldtype": "Column Break", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -299,10 +302,8 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Font", | |||
"length": 0, | |||
"no_copy": 0, | |||
"options": "Default\nArial\nHelvetica\nVerdana\nMonospace", | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
@@ -321,9 +322,9 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"description": "In points. Default is 9.", | |||
"fieldname": "font_size", | |||
"fieldtype": "Float", | |||
"default": "1", | |||
"fieldname": "add_draft_heading", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -331,10 +332,11 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Font Size", | |||
"label": "Always add \"Draft\" Heading for printing draft documents", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -351,8 +353,8 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "column_break_6", | |||
"fieldtype": "Column Break", | |||
"fieldname": "allow_page_break_inside_tables", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -360,9 +362,11 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Allow page break inside tables", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -379,9 +383,8 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"default": "1", | |||
"description": "", | |||
"fieldname": "with_letterhead", | |||
"fieldname": "allow_print_for_cancelled", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
@@ -390,10 +393,11 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Print with letterhead", | |||
"label": "Allow Print for Cancelled", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -410,10 +414,8 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"default": "1", | |||
"description": "", | |||
"fieldname": "allow_print_for_draft", | |||
"fieldtype": "Check", | |||
"fieldname": "print_style_section", | |||
"fieldtype": "Section Break", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -421,11 +423,10 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Allow Print for Draft", | |||
"label": "Print Style", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -442,21 +443,21 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"default": "1", | |||
"fieldname": "add_draft_heading", | |||
"fieldtype": "Check", | |||
"default": "Modern", | |||
"fieldname": "print_style", | |||
"fieldtype": "Link", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_list_view": 1, | |||
"in_standard_filter": 0, | |||
"label": "Always add \"Draft\" Heading for printing draft documents", | |||
"label": "Print Style", | |||
"length": 0, | |||
"no_copy": 0, | |||
"options": "Print Style", | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -473,9 +474,8 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"description": "", | |||
"fieldname": "allow_print_for_cancelled", | |||
"fieldtype": "Check", | |||
"fieldname": "print_style_preview", | |||
"fieldtype": "HTML", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -483,11 +483,10 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Allow Print for Cancelled", | |||
"label": "Print Style Preview", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -504,8 +503,8 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "allow_page_break_inside_tables", | |||
"fieldtype": "Check", | |||
"fieldname": "section_break_8", | |||
"fieldtype": "Section Break", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -513,11 +512,10 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Allow page break inside tables", | |||
"label": "Fonts", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -534,8 +532,9 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "section_break_8", | |||
"fieldtype": "Section Break", | |||
"default": "Default", | |||
"fieldname": "font", | |||
"fieldtype": "Select", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -543,9 +542,12 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Font", | |||
"length": 0, | |||
"no_copy": 0, | |||
"options": "Default\nArial\nHelvetica\nVerdana\nMonospace", | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
@@ -562,8 +564,9 @@ | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "print_style_preview", | |||
"fieldtype": "HTML", | |||
"description": "In points. Default is 9.", | |||
"fieldname": "font_size", | |||
"fieldtype": "Float", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -571,7 +574,7 @@ | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Print Style Preview", | |||
"label": "Font Size", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
@@ -597,7 +600,7 @@ | |||
"issingle": 1, | |||
"istable": 0, | |||
"max_attachments": 0, | |||
"modified": "2017-05-03 05:58:55.562540", | |||
"modified": "2017-08-18 01:04:26.692081", | |||
"modified_by": "Administrator", | |||
"module": "Printing", | |||
"name": "Print Settings", | |||
@@ -0,0 +1,23 @@ | |||
/* eslint-disable */ | |||
// rename this file from _test_[name] to test_[name] to activate | |||
// and remove above this line | |||
QUnit.test("test: Print Settings", function (assert) { | |||
let done = assert.async(); | |||
// number of asserts | |||
assert.expect(1); | |||
frappe.run_serially([ | |||
// insert a new Print Settings | |||
() => frappe.tests.make('Print Settings', [ | |||
// values to be set | |||
{key: 'value'} | |||
]), | |||
() => { | |||
assert.equal(cur_frm.doc.key, 'value'); | |||
}, | |||
() => done() | |||
]); | |||
}); |
@@ -0,0 +1,10 @@ | |||
// Copyright (c) 2017, Frappe Technologies and contributors | |||
// For license information, please see license.txt | |||
frappe.ui.form.on('Print Style', { | |||
refresh: function(frm) { | |||
frm.add_custom_button(__('Print Settings'), () => { | |||
frappe.set_route('Form', 'Print Settings'); | |||
}) | |||
} | |||
}); |
@@ -0,0 +1,214 @@ | |||
{ | |||
"allow_copy": 0, | |||
"allow_guest_to_view": 0, | |||
"allow_import": 0, | |||
"allow_rename": 1, | |||
"autoname": "field:print_style_name", | |||
"beta": 0, | |||
"creation": "2017-08-17 01:25:56.910716", | |||
"custom": 0, | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
"document_type": "", | |||
"editable_grid": 1, | |||
"engine": "InnoDB", | |||
"fields": [ | |||
{ | |||
"allow_bulk_edit": 0, | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "print_style_name", | |||
"fieldtype": "Data", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Print Style Name", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
"remember_last_selected_value": 0, | |||
"report_hide": 0, | |||
"reqd": 1, | |||
"search_index": 0, | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_bulk_edit": 0, | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "disabled", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_global_search": 0, | |||
"in_list_view": 1, | |||
"in_standard_filter": 0, | |||
"label": "Disabled", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
"remember_last_selected_value": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0, | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_bulk_edit": 0, | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "standard", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Standard", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
"remember_last_selected_value": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0, | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_bulk_edit": 0, | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "css", | |||
"fieldtype": "Code", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "CSS", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
"remember_last_selected_value": 0, | |||
"report_hide": 0, | |||
"reqd": 1, | |||
"search_index": 0, | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_bulk_edit": 0, | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"columns": 0, | |||
"fieldname": "preview", | |||
"fieldtype": "Attach Image", | |||
"hidden": 1, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_global_search": 0, | |||
"in_list_view": 0, | |||
"in_standard_filter": 0, | |||
"label": "Preview", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
"remember_last_selected_value": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0, | |||
"set_only_once": 0, | |||
"unique": 0 | |||
} | |||
], | |||
"has_web_view": 0, | |||
"hide_heading": 0, | |||
"hide_toolbar": 0, | |||
"idx": 0, | |||
"image_field": "preview", | |||
"image_view": 0, | |||
"in_create": 0, | |||
"is_submittable": 0, | |||
"issingle": 0, | |||
"istable": 0, | |||
"max_attachments": 0, | |||
"modified": "2017-08-17 02:18:08.132853", | |||
"modified_by": "Administrator", | |||
"module": "Printing", | |||
"name": "Print Style", | |||
"name_case": "", | |||
"owner": "Administrator", | |||
"permissions": [ | |||
{ | |||
"amend": 0, | |||
"apply_user_permissions": 0, | |||
"cancel": 0, | |||
"create": 1, | |||
"delete": 1, | |||
"email": 1, | |||
"export": 1, | |||
"if_owner": 0, | |||
"import": 0, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"report": 1, | |||
"role": "System Manager", | |||
"set_user_permissions": 0, | |||
"share": 1, | |||
"submit": 0, | |||
"write": 1 | |||
} | |||
], | |||
"quick_entry": 0, | |||
"read_only": 0, | |||
"read_only_onload": 0, | |||
"show_name_in_global_search": 0, | |||
"sort_field": "modified", | |||
"sort_order": "DESC", | |||
"track_changes": 1, | |||
"track_seen": 0 | |||
} |
@@ -0,0 +1,23 @@ | |||
# -*- coding: utf-8 -*- | |||
# Copyright (c) 2017, Frappe Technologies and contributors | |||
# For license information, please see license.txt | |||
from __future__ import unicode_literals | |||
import frappe | |||
from frappe.model.document import Document | |||
class PrintStyle(Document): | |||
def validate(self): | |||
if (self.standard==1 | |||
and not frappe.local.conf.get("developer_mode") | |||
and not (frappe.flags.in_import or frappe.flags.in_test)): | |||
frappe.throw(frappe._("Standard Print Style cannot be changed. Please duplicate to edit.")) | |||
def on_update(self): | |||
self.export_doc() | |||
def export_doc(self): | |||
# export | |||
from frappe.modules.utils import export_module_json | |||
export_module_json(self, self.standard == 1, 'Printing') |
@@ -0,0 +1,20 @@ | |||
/* eslint-disable */ | |||
// rename this file from _test_[name] to test_[name] to activate | |||
// and remove above this line | |||
QUnit.test("test: Print Style", function (assert) { | |||
let done = assert.async(); | |||
// number of asserts | |||
assert.expect(1); | |||
frappe.run_serially([ | |||
// insert a new Print Style | |||
() => frappe.tests.make('Print Style', [ | |||
// values to be set | |||
{print_style_name: 'Test Print Style'}, | |||
{css: '/* some css value */'} | |||
]), | |||
]); | |||
}); |
@@ -0,0 +1,10 @@ | |||
# -*- coding: utf-8 -*- | |||
# Copyright (c) 2017, Frappe Technologies and Contributors | |||
# See license.txt | |||
from __future__ import unicode_literals | |||
import frappe | |||
import unittest | |||
class TestPrintStyle(unittest.TestCase): | |||
pass |
@@ -0,0 +1,15 @@ | |||
{ | |||
"creation": "2017-08-17 02:00:12.502887", | |||
"css": "/*\n\tcommon style for whole page\n\tThis should include:\n\t+ page size related settings\n\t+ font family settings\n\t+ line spacing settings\n*/\n.print-format div,\n.print-format span,\n.print-format td,\n.print-format h1,\n.print-format h2,\n.print-format h3,\n.print-format h4 {\n\tfont-family: Georgia, serif;\n}\n\n/* classic format: for-test */", | |||
"disabled": 0, | |||
"docstatus": 0, | |||
"doctype": "Print Style", | |||
"idx": 1, | |||
"modified": "2017-08-18 00:43:48.675833", | |||
"modified_by": "Administrator", | |||
"name": "Classic", | |||
"owner": "Administrator", | |||
"preview": "/assets/frappe/images/help/print-style-classic.png", | |||
"print_style_name": "Classic", | |||
"standard": 1 | |||
} |
@@ -0,0 +1,15 @@ | |||
{ | |||
"creation": "2017-08-17 02:16:58.060374", | |||
"css": ".print-heading {\n\ttext-align: right;\n\ttext-transform: uppercase;\n\tcolor: #666;\n\tpadding-bottom: 20px;\n\tmargin-bottom: 20px;\n\tborder-bottom: 1px solid #d1d8dd;\n}\n\n.print-heading h2 {\n\tfont-size: 24px;\n}\n\n.print-format th {\n\tbackground-color: #eee !important;\n\tborder-bottom: 0px !important;\n}\n\n/* modern format: for-test */", | |||
"disabled": 0, | |||
"docstatus": 0, | |||
"doctype": "Print Style", | |||
"idx": 0, | |||
"modified": "2017-08-18 00:44:07.438147", | |||
"modified_by": "Administrator", | |||
"name": "Modern", | |||
"owner": "Administrator", | |||
"preview": "/assets/frappe/images/help/print-style-modern.png", | |||
"print_style_name": "Modern", | |||
"standard": 1 | |||
} |
@@ -0,0 +1,15 @@ | |||
{ | |||
"creation": "2017-08-17 02:16:20.992989", | |||
"css": ".print-format * {\n\tcolor: #000 !important;\n}\n\n.print-format .alert {\n\tbackground-color: inherit;\n\tborder: 1px dashed #333;\n}\n\n.print-format .table-bordered,\n.print-format .table-bordered > thead > tr > th,\n.print-format .table-bordered > tbody > tr > th,\n.print-format .table-bordered > tfoot > tr > th,\n.print-format .table-bordered > thead > tr > td,\n.print-format .table-bordered > tbody > tr > td,\n.print-format .table-bordered > tfoot > tr > td {\n\tborder: 1px solid #333;\n}\n\n.print-format hr {\n\tborder-top: 1px solid #333;\n}\n\n.print-heading {\n\tborder-bottom: 2px solid #333;\n}\n", | |||
"disabled": 0, | |||
"docstatus": 0, | |||
"doctype": "Print Style", | |||
"idx": 0, | |||
"modified": "2017-08-18 00:44:25.023898", | |||
"modified_by": "Administrator", | |||
"name": "Monochrome", | |||
"owner": "Administrator", | |||
"preview": "/assets/frappe/images/help/print-style-monochrome.png", | |||
"print_style_name": "Monochrome", | |||
"standard": 1 | |||
} |
@@ -11,6 +11,12 @@ | |||
padding: 10px 0px; | |||
border-bottom: 1px solid #d1d8dd; | |||
} | |||
.print-toolbar > div { | |||
padding-right: 0px; | |||
} | |||
.print-toolbar > div:last-child { | |||
padding-right: 15px; | |||
} | |||
.form-inner-toolbar { | |||
padding: 10px 15px 0px; | |||
background-color: #fafbfc; | |||
@@ -588,7 +594,8 @@ select.form-control { | |||
.password-strength-message { | |||
margin-top: -10px; | |||
} | |||
.control-code { | |||
.control-code, | |||
.control-code.bold { | |||
height: 400px; | |||
font-family: Monaco, "Courier New", monospace; | |||
background-color: black; | |||
@@ -202,7 +202,7 @@ frappe.Application = Class.extend({ | |||
moment.tz.add(frappe.boot.timezone_info); | |||
} | |||
if(frappe.boot.print_css) { | |||
frappe.dom.set_style(frappe.boot.print_css) | |||
frappe.dom.set_style(frappe.boot.print_css, "print-style"); | |||
} | |||
frappe.user.name = frappe.boot.user.name; | |||
} else { | |||
@@ -93,6 +93,7 @@ frappe.dom = { | |||
se.appendChild(document.createTextNode(txt)); | |||
} | |||
document.getElementsByTagName('head')[0].appendChild(se); | |||
return se; | |||
}, | |||
add: function(parent, newtag, className, cs, innerHTML, onclick) { | |||
if(parent && parent.substr)parent = frappe.dom.by_id(parent); | |||
@@ -35,7 +35,7 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
this.print_sel = this.wrapper | |||
.find(".print-preview-select") | |||
.on("change", function () { | |||
me.multilingual_preview() | |||
me.multilingual_preview(); | |||
}); | |||
//On selection of language get code and pass it to preview method | |||
@@ -79,7 +79,7 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
}); | |||
this.wrapper.find(".btn-print-edit").on("click", function () { | |||
var print_format = me.get_print_format(); | |||
let print_format = me.get_print_format(); | |||
if (print_format && print_format.name) { | |||
if (print_format.print_format_builder) { | |||
frappe.set_route("print-format-builder", print_format.name); | |||
@@ -106,7 +106,8 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
this.lang_code = this.frm.doc.language; | |||
// Load all languages in the field | |||
this.language_sel.empty() | |||
.add_options(frappe.get_languages()) | |||
.add_options([{value:'', label:__("Select Language...")}] | |||
.concat(frappe.get_languages())) | |||
.val(this.lang_code); | |||
this.preview(); | |||
}, | |||
@@ -193,6 +194,7 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
this.print_formats = frappe.meta.get_print_formats(this.frm.doctype); | |||
return this.print_sel | |||
.empty().add_options(this.print_formats); | |||
}, | |||
with_old_style: function (opts) { | |||
frappe.require("/assets/js/print_format_v3.min.js", function () { | |||
@@ -3,7 +3,8 @@ | |||
<div class="col-xs-2"> | |||
<select class="print-preview-select input-sm form-control"></select></div> | |||
<div class="col-xs-2"> | |||
<select class="languages input-sm form-control"></select></div> | |||
<select class="languages input-sm form-control" | |||
placeholder="{{ __("Language") }}"></select></div> | |||
<div class="col-xs-2"> | |||
<div class="checkbox small" style="margin-top: 7px; margin-bottom: 0px;"> | |||
<label> | |||
@@ -16,8 +17,10 @@ | |||
<div class="btn-group"> | |||
<a class="btn-print-print btn-sm btn btn-default"> | |||
<strong>{%= __("Print") %}</strong></a> | |||
<a class="btn-sm btn btn-default" href="#Form/Print Settings"> | |||
{%= __("Settings...") %}</a> | |||
<a class="btn-print-edit btn-sm btn btn-default"> | |||
{%= __("Customize") %}</a> | |||
{%= __("Customize...") %}</a> | |||
<a class="btn-print-preview btn-sm btn btn-default"> | |||
{%= __("Full Page") %}</a> | |||
<a class="btn-download-pdf btn-sm btn btn-default"> | |||
@@ -108,6 +108,10 @@ frappe.views.ListRenderer = Class.extend({ | |||
add_field(this.meta.title_field); | |||
} | |||
if (this.meta.image_field) { | |||
add_field(this.meta.image_field); | |||
} | |||
// enabled / disabled | |||
if (frappe.meta.has_field(this.doctype, 'enabled')) { add_field('enabled'); } | |||
if (frappe.meta.has_field(this.doctype, 'disabled')) { add_field('disabled'); } | |||
@@ -14,6 +14,13 @@ | |||
margin: 0px; | |||
padding: 10px 0px; | |||
border-bottom: 1px solid @border-color; | |||
> div { | |||
padding-right: 0px; | |||
} | |||
> div:last-child { | |||
padding-right: 15px; | |||
} | |||
} | |||
.form-inner-toolbar { | |||
@@ -735,7 +742,7 @@ select.form-control { | |||
margin-top: -10px; | |||
} | |||
.control-code { | |||
.control-code, .control-code.bold { | |||
height: 400px; | |||
font-family: Monaco, "Courier New", monospace; | |||
background-color: black; | |||
@@ -61,8 +61,7 @@ data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}" | |||
{%- macro render_field_with_label(df, doc) -%} | |||
<div class="row {% if df.bold %}important{% endif %} data-field" {{ fieldmeta(df) }}> | |||
<div class="col-xs-{{ "9" if df.fieldtype=="Check" else "5" }} | |||
{%- if not doc._align_labels_left %} text-right{%- endif -%}"> | |||
<div class="col-xs-{{ "9" if df.fieldtype=="Check" else "5" }}"> | |||
{% if df.fieldtype not in ("Image","HTML","Check") and | |||
doc.get(df.fieldname) != None %} | |||
<label>{{ _(df.label) }}</label> | |||
@@ -1,16 +0,0 @@ | |||
/* | |||
common style for whole page | |||
This should include: | |||
+ page size related settings | |||
+ font family settings | |||
+ line spacing settings | |||
*/ | |||
.print-format div, | |||
.print-format span, | |||
.print-format td, | |||
.print-format h1, | |||
.print-format h2, | |||
.print-format h3, | |||
.print-format h4 { | |||
font-family: serif; | |||
} |
@@ -1,19 +0,0 @@ | |||
.print-heading { | |||
text-align: right; | |||
text-transform: uppercase; | |||
color: #666; | |||
padding-bottom: 20px; | |||
margin-bottom: 20px; | |||
border-bottom: 1px solid #d1d8dd; | |||
} | |||
.print-heading h2 { | |||
font-size: 24px; | |||
} | |||
.print-format th { | |||
background-color: #eee !important; | |||
border-bottom: 0px !important; | |||
} | |||
/* modern format: don't remove this line */ |
@@ -1,26 +0,0 @@ | |||
.print-format * { | |||
color: #000 !important; | |||
} | |||
.print-format .alert { | |||
background-color: inherit; | |||
border: 1px dashed #333; | |||
} | |||
.print-format .table-bordered, | |||
.print-format .table-bordered > thead > tr > th, | |||
.print-format .table-bordered > tbody > tr > th, | |||
.print-format .table-bordered > tfoot > tr > th, | |||
.print-format .table-bordered > thead > tr > td, | |||
.print-format .table-bordered > tbody > tr > td, | |||
.print-format .table-bordered > tfoot > tr > td { | |||
border: 1px solid #333; | |||
} | |||
.print-format hr { | |||
border-top: 1px solid #333; | |||
} | |||
.print-heading { | |||
border-bottom: 2px solid #333; | |||
} |
@@ -279,7 +279,8 @@ def render_403(e, pathname): | |||
frappe.local.response['context'] = dict( | |||
indicator_color = 'red', | |||
primary_action = '/login', | |||
primary_label = _('Login') | |||
primary_label = _('Login'), | |||
fullpage=True | |||
) | |||
return render_page("message"), e.http_status_code | |||
@@ -3,6 +3,18 @@ | |||
{%- block title -%}{{_("Not Found")}}{%- endblock -%} | |||
{% block page_content %} | |||
<style> | |||
.hero-and-content { | |||
background-color: #f5f7fa; | |||
} | |||
header, footer { | |||
display: none; | |||
} | |||
html, body { | |||
background-color: #f5f7fa; | |||
} | |||
</style> | |||
<div class='page-card'> | |||
<div class='page-card-head'> | |||
<span class='indicator darkgrey'>{{_("Page Missing or Moved")}}</span> | |||
@@ -7,7 +7,6 @@ import frappe, os, copy, json, re | |||
from frappe import _ | |||
from frappe.modules import get_doc_path | |||
from jinja2 import TemplateNotFound | |||
from frappe.utils import cint, strip_html | |||
from markdown2 import markdown | |||
from six import string_types | |||
@@ -173,7 +172,7 @@ def convert_markdown(doc, meta): | |||
@frappe.whitelist() | |||
def get_html_and_style(doc, name=None, print_format=None, meta=None, | |||
no_letterhead=None, trigger_print=False): | |||
no_letterhead=None, trigger_print=False, style=None): | |||
"""Returns `html` and `style` of print format, used in PDF etc""" | |||
if isinstance(doc, string_types) and isinstance(name, string_types): | |||
@@ -186,7 +185,7 @@ def get_html_and_style(doc, name=None, print_format=None, meta=None, | |||
return { | |||
"html": get_html(doc, name=name, print_format=print_format, meta=meta, | |||
no_letterhead=no_letterhead, trigger_print=trigger_print), | |||
"style": get_print_style(print_format=print_format) | |||
"style": get_print_style(style=style, print_format=print_format) | |||
} | |||
def validate_print_permission(doc): | |||
@@ -349,7 +348,7 @@ def get_print_style(style=None, print_format=None, for_legacy=False): | |||
print_settings = frappe.get_doc("Print Settings") | |||
if not style: | |||
style = print_settings.print_style or "Standard" | |||
style = print_settings.print_style or '' | |||
context = { | |||
"print_settings": print_settings, | |||
@@ -359,10 +358,8 @@ def get_print_style(style=None, print_format=None, for_legacy=False): | |||
css = frappe.get_template("templates/styles/standard.css").render(context) | |||
try: | |||
css += frappe.get_template("templates/styles/" + style.lower() + ".css").render(context) | |||
except TemplateNotFound: | |||
pass | |||
if style and frappe.db.exists('Print Style', style): | |||
css = css + '\n' + frappe.db.get_value('Print Style', style, 'css') | |||
# move @import to top | |||
for at_import in list(set(re.findall("(@import url\([^\)]+\)[;]?)", css))): | |||