playbook_ui 13.9.0.pre.alpha.play845addswiftkitspage1273 → 13.9.0.pre.alpha.play845allkitsbytypes1260
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/playbook/pb_doc_helper.rb +51 -29
- data/lib/playbook/version.rb +1 -1
- 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: e47bda24af6edbc23255faea9e74418ea82ec02ecafbcce245aca51ead067eb8
|
4
|
+
data.tar.gz: 7a6417c7fded6d9f5117ed28bcb7207a7d9d286611140aa9d82db0879f91cec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a40703a2cbcc0e1fc98ee91a0ba73d219ce1f8172975022c722c3ca425d005a8a05bd3f7290c3bf558a036a53b82a32ea89bad388e5338af9424c66c4ff07ce
|
7
|
+
data.tar.gz: f0275c462194c5c2db72f027a0e7347cf423e72e50e1004b6e65fe2b10962b993c3cc88e534e87a4ebeee7778f20abace8b3c2ec42e8dcfbdabd1e5512f0ce24
|
@@ -26,28 +26,28 @@ module Playbook
|
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_kits(type = "rails")
|
39
|
+
kits = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml")) || []
|
40
|
+
|
41
|
+
# Filter kits that have at least one component compatible with the type
|
42
|
+
kits["kits"].select do |kit|
|
43
|
+
kit["components"].any? { |component| component["platforms"].include?(type) }
|
41
44
|
end
|
42
|
-
raw("<div class='pb--docItem'>" + display_kits.join("</div><div class='pb--docItem'>") + "</div>")
|
43
45
|
end
|
44
|
-
# rubocop:enable Style/StringConcatenation
|
45
46
|
|
46
|
-
|
47
|
-
def get_kits
|
48
|
-
menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
|
47
|
+
def aggregate_kits
|
49
48
|
all_kits = []
|
50
|
-
|
49
|
+
|
50
|
+
YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))["kits"].each do |kit|
|
51
51
|
kit_name = kit["name"]
|
52
52
|
components = kit["components"].map { |c| c["name"] }
|
53
53
|
|
@@ -57,22 +57,44 @@ module Playbook
|
|
57
57
|
{ kit_name => components }
|
58
58
|
end
|
59
59
|
end
|
60
|
-
all_kits
|
61
|
-
end
|
62
60
|
|
63
|
-
|
64
|
-
menu = YAML.load_file(Rails.root.join("config/menu.yml"))
|
65
|
-
menu["kits"]
|
61
|
+
all_kits
|
66
62
|
end
|
67
|
-
# rubocop:enable Naming/AccessorMethodName
|
68
63
|
|
69
64
|
# rubocop:disable Style/OptionalBooleanParameter
|
70
|
-
def render_pb_doc_kit(
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
65
|
+
def render_pb_doc_kit(kit_name, type, limit_examples, code = true, dark_mode = false)
|
66
|
+
parent_kit = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))["kits"].find { |kit| kit["name"] == kit_name }
|
67
|
+
|
68
|
+
# Initialize component_content as an empty string
|
69
|
+
component_content = ""
|
70
|
+
|
71
|
+
# Check if parent_kit is not nil
|
72
|
+
# Check if type is not "swift"
|
73
|
+
if parent_kit && type != "swift"
|
74
|
+
# Filter components based on the specified type
|
75
|
+
components = parent_kit["components"].select { |component| component["platforms"].include?(type) }
|
76
|
+
|
77
|
+
# If it's a parent with components, accumulate the UI content for child components
|
78
|
+
if components.any?
|
79
|
+
component_content = components.map do |component|
|
80
|
+
component_name = component["name"]
|
81
|
+
title = pb_doc_render_clickable_title(component_name, type) # Use component_name for the title
|
82
|
+
|
83
|
+
# Render the component UI content with the same styles/tags as the parent
|
84
|
+
component_ui = raw("<div class='pb--docItem-ui'>
|
85
|
+
#{pb_kit(kit: component_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}
|
86
|
+
</div>")
|
87
|
+
|
88
|
+
# Combine the component name and component UI content
|
89
|
+
"#{title}#{component_ui}"
|
90
|
+
end.join.to_s
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Return the component_content
|
95
|
+
component_content.to_s
|
75
96
|
end
|
97
|
+
|
76
98
|
# rubocop:enable Style/OptionalBooleanParameter
|
77
99
|
|
78
100
|
private
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
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: actionpack
|