Skip to content

Commit 49ef0b4

Browse files
committed
Fix right pane breadcrumb system
Signed-off-by: tdruez <[email protected]>
1 parent 4880880 commit 49ef0b4

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

scanpipe/templates/scanpipe/resource_detail.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
{% include 'scanpipe/includes/breadcrumb_detail_view.html' with template_title="scanpipe/includes/resource_path_links.html" url_name="project_resources" %}
1616
<div class="mx-5">
1717
{% block partial-content %}
18+
{% if request.htmx %}
19+
{% include 'scanpipe/tree/resource_path_breadcrumb.html' %}
20+
{% endif %}
1821
{% include 'scanpipe/tabset/tabset.html' %}
1922
{% endblock %}
2023
</div>

scanpipe/templates/scanpipe/tree/resource_left_pane_tree.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
data-file
2929
data-path="{{ node.path }}"
3030
hx-get="{% url 'resource_detail' project.slug node.path %}"
31-
hx-target="#right-pane-content"
31+
hx-target="#right-pane"
3232
hx-push-url="{% url 'project_resource_tree' project.slug %}?path={{ node.path }}">
3333
<span class="icon is-small mr-2">
3434
<i class="far fa-file"></i>

scanpipe/templates/scanpipe/tree/resource_path_breadcrumb.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% if path_segments %}
12
<nav class="breadcrumb is-flex is-align-items-center" aria-label="breadcrumbs">
23
<button
34
id="expand-left-pane"
@@ -29,9 +30,8 @@
2930
{% endif %}
3031
{% endfor %}
3132
</ul>
32-
{% if path_segments %}
33-
<button class="button is-white copy-to-clipboard p-2" aria-label="Copy path" data-copy="{{ path }}" data-copy-feedback="Path copied!">
34-
<i class="fa-regular fa-clone"></i>
35-
</button>
36-
{% endif %}
37-
</nav>
33+
<button class="button is-white copy-to-clipboard p-2" aria-label="Copy path" data-copy="{{ path }}" data-copy-feedback="Path copied!">
34+
<i class="fa-regular fa-clone"></i>
35+
</button>
36+
</nav>
37+
{% endif %}

scanpipe/templates/scanpipe/tree/resource_table.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<a
5353
href="{% url 'resource_detail' project.slug resource.path %}"
5454
hx-get="{% url 'resource_detail' project.slug resource.path %}"
55-
hx-target="#right-pane-content"
55+
hx-target="#right-pane"
5656
hx-push-url="{% url 'project_resource_tree' project.slug %}?path={{ resource.path }}">
5757
{{ resource.name }}
5858
</a>

scanpipe/views.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,12 @@ def get_context_data(self, **kwargs):
21602160
matched_snippet_annotations = self.get_matched_snippet_annotations(resource)
21612161
context["detected_values"]["matched snippets"] = matched_snippet_annotations
21622162

2163+
# Compatibility with ProjectResourceTreeTableView
2164+
segments = resource.path.strip("/").split("/")
2165+
context["path_segments"] = [
2166+
("/".join(segments[: i + 1]), segment) for i, segment in enumerate(segments)
2167+
]
2168+
21632169
return context
21642170

21652171

@@ -2788,6 +2794,7 @@ def get_context_data(self, **kwargs):
27882794
context = super().get_context_data(**kwargs)
27892795
path = self.request.GET.get("path", "")
27902796
context["path"] = path
2797+
27912798
segments = path.strip("/").split("/")
27922799
context["path_segments"] = [
27932800
("/".join(segments[: i + 1]), segment) for i, segment in enumerate(segments)

0 commit comments

Comments
 (0)