playbook_ui_docs 13.9.0.pre.alpha.play845addswiftkitspage1273 → 13.9.0.pre.alpha.play845allkitsbytypes1260
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/dist/pb_doc_helper.rb +68 -32
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7fe4e21bdb2641590dd0a5f0e036c98c3eec1da820b7da4c0eef6aecd21e72
|
4
|
+
data.tar.gz: 4d226fad24ddd4de0bde80b186bf39f370f7ae3edaafe0c74d748bda8c8ae71c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 896f8f8d62dc6389baf7881d4d179de7406f1c459d6967a2516f40520d6f1cbbb22118f94e6412858de2e319625a91ec492517b99ed6be3dadc25cbdc0634a7a
|
7
|
+
data.tar.gz: 7c62432b978a4a1b2ba87cf87a91d728b416287d24027120cdff3893c512c966137a4c4761666c6b257edf033c42fe860be02ede1c341b14fd7302c644c123cb
|
data/dist/pb_doc_helper.rb
CHANGED
@@ -26,45 +26,81 @@ module PlaybookWebsite
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# Deal with lists of kits, used in Playbook doc and Externally
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
kits
|
33
|
-
kits.
|
34
|
-
|
35
|
-
|
36
|
-
display_kits << render_pb_doc_kit(sub_kit, type, limit_examples, false, dark_mode)
|
37
|
-
end
|
38
|
-
else
|
39
|
-
display_kits << render_pb_doc_kit(kit, type, limit_examples, false, dark_mode)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
raw("<div class='pb--docItem'>" + display_kits.join("</div><div class='pb--docItem'>") + "</div>")
|
29
|
+
def pb_kits(type: "rails", limit_examples: false, dark_mode: false)
|
30
|
+
kits = get_kits(type)
|
31
|
+
|
32
|
+
# Iterate through the filtered kits and render them
|
33
|
+
kits.map do |kit|
|
34
|
+
render_pb_doc_kit(kit["name"], type, limit_examples, true, dark_mode)
|
35
|
+
end.join.html_safe
|
43
36
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
# menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
|
49
|
-
# menu["kits"]
|
50
|
-
# end
|
51
|
-
def get_kits(_type = "rails")
|
52
|
-
aggregate_kits || []
|
37
|
+
|
38
|
+
def get_kits(type = "rails")
|
39
|
+
kits = MENU["kits"] || []
|
40
|
+
|
53
41
|
# Filter kits that have at least one component compatible with the type
|
42
|
+
kits.select do |kit|
|
43
|
+
kit["components"].any? { |component| component["platforms"].include?(type) }
|
44
|
+
end
|
54
45
|
end
|
55
46
|
|
56
|
-
def
|
57
|
-
|
58
|
-
|
47
|
+
def aggregate_kits
|
48
|
+
all_kits = []
|
49
|
+
|
50
|
+
MENU["kits"].each do |kit|
|
51
|
+
kit_name = kit["name"]
|
52
|
+
components = kit["components"].map { |c| c["name"] }
|
53
|
+
|
54
|
+
all_kits << if components.size == 1
|
55
|
+
components.first
|
56
|
+
else
|
57
|
+
{ kit_name => components }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
all_kits
|
59
62
|
end
|
60
|
-
# rubocop:enable Naming/AccessorMethodName
|
61
63
|
|
62
64
|
# rubocop:disable Style/OptionalBooleanParameter
|
63
|
-
def render_pb_doc_kit(
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
def render_pb_doc_kit(kit_name, type, limit_examples, code = true, dark_mode = false)
|
66
|
+
parent_kit = MENU["kits"].find { |kit| kit["name"] == kit_name }
|
67
|
+
|
68
|
+
# Initialize component_content as an empty string
|
69
|
+
component_content = ""
|
70
|
+
title = ""
|
71
|
+
|
72
|
+
# Check if parent_kit is nil
|
73
|
+
if parent_kit.nil?
|
74
|
+
title = pb_doc_render_clickable_title(kit_name, type)
|
75
|
+
component_content = raw("<div class='pb--docItem-ui'>
|
76
|
+
#{pb_kit(kit: kit_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}</div>")
|
77
|
+
else
|
78
|
+
# Filter components based on the specified type
|
79
|
+
components = parent_kit["components"].select { |component| component["platforms"].include?(type) }
|
80
|
+
|
81
|
+
# If it's a parent with components, accumulate the UI content for child components
|
82
|
+
if components.any?
|
83
|
+
component_content = components.map do |component|
|
84
|
+
component_name = component["name"]
|
85
|
+
title = pb_doc_render_clickable_title(component_name, type) # Use component_name for the title
|
86
|
+
|
87
|
+
# Render the component UI content with the same styles/tags as the parent
|
88
|
+
component_ui = raw("<div class='pb--docItem-ui'>
|
89
|
+
#{pb_kit(kit: component_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}
|
90
|
+
</div>")
|
91
|
+
|
92
|
+
# Combine the component name and component UI content
|
93
|
+
"#{title}#{component_ui}"
|
94
|
+
end.join.to_s
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Combine the component content and UI content for the parent kit
|
99
|
+
if parent_kit.nil?
|
100
|
+
"#{title}#{component_content}".to_s
|
101
|
+
else
|
102
|
+
component_content.to_s.to_s
|
103
|
+
end
|
68
104
|
end
|
69
105
|
# rubocop:enable Style/OptionalBooleanParameter
|
70
106
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui_docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.9.0.pre.alpha.
|
4
|
+
version: 13.9.0.pre.alpha.play845allkitsbytypes1260
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-10-
|
12
|
+
date: 2023-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: playbook_ui
|