-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathtab_component.html.erb
72 lines (67 loc) · 3.83 KB
/
tab_component.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<%=
flex_layout(classes: "op-work-package-details-tab-component", data: {
"application-target": "dynamic",
controller: "work-packages--details--tabs"
}) do |flex|
flex.with_column(classes: "op-work-package-details-tab-component--action") do
render(Primer::Beta::IconButton.new(icon: :"chevron-left",
tag: :a,
scheme: :invisible,
data: {
action: "click->work-packages--details--tabs#scrollLeft"
},
aria: { label: I18n.t(:label_scroll_left) }))
end
flex.with_column(flex: 1, classes: "op-work-package-details-tab-component--tabs", test_selector: "wp-details-tab-component--tabs") do
render(Primer::Alpha::UnderlineNav.new(align: :left,
label: "Tabs",
data: {
"work-packages--details--tabs-target": "underlineNav",
})) do |component|
menu_items.each do |node|
component.with_tab(selected: @tab == node.name,
href: helpers.url_for_with_params(**node.url),
test_selector: "wp-details-tab-component--tab-#{node.name}",
data: {
turbo: true,
turbo_stream: true,
turbo_action: "replace",
"work-packages--details--tabs-target": @tab == node.name ? "activeElement" : ""
}
) do |c|
c.with_text { t("js.work_packages.tabs.#{node.name}") }
count = node.badge(work_package:).to_i
c.with_counter(count:, hide_if_zero: true, id: "wp-details-tab-#{node.name}-counter", test_selector: "wp-details-tab-component--#{node.name}-counter")
end
end
end
end
flex.with_column(classes: "op-work-package-details-tab-component--action") do
render(Primer::Beta::IconButton.new(icon: :"chevron-right",
tag: :a,
scheme: :invisible,
data: {
action: "click->work-packages--details--tabs#scrollRight"
},
aria: { label: I18n.t(:label_scroll_right) }))
end
flex.with_column(classes: "op-work-package-details-tab-component--action") do
render(Primer::Beta::IconButton.new(icon: :"screen-full",
tag: :a,
href: work_package_path(work_package.id, full_screen_tab),
target: "_top",
scheme: :invisible,
test_selector: "wp-details-tab-component--full-screen",
aria: { label: I18n.t("js.button_show_fullscreen") }))
end
flex.with_column(classes: "op-work-package-details-tab-component--action") do
render(Primer::Beta::IconButton.new(icon: :x,
tag: :a,
href: base_route,
data: { turbo: true, target: "_top", turbo_action: "advance" },
scheme: :invisible,
test_selector: "wp-details-tab-component--close",
aria: { label: I18n.t(:button_close) }))
end
end
%>