Skip to content

Commit 6951ba8

Browse files
committed
add hover action that highlights timeline item
1 parent 8b761ce commit 6951ba8

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

template_profiler_panel/panels/template.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class TemplateProfilerPanel(Panel):
5454
'''
5555

5656
template = 'template_profiler_panel/template.html'
57+
scripts = ["static/js/template_profiler.js"]
5758

5859
def __init__(self, *args, **kwargs):
5960
self.colors = {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
$(".timeline_item").mouseover(function() {
3+
$(this).css("border", "red 0.1px solid");
4+
}).mouseout(function() {
5+
$(this).css("border", "none");
6+
});

template_profiler_panel/templates/template_profiler_panel/template.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ <h4>{{ templates|length }} {% trans 'calls to Template.render()' %}</h4>
5050
Duration {{ time_item.duration|floatformat:2 }} ms
5151
{% if time_item.position %}Lines {{ time_item.position.0 }} - {{ time_item.position.1 }}{% endif %}
5252
Depth {{ time_item.level|add:1 }}
53-
" style="
53+
"
54+
class="timeline_item"
55+
style="
5456
min-width: 1px;
5557
margin-left: {{ time_item.offset_p|stringformat:'f' }}%;
5658
width: {{ time_item.rel_duration_p|stringformat:'f' }}%;
5759
background-color: {{ time_item.bg_color }};
5860
top: calc({{ time_item.level }}px * 18);
5961
position: absolute;
60-
{# border: red 0.1px solid; #}
6162
opacity: 0.9;
6263
">&nbsp;</span>
6364
{% endfor %}

0 commit comments

Comments
 (0)