Skip to content

Commit be72ae2

Browse files
committed
Refactor the path breadcrumb as a nav in its own template
Signed-off-by: tdruez <[email protected]>
1 parent d86661f commit be72ae2

File tree

4 files changed

+36
-31
lines changed

4 files changed

+36
-31
lines changed

scancodeio/static/main.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
--bulma-title-size: 1.5rem;
7070
color: var(--bulma-title-color);
7171
}
72+
.breadcrumb {
73+
--bulma-breadcrumb-item-separator-color: var(--bulma-text);
74+
}
7275
.heading {
7376
font-size: var(--bulma-size-medium);
7477
font-weight: var(--bulma-weight-semibold);

scanpipe/templates/scanpipe/tree/resource_left_pane_tree.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
{% endif %}
3939
</li>
4040
{% endfor %}
41-
</ul>
41+
</ul>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<nav class="breadcrumb is-flex is-align-items-center" aria-label="breadcrumbs">
2+
<ul>
3+
{% for subpath, segment in path_segments %}
4+
{% if not forloop.last %}
5+
<li>
6+
<a
7+
href="{% url 'project_resource_tree' project.slug %}?path={{ subpath }}"
8+
class="expand-in-tree"
9+
data-path="{{ subpath }}"
10+
hx-get="{% url 'project_resource_tree_table' project.slug %}?path={{ subpath }}"
11+
hx-target="#right-pane"
12+
hx-push-url="{% url 'project_resource_tree' project.slug %}?path={{ subpath }}">
13+
{{ segment }}
14+
</a>
15+
</li>
16+
{% else %}
17+
<li class="is-active">
18+
<a href="#" class="has-text-dark" aria-current="page">
19+
{{ segment }}
20+
</a>
21+
</li>
22+
{% endif %}
23+
{% endfor %}
24+
</ul>
25+
{% if path_segments %}
26+
<button class="button is-white copy-to-clipboard ml-1 p-2" aria-label="Copy path" data-copy="{{ path }}" data-copy-feedback="Path copied!">
27+
<i class="fa-regular fa-clone"></i>
28+
</button>
29+
{% endif %}
30+
</nav>

scanpipe/templates/scanpipe/tree/resource_right_pane_table.html

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
11
{% load humanize %}
2-
<div id="right-pane-header" class="mb-4">
3-
<div class="has-text-weight-semibold is-flex is-align-items-center">
4-
{% if path_segments %}
5-
<span id="resource-path" class="has-text-weight-medium">
6-
{% spaceless %}
7-
{% for subpath, segment in path_segments %}
8-
{% if not forloop.first %}
9-
<span class="mx-1">/</span>
10-
{% endif %}
11-
{% if not forloop.last %}
12-
<a
13-
href="{% url 'project_resource_tree' project.slug %}?path={{ subpath }}"
14-
class="expand-in-tree"
15-
data-path="{{ subpath }}"
16-
hx-get="{% url 'project_resource_tree_table' project.slug %}?path={{ subpath }}"
17-
hx-target="#right-pane"
18-
hx-push-url="{% url 'project_resource_tree' project.slug %}?path={{ subpath }}"
19-
{# WARNING: spaceless is not working properly so keep the label without spaces #}
20-
>{{ segment }}</a>
21-
{% else %}
22-
<span class="has-text-weight-bold">{{ segment }}</span>
23-
{% endif %}
24-
{% endfor %}
25-
{% endspaceless %}
26-
</span>
27-
<button class="copy-to-clipboard ml-2 is-size-6 is-shadowless is-white" aria-label="Copy path" data-copy="{{ path }}" data-copy-feedback="Path copied!">
28-
<i class="fa-regular fa-copy"></i>
29-
</button>
30-
{% endif %}
31-
</div>
2+
<div id="right-pane-header" class="mb-2">
3+
{% include 'scanpipe/tree/resource_path_breadcrumb.html' %}
324
</div>
335

346
<div id="right-pane-content" class="table-scroll-area">

0 commit comments

Comments
 (0)