rails-active-ui 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/components/menu_item_component.rb +2 -0
- data/app/components/tab_component.rb +18 -8
- data/app/components/tab_group_component.rb +34 -0
- data/app/helpers/component_helper.rb +1 -0
- data/app/views/ui/examples/_modules_components.html.ruby +18 -22
- data/lib/ui/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecbf2cf056cd56dbcac4a80553455b3a6b303ef8439bd38b5be513652835985f
|
|
4
|
+
data.tar.gz: 07c80687e4e01edb2050fe9e8f277dedbb7472f410f36e703948f791d4196104
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03b90d0da8e67d306bb9e59946264a1d931118179b35dfbcb6f80f16bd07a4b39cd7772453dffd7faba31bdc675aa9a620898f4cf545bc4ef8b2d633ffcaf08c
|
|
7
|
+
data.tar.gz: e60026a65dc4c3fcd3bfdfe97c56b36dc8a6fd9586da21122a20374122b273b38eb7b9333273fa749ad665b151e6b755bf0b667dc487bd7ef567d3445f473c20
|
|
@@ -25,6 +25,7 @@ class MenuItemComponent < Component
|
|
|
25
25
|
attribute :value, :string, default: nil
|
|
26
26
|
attribute :target, :string, default: nil
|
|
27
27
|
attribute :rel, :string, default: nil
|
|
28
|
+
attribute :tab, :string, default: nil
|
|
28
29
|
|
|
29
30
|
def to_s
|
|
30
31
|
classes = class_names(
|
|
@@ -45,6 +46,7 @@ class MenuItemComponent < Component
|
|
|
45
46
|
|
|
46
47
|
opts = merge_html_options(class: classes)
|
|
47
48
|
opts["data-value"] = value if value
|
|
49
|
+
opts["data-tab"] = tab if tab
|
|
48
50
|
opts[:target] = target if target
|
|
49
51
|
opts[:rel] = rel if rel
|
|
50
52
|
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Tab —
|
|
3
|
+
# Tab — a single content pane within a TabGroup.
|
|
4
4
|
#
|
|
5
|
-
# Usage:
|
|
6
|
-
# Tab(active: true
|
|
5
|
+
# Usage (inside TabGroup):
|
|
6
|
+
# Tab(active: true, path: "first", attached: true, segment: true) {
|
|
7
|
+
# text "First tab content"
|
|
8
|
+
# }
|
|
9
|
+
#
|
|
10
|
+
# Usage (standalone, no TabGroup):
|
|
11
|
+
# Tab(active: true, path: "first") { text "Pane content" }
|
|
7
12
|
|
|
8
13
|
class TabComponent < Component
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
include Attachable
|
|
15
|
+
|
|
16
|
+
attribute :active, :boolean, default: false
|
|
17
|
+
attribute :path, :string, default: nil
|
|
18
|
+
attribute :segment, :boolean, default: false
|
|
11
19
|
|
|
12
20
|
def to_s
|
|
13
21
|
classes = class_names(
|
|
14
22
|
"ui",
|
|
15
|
-
{ "active" => active
|
|
23
|
+
{ "active" => active,
|
|
24
|
+
"bottom attached" => attached,
|
|
25
|
+
"segment" => segment },
|
|
16
26
|
"tab"
|
|
17
27
|
)
|
|
18
28
|
|
|
19
|
-
data = {
|
|
29
|
+
data = {}
|
|
20
30
|
data[:tab] = path if path
|
|
21
31
|
|
|
22
|
-
tag.div(class: classes, data: data) { @content }
|
|
32
|
+
tag.div(**merge_html_options(class: classes, data: data)) { @content }
|
|
23
33
|
end
|
|
24
34
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# TabGroup — wrapper for tab navigation with content panes.
|
|
4
|
+
#
|
|
5
|
+
# Renders a <div data-controller="fui-tab"> that wraps a Menu and Tab panes.
|
|
6
|
+
# The fui-tab Stimulus controller finds .item[data-tab] elements within
|
|
7
|
+
# and initializes Fomantic-UI's $.fn.tab plugin for click-based switching.
|
|
8
|
+
#
|
|
9
|
+
# Usage:
|
|
10
|
+
# TabGroup {
|
|
11
|
+
# Menu(tabular: true, attached: "top") {
|
|
12
|
+
# MenuItem(active: true, tab: "first") { text "First" }
|
|
13
|
+
# MenuItem(tab: "second") { text "Second" }
|
|
14
|
+
# }
|
|
15
|
+
# Tab(active: true, path: "first", attached: true, segment: true) {
|
|
16
|
+
# text "First tab content"
|
|
17
|
+
# }
|
|
18
|
+
# Tab(path: "second", attached: true, segment: true) {
|
|
19
|
+
# text "Second tab content"
|
|
20
|
+
# }
|
|
21
|
+
# }
|
|
22
|
+
|
|
23
|
+
class TabGroupComponent < Component
|
|
24
|
+
attribute :history, :boolean, default: false
|
|
25
|
+
attribute :history_type, :string, default: "hash"
|
|
26
|
+
|
|
27
|
+
def to_s
|
|
28
|
+
data = { controller: "fui-tab" }
|
|
29
|
+
data[:fui_tab_history_value] = history if history
|
|
30
|
+
data[:fui_tab_history_type_value] = history_type if history
|
|
31
|
+
|
|
32
|
+
tag.div(**merge_html_options(data: data)) { @content }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -587,37 +587,33 @@ Header(size: :h3) { text "Tab" }
|
|
|
587
587
|
text "Tab content panels used with a menu for switching views."
|
|
588
588
|
|
|
589
589
|
Segment {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
590
|
+
TabGroup {
|
|
591
|
+
Menu(tabular: true, attached: "top") {
|
|
592
|
+
MenuItem(active: true, tab: "tab-1") { text "Tab 1" }
|
|
593
|
+
MenuItem(tab: "tab-2") { text "Tab 2" }
|
|
593
594
|
}
|
|
594
|
-
|
|
595
|
-
|
|
595
|
+
Tab(active: true, path: "tab-1", attached: true, segment: true) {
|
|
596
|
+
text "Content for Tab 1"
|
|
597
|
+
}
|
|
598
|
+
Tab(path: "tab-2", attached: true, segment: true) {
|
|
599
|
+
text "Content for Tab 2"
|
|
596
600
|
}
|
|
597
|
-
}
|
|
598
|
-
Tab(active: true, path: "tab-1") {
|
|
599
|
-
text "Content for Tab 1"
|
|
600
|
-
}
|
|
601
|
-
Tab(path: "tab-2") {
|
|
602
|
-
text "Content for Tab 2"
|
|
603
601
|
}
|
|
604
602
|
}
|
|
605
603
|
|
|
606
604
|
Segment(secondary: true) {
|
|
607
605
|
concat tag.pre { tag.code(
|
|
608
|
-
'
|
|
609
|
-
|
|
610
|
-
|
|
606
|
+
'TabGroup {
|
|
607
|
+
Menu(tabular: true, attached: "top") {
|
|
608
|
+
MenuItem(active: true, tab: "tab-1") { text "Tab 1" }
|
|
609
|
+
MenuItem(tab: "tab-2") { text "Tab 2" }
|
|
611
610
|
}
|
|
612
|
-
|
|
613
|
-
|
|
611
|
+
Tab(active: true, path: "tab-1", attached: true, segment: true) {
|
|
612
|
+
text "Content for Tab 1"
|
|
613
|
+
}
|
|
614
|
+
Tab(path: "tab-2", attached: true, segment: true) {
|
|
615
|
+
text "Content for Tab 2"
|
|
614
616
|
}
|
|
615
|
-
}
|
|
616
|
-
Tab(active: true, path: "tab-1") {
|
|
617
|
-
text "Content for Tab 1"
|
|
618
|
-
}
|
|
619
|
-
Tab(path: "tab-2") {
|
|
620
|
-
text "Content for Tab 2"
|
|
621
617
|
}'
|
|
622
618
|
)}
|
|
623
619
|
}
|
data/lib/ui/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails-active-ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nathan
|
|
@@ -113,6 +113,7 @@ files:
|
|
|
113
113
|
- app/components/sub_header_component.rb
|
|
114
114
|
- app/components/sub_menu_component.rb
|
|
115
115
|
- app/components/tab_component.rb
|
|
116
|
+
- app/components/tab_group_component.rb
|
|
116
117
|
- app/components/table_cell_component.rb
|
|
117
118
|
- app/components/table_component.rb
|
|
118
119
|
- app/components/table_row_component.rb
|