mirror of
https://github.com/logos-co/open-law.git
synced 2025-01-27 23:25:54 +00:00
Merge pull request #36 from Simple2B/svyat/fix/breadcrumbs
fix breadcrumbs links
This commit is contained in:
commit
f5d72db39b
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,3 +9,4 @@ node_modules/
|
|||||||
.env
|
.env
|
||||||
*.pyc
|
*.pyc
|
||||||
/*.sqlite3
|
/*.sqlite3
|
||||||
|
.DS_Store
|
17
.vscode/settings.json
vendored
17
.vscode/settings.json
vendored
@ -26,8 +26,19 @@
|
|||||||
"wsgi",
|
"wsgi",
|
||||||
"wtforms"
|
"wtforms"
|
||||||
],
|
],
|
||||||
"python.testing.unittestArgs": ["-v", "-s", "./tests", "-p", "*test.py"],
|
"python.testing.unittestArgs": [
|
||||||
|
"-v",
|
||||||
|
"-s",
|
||||||
|
"./tests",
|
||||||
|
"-p",
|
||||||
|
"*test.py"
|
||||||
|
],
|
||||||
"python.testing.pytestEnabled": true,
|
"python.testing.pytestEnabled": true,
|
||||||
"python.testing.unittestEnabled": false,
|
"python.testing.unittestEnabled": false,
|
||||||
"python.testing.pytestArgs": ["tests"]
|
"python.testing.pytestArgs": [
|
||||||
}
|
"tests"
|
||||||
|
],
|
||||||
|
"[python]": {
|
||||||
|
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||||
|
}
|
||||||
|
}
|
@ -52,24 +52,23 @@ def create_breadcrumbs(
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
for collection_id in collection_path:
|
for index, collection_id in enumerate(collection_path):
|
||||||
if collection_id is None:
|
if collection_id is None:
|
||||||
continue
|
continue
|
||||||
collection: m.Collection = db.session.get(m.Collection, collection_id)
|
collection: m.Collection = db.session.get(m.Collection, collection_id)
|
||||||
crumples += [
|
if index == 0:
|
||||||
s.BreadCrumb(
|
crumples += [
|
||||||
type=s.BreadCrumbType.Collection,
|
s.BreadCrumb(
|
||||||
url=url_for(
|
type=s.BreadCrumbType.Collection,
|
||||||
"book.sub_collection_view",
|
url=url_for(
|
||||||
book_id=book_id,
|
"book.sub_collection_view",
|
||||||
collection_id=collection_id,
|
book_id=book_id,
|
||||||
),
|
collection_id=collection_id,
|
||||||
label=collection.label,
|
),
|
||||||
)
|
label=collection.label,
|
||||||
]
|
)
|
||||||
if section_id and collection_path:
|
]
|
||||||
section: m.Section = db.session.get(m.Section, section_id)
|
elif index == 1:
|
||||||
if len(collection_path) == 2:
|
|
||||||
crumples += [
|
crumples += [
|
||||||
s.BreadCrumb(
|
s.BreadCrumb(
|
||||||
type=s.BreadCrumbType.Section,
|
type=s.BreadCrumbType.Section,
|
||||||
@ -79,53 +78,46 @@ def create_breadcrumbs(
|
|||||||
collection_id=collection_path[0],
|
collection_id=collection_path[0],
|
||||||
sub_collection_id=collection_path[-1],
|
sub_collection_id=collection_path[-1],
|
||||||
),
|
),
|
||||||
label=section.label,
|
label=collection.label,
|
||||||
)
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
crumples += [
|
|
||||||
s.BreadCrumb(
|
|
||||||
type=s.BreadCrumbType.Section,
|
|
||||||
url=url_for(
|
|
||||||
"book.section_view",
|
|
||||||
book_id=book_id,
|
|
||||||
collection_id=collection_path[0],
|
|
||||||
sub_collection_id=collection_path[0],
|
|
||||||
),
|
|
||||||
label=section.label,
|
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if section_id and collection_path:
|
||||||
|
section: m.Section = db.session.get(m.Section, section_id)
|
||||||
|
crumples += [
|
||||||
|
s.BreadCrumb(
|
||||||
|
type=s.BreadCrumbType.Section,
|
||||||
|
url=url_for(
|
||||||
|
"book.interpretation_view",
|
||||||
|
book_id=book_id,
|
||||||
|
collection_id=collection_path[0],
|
||||||
|
sub_collection_id=collection_path[-1]
|
||||||
|
if len(collection_path) == 2
|
||||||
|
else collection_path[0],
|
||||||
|
section_id=section_id,
|
||||||
|
),
|
||||||
|
label=section.label,
|
||||||
|
)
|
||||||
|
]
|
||||||
if interpretation_id:
|
if interpretation_id:
|
||||||
interpretation: m.Interpretation = db.session.get(
|
interpretation: m.Interpretation = db.session.get(
|
||||||
m.Interpretation, interpretation_id
|
m.Interpretation, interpretation_id
|
||||||
)
|
)
|
||||||
if len(collection_path) == 2:
|
crumples += [
|
||||||
crumples += [
|
s.BreadCrumb(
|
||||||
s.BreadCrumb(
|
type=s.BreadCrumbType.Interpretation,
|
||||||
type=s.BreadCrumbType.Interpretation,
|
url=url_for(
|
||||||
url=url_for(
|
"book.qa_view",
|
||||||
"book.interpretation_view",
|
book_id=book_id,
|
||||||
book_id=book_id,
|
collection_id=collection_path[0],
|
||||||
collection_id=collection_path[0],
|
sub_collection_id=collection_path[-1]
|
||||||
sub_collection_id=collection_path[-1],
|
if len(collection_path) == 2
|
||||||
section_id=section_id,
|
else collection_path[0],
|
||||||
),
|
section_id=section_id,
|
||||||
label=interpretation.label,
|
interpretation_id=interpretation_id,
|
||||||
)
|
),
|
||||||
]
|
label=interpretation.label,
|
||||||
else:
|
)
|
||||||
crumples += [
|
]
|
||||||
s.BreadCrumb(
|
|
||||||
type=s.BreadCrumbType.Interpretation,
|
|
||||||
url=url_for(
|
|
||||||
"book.interpretation_view",
|
|
||||||
book_id=book_id,
|
|
||||||
collection_id=collection_path[0],
|
|
||||||
sub_collection_id=collection_path[0],
|
|
||||||
section_id=section_id,
|
|
||||||
),
|
|
||||||
label=interpretation.label,
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|
||||||
return crumples
|
return crumples
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% for breadcrumb in breadcrumbs %}
|
{% for breadcrumb in breadcrumbs %}
|
||||||
<li class="inline-flex items-center">
|
<li class="inline-flex items-center">
|
||||||
{% if not loop.index==breadcrumbs|length %}
|
{% if not loop.index==breadcrumbs|length %}
|
||||||
<a href="{{ breadcrumb.url }}" class="inline-flex items-center text-sm truncate w-24 font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
<a href="{{ breadcrumb.url }}" class="inline-flex items-center text-sm truncate w-30 font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="inline-flex items-center text-sm truncate w-40 font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
<span class="inline-flex items-center text-sm truncate w-40 font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex-shrink-0 w-4 h-4 mr-2 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" /> </svg>
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex-shrink-0 w-4 h-4 mr-2 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" /> </svg>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
<span class="truncate">{{ breadcrumb.label }}</span>
|
<span class="truncate select-none">{{ breadcrumb.label }}</span>
|
||||||
{% if not loop.index==breadcrumbs|length %}
|
{% if not loop.index==breadcrumbs|length %}
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user