Skip to content

Commit c805418

Browse files
committed
Fix CSS and JS of templates
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 476fcff commit c805418

12 files changed

Lines changed: 83 additions & 1393 deletions

‎vulnerabilities/templates/advisory_detail.html‎

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,60 @@
2323
</div>
2424
</article>
2525

26+
<script>
27+
function goToTab(tabName) {
28+
var tabs = document.getElementById('tabs');
29+
if (!tabs) return false;
30+
var targetLink = tabs.querySelector('[data-tab="' + tabName + '"]');
31+
var targetContent = document.querySelector('#tab-content > .tab-div[data-content="' + tabName + '"]');
32+
if (!targetLink || !targetContent) return false;
33+
tabs.querySelectorAll('li.is-active').forEach(function (el) { el.classList.remove('is-active'); });
34+
document.querySelectorAll('#tab-content > .tab-div.is-active').forEach(function (el) { el.classList.remove('is-active'); });
35+
targetLink.classList.add('is-active');
36+
targetContent.classList.add('is-active');
37+
return false;
38+
}
39+
</script>
2640
<div class="tabs is-boxed" id="tabs">
2741
<ul>
2842
<li class="is-active" data-tab="essentials">
29-
<a>
43+
<a href="#" onclick="return goToTab('essentials')">
3044
<span>Essentials</span>
3145
</a>
3246
</li>
3347
<li data-tab="severities">
34-
<a>
48+
<a href="#" onclick="return goToTab('severities')">
3549
<span>
3650
Severities ({{ severities|length }})
3751
</span>
3852
</a>
3953
</li>
4054
<li data-tab="references">
41-
<a>
55+
<a href="#" onclick="return goToTab('references')">
4256
<span>
4357
References ({{ references|length }})
4458
</span>
4559
</a>
4660
</li>
4761

48-
{% if advisory.exploits %}
49-
<li data-tab="exploits">
50-
<a>
51-
<span>
52-
Exploits ({{ advisory.exploits.count }})
53-
</span>
54-
</a>
55-
</li>
56-
{% endif %}
62+
<li data-tab="exploits">
63+
<a href="#" onclick="return goToTab('exploits')">
64+
<span>
65+
Exploits ({{ advisory.exploits.count }})
66+
</span>
67+
</a>
68+
</li>
5769

5870
<li data-tab="epss">
59-
<a>
71+
<a href="#" onclick="return goToTab('epss')">
6072
<span>
6173
EPSS
6274
</span>
6375
</a>
6476
</li>
6577

6678
<li data-tab="severities-vectors">
67-
<a>
79+
<a href="#" onclick="return goToTab('severities-vectors')">
6880
<span>
6981
Severity details ({{ severity_vectors|length }})
7082
</span>
@@ -73,7 +85,7 @@
7385

7486
{% if ssvcs %}
7587
<li data-tab="ssvcs">
76-
<a>
88+
<a href="#" onclick="return goToTab('ssvcs')">
7789
<span>
7890
Related SSVCS ({{ ssvcs|length }})
7991
</span>
@@ -82,7 +94,7 @@
8294
{% endif %}
8395

8496
<li data-tab="patch-url">
85-
<a>
97+
<a href="#" onclick="return goToTab('patch-url')">
8698
<span>
8799
{% with pcp_length=package_commit_patches|length %}
88100
Patches: ({{ advisory.patches.count|add:pcp_length }})
@@ -450,11 +462,7 @@
450462
</tbody>
451463
</table>
452464
{% empty %}
453-
<tr>
454-
<td colspan="2">
455-
No exploits are available.
456-
</td>
457-
</tr>
465+
<p>No exploits are available.</p>
458466
{% endfor %}
459467
</div>
460468

@@ -637,11 +645,7 @@
637645
<hr/>
638646
{% endif %}
639647
{% empty %}
640-
<tr>
641-
<td>
642-
There are no known vectors.
643-
</td>
644-
</tr>
648+
<p>There are no known vectors.</p>
645649
{% endfor %}
646650
</div>
647651

@@ -734,22 +738,4 @@
734738
</section>
735739
{% endif %}
736740

737-
<script src="{% static 'js/main.js' %}" crossorigin="anonymous"></script>
738-
739-
<script>
740-
function goToTab(tabName) {
741-
const activeLink = document.querySelector('div.tabs.is-boxed li.is-active');
742-
const activeTabContent = document.querySelector('div.tab-div.is-active');
743-
744-
activeLink.classList.remove('is-active');
745-
activeTabContent.classList.remove('is-active');
746-
747-
const target_id = document.querySelector(`[data-tab='${tabName}']`);
748-
const targetTabContent = document.querySelector(`[data-content='${tabName}']`);
749-
750-
target_id.classList.add('is-active');
751-
targetTabContent.classList.add('is-active');
752-
}
753-
</script>
754-
755741
{% endblock %}

‎vulnerabilities/templates/base.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link rel="icon" href="{% static 'images/favicon.ico' %}" />
1010

1111
<link rel="stylesheet" href="{% static 'css/bulma.css' %}" />
12-
<link rel="stylesheet" href="{% static 'css/custom.css' %}" />
12+
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v=tabs3" />
1313
<link rel="stylesheet" href="{% static 'css/font-awesome.css' %}" />
1414
<link rel="stylesheet" href="{% static 'css/bulma-tooltip.css' %}" />
1515

0 commit comments

Comments
 (0)