Преглед на файлове

Breadcrumbs management (#3588)

version-14
Britlog преди 8 години
committed by Rushabh Mehta
родител
ревизия
242317c8d4
променени са 4 файла, в които са добавени 69 реда и са изтрити 16 реда
  1. +5
    -12
      frappe/templates/includes/breadcrumbs.html
  2. +1
    -1
      frappe/website/doctype/web_form/web_form.py
  3. +59
    -2
      frappe/website/doctype/web_page/web_page.json
  4. +4
    -1
      frappe/website/doctype/web_page/web_page.py

+ 5
- 12
frappe/templates/includes/breadcrumbs.html Целия файл

@@ -1,15 +1,8 @@
{% if parents and parents|length > 0 and (parents[-1].route) %}
<ul class="breadcrumb">
<li>
<span class="fa fa-angle-left"></span>
<a href="{{ url_prefix }}{{ parents[-1].route | abs_url }}">
{{ _(parents[-1].title) or _(parents[-1].label) or "" }}</a>
</li>
{#
<!-- {% for parent in parents %}
<li><a href="{{ parent.name }}">{{ parent.page_title or parent.title or "" }}</a></li>
{% if parents and parents|length > 0 %}
<ul class="breadcrumb" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
{% for parent in parents %}
<li><a href="{{ parent.route | abs_url }}" itemprop="url"><span itemprop="title">{{ parent.name or parent.label or "" }}</span></a></li>
{% endfor %}
<li class="active">{{ title or "" }}</li> -->
#}
<li class="active"><span itemprop="title">{{ title or "" }}</span></li>
</ul>
{% endif %}

+ 1
- 1
frappe/website/doctype/web_form/web_form.py Целия файл

@@ -175,7 +175,7 @@ def get_context(context):
'''Load document `doc` and `layout` properties for template'''
if frappe.form_dict.name or frappe.form_dict.new:
context.layout = self.get_layout()
context.parents = [{"route": self.route, "title": self.title }]
context.parents = [{"route": self.route, "label": _(self.title) }]

if frappe.form_dict.name:
context.doc = frappe.get_doc(self.doc_type, frappe.form_dict.name)


+ 59
- 2
frappe/website/doctype/web_page/web_page.json Целия файл

@@ -13,6 +13,7 @@
"editable_grid": 0,
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -41,6 +42,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -53,7 +55,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 1,
"in_list_view": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Title",
"length": 0,
@@ -70,6 +72,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -99,6 +102,7 @@
"unique": 1
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -129,6 +133,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -157,6 +162,7 @@
"width": "50%"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -185,6 +191,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -215,6 +222,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -244,6 +252,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -273,6 +282,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
@@ -301,6 +311,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -330,6 +341,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -360,6 +372,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
@@ -388,6 +401,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -416,6 +430,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -445,6 +460,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -475,6 +491,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -504,6 +521,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
@@ -533,6 +551,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -562,6 +581,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -592,6 +612,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -620,6 +641,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -648,6 +670,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -677,6 +700,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
@@ -707,6 +731,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -736,6 +761,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -763,6 +789,37 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "List as [{\"label\": _(\"Jobs\"), \"route\":\"jobs\"}]",
"fieldname": "breadcrumbs",
"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": "Breadcrumbs",
"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": 1,
@@ -777,7 +834,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 20,
"modified": "2017-03-24 00:34:48.586231",
"modified": "2017-06-29 23:01:00.126453",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Page",


+ 4
- 1
frappe/website/doctype/web_page/web_page.py Целия файл

@@ -11,6 +11,7 @@ from frappe.website.doctype.website_slideshow.website_slideshow import get_slide
from frappe.website.utils import find_first_image, get_comment_list, extract_title
from frappe.utils.jinja import render_template
from jinja2.exceptions import TemplateSyntaxError
from frappe import _

class WebPage(WebsiteGenerator):
def get_feed(self):
@@ -66,7 +67,9 @@ class WebPage(WebsiteGenerator):
raise

def set_breadcrumbs(self, context):
"""Build breadcrumbs template (deprecated)"""
"""Build breadcrumbs template """
if self.breadcrumbs:
context.parents = frappe.safe_eval(self.breadcrumbs, { "_": _ })
if not "no_breadcrumbs" in context:
if "<!-- no-breadcrumbs -->" in context.main_section:
context.no_breadcrumbs = 1


Зареждане…
Отказ
Запис