fix: Added has_rtl function on client side

This commit is contained in:
shariquerik 2021-02-07 12:42:06 +05:30
parent f180abf66d
commit e992e638f9
2 changed files with 6 additions and 3 deletions

View file

@ -362,6 +362,10 @@ frappe.ui.form.PrintView = class {
this.lang_code = this.language_sel.val();
}
has_rtl(){
return ["ar", "he", "fa"].includes(this.lang_code);
}
get_language_options() {
return frappe.get_languages();
}
@ -412,7 +416,7 @@ frappe.ui.form.PrintView = class {
<link href="${frappe.urllib.get_base_url()}/assets/css/printview.css" rel="stylesheet">`
);
if (out.has_rtl){
if (this.has_rtl()){
this.$print_format_body.find('head').append(
`<link type="text/css" rel="stylesheet" href="${frappe.urllib.get_base_url()}/assets/css/frappe-rtl.css"></link>`
);

View file

@ -204,8 +204,7 @@ def get_html_and_style(doc, name=None, print_format=None, meta=None,
return {
"html": html,
"style": get_print_style(style=style, print_format=print_format),
"has_rtl": True if frappe.local.lang in ["ar", "he", "fa"] else False
"style": get_print_style(style=style, print_format=print_format)
}
@frappe.whitelist()