playbook_ui_docs 13.5.0 → 13.6.0.pre.alpha.play845allkitsbytypes1219
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_body/docs/_body_truncate.html.erb +12 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_truncate.jsx +50 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_truncate.md +4 -0
- data/app/pb_kits/playbook/pb_body/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_body/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_header.html.erb +31 -27
- data/app/pb_kits/playbook/pb_table/docs/_table_header.md +8 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_truncate.html.erb +12 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_truncate.jsx +53 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_truncate.md +4 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_title/docs/index.js +1 -0
- data/dist/menu.yml +235 -110
- data/dist/pb_doc_helper.rb +40 -15
- data/dist/playbook-doc.js +7 -7
- metadata +13 -7
data/dist/pb_doc_helper.rb
CHANGED
@@ -27,33 +27,58 @@ module PlaybookWebsite
|
|
27
27
|
|
28
28
|
# Deal with lists of kits, used in Playbook doc and Externally
|
29
29
|
# rubocop:disable Style/StringConcatenation
|
30
|
-
def pb_kits(type: "rails", limit_examples: false, dark_mode: false
|
30
|
+
def pb_kits(type: "rails", limit_examples: false, dark_mode: false)
|
31
31
|
display_kits = []
|
32
|
-
kits =
|
32
|
+
kits = get_kits(type)
|
33
33
|
kits.each do |kit|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
display_kits << render_pb_doc_kit(kit, type, limit_examples, false, dark_mode)
|
34
|
+
nav_array = nav_hash_array(kit)
|
35
|
+
next unless nav_array.is_a?(Array)
|
36
|
+
|
37
|
+
nav_array.each do |sub_kit|
|
38
|
+
display_kits << render_pb_doc_kit(sub_kit, type, limit_examples, false, dark_mode)
|
40
39
|
end
|
41
40
|
end
|
42
41
|
raw("<div class='pb--docItem'>" + display_kits.join("</div><div class='pb--docItem'>") + "</div>")
|
43
42
|
end
|
44
43
|
# rubocop:enable Style/StringConcatenation
|
45
44
|
|
46
|
-
|
47
|
-
def get_kits
|
45
|
+
def get_kits(type = "rails")
|
48
46
|
menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
|
49
|
-
menu["kits"]
|
47
|
+
menu["kits"][type]
|
50
48
|
end
|
51
49
|
|
52
|
-
def
|
53
|
-
menu = YAML.load_file(
|
54
|
-
|
50
|
+
def aggregate_kits
|
51
|
+
menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
|
52
|
+
all_kits = []
|
53
|
+
|
54
|
+
# Loop over each type (rails, react, swift, etc.)
|
55
|
+
menu["kits"].each do |_type, kits|
|
56
|
+
kits.each do |kit|
|
57
|
+
case kit
|
58
|
+
when Hash
|
59
|
+
kit_name = kit.keys.first
|
60
|
+
existing_kit = all_kits.find { |k| k.is_a?(Hash) && k.keys.first == kit_name }
|
61
|
+
|
62
|
+
if existing_kit
|
63
|
+
existing_kit[kit_name] += kit[kit_name] unless kit[kit_name].nil?
|
64
|
+
existing_kit[kit_name].uniq!
|
65
|
+
existing_kit[kit_name].sort!
|
66
|
+
else
|
67
|
+
all_kits << { kit_name => kit[kit_name] }
|
68
|
+
end
|
69
|
+
when String
|
70
|
+
all_kits << kit unless all_kits.include?(kit)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Sort the top-level entries
|
76
|
+
all_kits.sort_by! do |kit|
|
77
|
+
kit.is_a?(Hash) ? kit.keys.first : kit
|
78
|
+
end
|
79
|
+
|
80
|
+
all_kits
|
55
81
|
end
|
56
|
-
# rubocop:enable Naming/AccessorMethodName
|
57
82
|
|
58
83
|
# rubocop:disable Style/OptionalBooleanParameter
|
59
84
|
def render_pb_doc_kit(kit, type, limit_examples, code = true, dark_mode = false)
|