@@ -150,13 +150,13 @@ def handle_exception(e): | |||
elif http_status_code==403: | |||
frappe.respond_as_web_page(_("Not Permitted"), | |||
_("You do not have enough permissions to complete the action"), | |||
http_status_code=http_status_code, indicator_color='red') | |||
http_status_code=http_status_code, indicator_color='red', fullpage=True) | |||
return_as_message = True | |||
elif http_status_code==404: | |||
frappe.respond_as_web_page(_("Not Found"), | |||
_("The resource you are looking for is not available"), | |||
http_status_code=http_status_code, indicator_color='red') | |||
http_status_code=http_status_code, indicator_color='red', fullpage=True) | |||
return_as_message = True | |||
else: | |||
@@ -166,7 +166,7 @@ def handle_exception(e): | |||
frappe.respond_as_web_page("Server Error", | |||
traceback, http_status_code=http_status_code, | |||
indicator_color='red') | |||
indicator_color='red', fullpage=True) | |||
return_as_message = True | |||
if e.__class__ == frappe.AuthenticationError: | |||
@@ -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, fullpage=True) | |||
return response | |||
@@ -236,6 +236,8 @@ def load_print(bootinfo, doclist): | |||
print_settings.doctype = ":Print Settings" | |||
doclist.append(print_settings) | |||
load_print_css(bootinfo, print_settings) | |||
doclist.extend(frappe.get_all('Print Style', 'name', | |||
dict(disabled=0), update=dict(doctype=':Print Style'))) | |||
def load_print_css(bootinfo, print_settings): | |||
import frappe.www.printview | |||
@@ -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; | |||
} |
@@ -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 | |||
@@ -260,7 +260,7 @@ | |||
"columns": 0, | |||
"default": "Modern", | |||
"fieldname": "print_style", | |||
"fieldtype": "Select", | |||
"fieldtype": "Link", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
@@ -271,7 +271,7 @@ | |||
"label": "Print Style", | |||
"length": 0, | |||
"no_copy": 0, | |||
"options": "Modern\nClassic\nStandard\nMonochrome", | |||
"options": "Print Style", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
@@ -597,7 +597,7 @@ | |||
"issingle": 1, | |||
"istable": 0, | |||
"max_attachments": 0, | |||
"modified": "2017-05-03 05:58:55.562540", | |||
"modified": "2017-08-17 02:15:55.025352", | |||
"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,8 @@ | |||
// Copyright (c) 2017, Frappe Technologies and contributors | |||
// For license information, please see license.txt | |||
frappe.ui.form.on('Print Style', { | |||
refresh: function(frm) { | |||
} | |||
}); |
@@ -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,23 @@ | |||
/* 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 | |||
{key: 'value'} | |||
]), | |||
() => { | |||
assert.equal(cur_frm.doc.key, 'value'); | |||
}, | |||
() => done() | |||
]); | |||
}); |
@@ -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,14 @@ | |||
{ | |||
"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", | |||
"disabled": 0, | |||
"docstatus": 0, | |||
"doctype": "Print Style", | |||
"idx": 1, | |||
"modified": "2017-08-17 05:02:24.128436", | |||
"modified_by": "Administrator", | |||
"name": "Classic", | |||
"owner": "Administrator", | |||
"print_style_name": "Classic", | |||
"standard": 1 | |||
} |
@@ -0,0 +1,14 @@ | |||
{ | |||
"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: don't remove this line */", | |||
"disabled": 0, | |||
"docstatus": 0, | |||
"doctype": "Print Style", | |||
"idx": 0, | |||
"modified": "2017-08-17 05:02:05.043839", | |||
"modified_by": "Administrator", | |||
"name": "Modern", | |||
"owner": "Administrator", | |||
"print_style_name": "Modern", | |||
"standard": 1 | |||
} |
@@ -0,0 +1,14 @@ | |||
{ | |||
"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-17 05:02:14.874082", | |||
"modified_by": "Administrator", | |||
"name": "Monochrome", | |||
"owner": "Administrator", | |||
"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; | |||
@@ -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,13 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
this.print_sel = this.wrapper | |||
.find(".print-preview-select") | |||
.on("change", function () { | |||
me.multilingual_preview() | |||
me.multilingual_preview(); | |||
}); | |||
this.print_style_select = this.wrapper | |||
.find('.print-style-select') | |||
.on("change", function () { | |||
me.multilingual_preview(); | |||
}); | |||
//On selection of language get code and pass it to preview method | |||
@@ -64,11 +70,13 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
this.wrapper.find(".btn-download-pdf").click(function () { | |||
if (!me.is_old_style()) { | |||
let print_style = me.selected_style(); | |||
var w = window.open( | |||
frappe.urllib.get_full_url("/api/method/frappe.utils.print_format.download_pdf?" | |||
+ "doctype=" + encodeURIComponent(me.frm.doc.doctype) | |||
+ "&name=" + encodeURIComponent(me.frm.doc.name) | |||
+ "&format=" + me.selected_format() | |||
+ (print_style ? '&style=' + print_style : '') | |||
+ "&no_letterhead=" + (me.with_letterhead() ? "0" : "1") | |||
+ (me.lang_code ? ("&_lang=" + me.lang_code) : "")) | |||
); | |||
@@ -79,7 +87,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); | |||
@@ -147,11 +155,13 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
}, | |||
new_page_preview: function (printit) { | |||
var me = this; | |||
let print_style = me.selected_style(); | |||
var w = window.open(frappe.urllib.get_full_url("/printview?" | |||
+ "doctype=" + encodeURIComponent(me.frm.doc.doctype) | |||
+ "&name=" + encodeURIComponent(me.frm.doc.name) | |||
+ (printit ? "&trigger_print=1" : "") | |||
+ "&format=" + me.selected_format() | |||
+ (print_style ? '&style=' + print_style : '') | |||
+ "&no_letterhead=" + (me.with_letterhead() ? "0" : "1") | |||
+ (me.lang_code ? ("&_lang=" + me.lang_code) : ""))); | |||
if (!w) { | |||
@@ -164,6 +174,7 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
args: { | |||
doc: this.frm.doc, | |||
print_format: this.selected_format(), | |||
style: this.selected_style(), | |||
no_letterhead: !this.with_letterhead() ? 1 : 0, | |||
_lang: this.lang_code | |||
}, | |||
@@ -191,8 +202,11 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
}, | |||
refresh_print_options: function () { | |||
this.print_formats = frappe.meta.get_print_formats(this.frm.doctype); | |||
this.print_style_select.empty() | |||
.add_options([''].concat(Object.keys(locals[':Print Style'] || {}).sort())); | |||
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 () { | |||
@@ -215,6 +229,9 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
selected_format: function () { | |||
return this.print_sel.val() || this.frm.meta.default_print_format || "Standard"; | |||
}, | |||
selected_style: function () { | |||
return this.print_style_select.val() || ''; | |||
}, | |||
is_old_style: function (format) { | |||
return this.get_print_format(format).print_format_type === "Client"; | |||
}, | |||
@@ -233,6 +250,8 @@ frappe.ui.form.PrintPreview = Class.extend({ | |||
return this.print_letterhead.is(":checked") ? 1 : 0; | |||
}, | |||
set_style: function (style) { | |||
$('#print-style').remove(); | |||
console.log(style || frappe.boot.print_css); | |||
frappe.dom.set_style(style || frappe.boot.print_css, "print-style"); | |||
} | |||
}); | |||
@@ -2,6 +2,8 @@ | |||
<div class="print-toolbar row"> | |||
<div class="col-xs-2"> | |||
<select class="print-preview-select input-sm form-control"></select></div> | |||
<div class="col-xs-2"> | |||
<select class="print-style-select input-sm form-control"></select></div> | |||
<div class="col-xs-2"> | |||
<select class="languages input-sm form-control"></select></div> | |||
<div class="col-xs-2"> | |||
@@ -11,7 +13,7 @@ | |||
{%= __("Letter Head") %}</label> | |||
</div> | |||
</div> | |||
<div class="col-xs-6 text-right"> | |||
<div class="col-xs-4 text-right"> | |||
<!-- <a class="close btn-print-close" style="margin-top: 2px; margin-left: 10px;">×</a> --> | |||
<div class="btn-group"> | |||
<a class="btn-print-print btn-sm btn btn-default"> | |||
@@ -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; | |||
@@ -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))): | |||