def add_sidebar_and_breadcrumbs(context): '''Add sidebar and breadcrumbs to context''' from frappe.website.router import get_page_info_from_template if context.show_sidebar: context.no_cache = 1 add_sidebar_data(context) else: if context.basepath: sidebar_json_path = os.path.join(context.basepath, '_sidebar.json') if os.path.exists(sidebar_json_path): with open(sidebar_json_path, 'r') as sidebarfile: context.sidebar_items = json.loads(sidebarfile.read()) context.show_sidebar = 1 if context.add_breadcrumbs and not context.parents: if context.basepath: parent_path = os.path.dirname(context.path).rstrip('/') page_info = get_page_info_from_template(parent_path) if page_info: context.parents = [dict(route=parent_path, title=page_info.title)]
def add_sidebar_and_breadcrumbs(context): '''Add sidebar and breadcrumbs to context''' from frappe.website.router import get_page_info_from_template if context.show_sidebar: context.no_cache = 1 add_sidebar_data(context) else: if context.basepath: sidebar_json_path = os.path.join(context.basepath, '_sidebar.json') if os.path.exists(sidebar_json_path): with open(sidebar_json_path, 'r') as sidebarfile: context.sidebar_items = json.loads(sidebarfile.read()) context.show_sidebar = 1 if context.add_breadcrumbs and not context.parents: if context.basepath: parent_path = os.path.dirname(context.path).rstrip('/') page_info = get_page_info_from_template(parent_path) if page_info: context.parents = [ dict(route=parent_path, title=page_info.title) ]
def add_sidebar_and_breadcrumbs(context): '''Add sidebar and breadcrumbs to context''' from frappe.website.router import get_page_info_from_template if context.show_sidebar: context.no_cache = 1 add_sidebar_data(context) else: if context.basepath: hooks = frappe.get_hooks('look_for_sidebar_json') look_for_sidebar_json = hooks[0] if hooks else 0 sidebar_json_path = get_sidebar_json_path( context.basepath, look_for_sidebar_json ) if sidebar_json_path: load_sidebar(context, sidebar_json_path) if context.add_breadcrumbs and not context.parents: if context.basepath: parent_path = os.path.dirname(context.path).rstrip('/') page_info = get_page_info_from_template(parent_path) if page_info: context.parents = [dict(route=parent_path, title=page_info.title)]
def add_sidebar_and_breadcrumbs(context): '''Add sidebar and breadcrumbs to context''' from frappe.website.router import get_page_info_from_template if context.show_sidebar: context.no_cache = 1 add_sidebar_data(context) else: if context.basepath: hooks = frappe.get_hooks('look_for_sidebar_json') look_for_sidebar_json = hooks[0] if hooks else 0 sidebar_json_path = get_sidebar_json_path(context.basepath, look_for_sidebar_json) if sidebar_json_path: load_sidebar(context, sidebar_json_path) if context.add_breadcrumbs and not context.parents: if context.basepath: parent_path = os.path.dirname(context.path).rstrip('/') page_info = get_page_info_from_template(parent_path) if page_info: context.parents = [ dict(route=parent_path, title=page_info.title) ]