Kaynağa Gözat

[enhancement] jinja in desk page

version-14
Rushabh Mehta 9 yıl önce
ebeveyn
işleme
75c78073ce
2 değiştirilmiş dosya ile 13 ekleme ve 1 silme
  1. +12
    -0
      frappe/core/doctype/page/page.py
  2. +1
    -1
      frappe/public/js/frappe/ui/page.js

+ 12
- 0
frappe/core/doctype/page/page.py Dosyayı Görüntüle

@@ -106,6 +106,18 @@ class Page(Document):
if fname.endswith(".html"):
with open(os.path.join(path, fname), 'r') as f:
template = unicode(f.read(), "utf-8")
if "<!-- jinja -->" in template:
context = {}
try:
context = frappe.get_attr("{app}.{module}.page.{page}.{page}.get_context".format(
app = frappe.local.module_app[scrub(self.module)],
module = scrub(self.module),
page = page_name
))(context)
except (AttributeError, ImportError):
pass

template = frappe.render_template(template, context)
self.script = html_to_js_template(fname, template) + self.script

if frappe.lang != 'en':


+ 1
- 1
frappe/public/js/frappe/ui/page.js Dosyayı Görüntüle

@@ -68,7 +68,7 @@ frappe.ui.Page = Class.extend({
if(this.icon)
this.get_main_icon(this.icon);

this.main = this.wrapper.find(".layout-main-section");
this.body = this.main = this.wrapper.find(".layout-main-section");
this.sidebar = this.wrapper.find(".layout-side-section");
this.footer = this.wrapper.find(".layout-footer");
this.indicator = this.wrapper.find(".indicator");


Yükleniyor…
İptal
Kaydet