8000 [WebProfilerBundle] Display the missing translation panel by default · src-run/symfony@15fe686 · GitHub
[go: up one dir, main page]

Skip to content

Commit 15fe686

Browse files
javiereguiluzfabpot
authored andcommitted
[WebProfilerBundle] Display the missing translation panel by default
1 parent a8dc953 commit 15fe686

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Symfony/Bundle/TwigBundle/Resources/views/base_js.html.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@
4545
var tabNavigation = document.createElement('ul');
4646
tabNavigation.className = 'tab-navigation';
4747
48+
var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */
4849
for (var j = 0; j < tabs.length; j++) {
4950
var tabId = 'tab-' + i + '-' + j;
5051
var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;
5152
5253
var tabNavigationItem = document.createElement('li');
5354
tabNavigationItem.setAttribute('data-tab-id', tabId);
54-
if (j == 0) { addClass(tabNavigationItem, 'active'); }
55+
if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; }
5556
if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); }
5657
tabNavigationItem.innerHTML = tabTitle;
5758
tabNavigation.appendChild(tabNavigationItem);
@@ -61,6 +62,7 @@
6162
}
6263
6364
tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);
65+
addClass(document.querySelector('[data-tab-id="' + selectedTabId + '"]'), 'active');
6466
}
6567
6668
/* display the active tab and add the 'click' event listeners */

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
{% endfor %}
118118

119119
<div class="sf-tabs">
120-
<div class="tab">
120+
<div class="tab {{ collector.countMissings == 0 ? 'active' }}">
121121
<h3 class="tab-title">Defined <span class="badge">{{ collector.countDefines }}</span></h3>
122122

123123
<div class="tab-content">
@@ -158,7 +158,7 @@
158158
</div>
159159
</div>
160160

161-
<div class="tab">
161+
<div class="tab {{ collector.countMissings > 0 ? 'active' }}">
162162
<h3 class="tab-title">Missing <span class="badge {{ collector.countMissings ? 'status-error' }}">{{ collector.countMissings }}</span></h3>
163163

164164
<div class="tab-content">

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,14 @@
406406
var tabNavigation = document.createElement('ul');
407407
tabNavigation.className = 'tab-navigation';
408408
409+
var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */
409410
for (var j = 0; j < tabs.length; j++) {
410411
var tabId = 'tab-' + i + '-&# 9BA4 39; + j;
411412
var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;
412413
413414
var tabNavigationItem = document.createElement('li');
414415
tabNavigationItem.setAttribute('data-tab-id', tabId);
415-
if (j == 0) { addClass(tabNavigationItem, 'active'); }
416+
if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; }
416417
if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); }
417418
tabNavigationItem.innerHTML = tabTitle;
418419
tabNavigation.appendChild(tabNavigationItem);
@@ -422,6 +423,7 @@
422423
}
423424
424425
tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);
426+
addClass(document.querySelector('[data-tab-id="' + selectedTabId + '"]'), 'active');
425427
}
426428
427429
/* display the active tab and add the 'click' event listeners */

0 commit comments

Comments
 (0)
0