Skip to content

Commit 7fa4b27

Browse files
committed
Use the segmented category switcher on the top page too
Replace the dashboard's nav-pills with the same segmented control introduced for the ruby-bench page.
1 parent 4dac65c commit 7fa4b27

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎source/_dashboard.html.haml‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
.text-center
77
#graph_metadata{ 'data-type': 'column' }
88

9-
%ul.nav.nav-pills.benchmark_navbar
10-
- %w[Headline Other Micro].each_with_index do |category, index|
11-
%li.nav-item
12-
%a.nav-link.activate-chart{ href: '#', 'data-id': category.downcase, class: ('active' if index == 0) }= category
13-
%li.nav-item{ style: 'clear: both; float: left; display: block; position: relative;' }
9+
%div
10+
.category_switcher
11+
- %w[Headline Other Micro].each_with_index do |category, index|
12+
%button.category_switch.activate-chart{ type: 'button', 'data-id': category.downcase, class: ('active' if index == 0) }= category
1413

1514
- %w[headline other micro].each do |category|
1615
.benchmark_graph{ id: category }
@@ -116,9 +115,9 @@
116115
// Switch active tab and render it
117116
$('.activate-chart').on('click', function(event) {
118117
event.preventDefault();
119-
$('.benchmark_navbar .nav-link').removeClass('active');
118+
$('.category_switch').removeClass('active');
120119
$(this).addClass('active');
121-
var id = $('.benchmark_navbar .nav-link.active').data('id');
120+
var id = $(this).data('id');
122121
var graphElement = $('#' + id);
123122
activateChart(graphElement);
124123

@@ -140,7 +139,7 @@
140139
var url = document.location.toString();
141140
if (url.match('#')) {
142141
var id = url.split('#')[1];
143-
$('.benchmark_navbar .nav-link').removeClass('active');
142+
$('.category_switch').removeClass('active');
144143
activateChart($('.benchmark_graph#' + id));
145144
$('.activate-chart[data-id=' + id + ']').addClass('active');
146145
}

0 commit comments

Comments
 (0)