File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 11{% load humanize %}
2+ < div class ="mb-4 ">
3+ < div class ="has-text-weight-semibold is-flex is-align-items-center is-family-monospace ">
4+ {% if path_segments %}
5+ < span id ="resource-path " class ="has-text-weight-medium ">
6+ {% for subpath, segment in path_segments %}
7+ {% if not forloop.first %}< span class ="mx-1 "> /</ span > {% endif %}
8+ {% if not forloop.last %}
9+ < a href ="# " class ="expand-in-tree has-text-link " data-path ="{{ subpath }} " hx-get ="{% url 'codebase_resource_table' project.slug %}?path={{ subpath }} " hx-target ="#right-pane "> {{ segment }}</ a >
10+ {% else %}
11+ < span > {{ segment }}</ span >
12+ {% endif %}
13+ {% endfor %}
14+ </ span >
15+ < 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! ">
16+ < i class ="fa-regular fa-copy "> </ i >
17+ </ button >
18+ {% endif %}
19+ </ div >
20+ </ div >
221
322{% if resources %}
423 < table class ="table is-bordered is-striped is-narrow is-fullwidth ">
Original file line number Diff line number Diff line change 105105
106106{% block scripts %}
107107 < script >
108+ document . body . addEventListener ( 'htmx:afterSwap' , function ( evt ) {
109+ if ( evt . target && evt . target . id === 'right-pane' ) {
110+ if ( typeof enableCopyToClipboard === 'function' ) {
111+ enableCopyToClipboard ( '.copy-to-clipboard' ) ;
112+ }
113+ }
114+ } ) ;
115+
108116 // Tree functionality
109117 document . addEventListener ( "click" , async function ( e ) {
110118 const chevron = e . target . closest ( "[data-chevron]" ) ;
Original file line number Diff line number Diff line change @@ -2837,5 +2837,8 @@ def get_queryset(self):
28372837
28382838 def get_context_data (self , ** kwargs ):
28392839 context = super ().get_context_data (** kwargs )
2840- context ["path" ] = self .request .GET .get ("path" , "" )
2840+ path = self .request .GET .get ("path" , "" )
2841+ context ["path" ] = path
2842+ segments = path .strip ("/" ).split ("/" )
2843+ context ["path_segments" ] = [ ("/" .join (segments [:i + 1 ]), segment ) for i , segment in enumerate (segments ) ]
28412844 return context
You can’t perform that action at this time.
0 commit comments