bullet_train-themes 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/theme_helper.rb +14 -16
- data/lib/bullet_train/themes/engine.rb +0 -2
- data/lib/bullet_train/themes/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76ca864a0a22a814f45e2b8a89c8b38b73adabf72abfa772eff87e1f6d1694d8
|
4
|
+
data.tar.gz: e30fe8df989ba8d9726dc27b3db7845ddaf4ee2bd7d4a0a4456db34d61c8b399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 634172a9f9fbe15608388aa3a440ccd8d91843abe81030a944074bc6b14cbebfa01dd42865a6647f0e5db21585b265e38cf5853626333bf59fe721c86225812f
|
7
|
+
data.tar.gz: 90c8cdc8f9a6bca8b141bbf9b7e3534cc87d17dd8922caff40523a492ae0520cf946022d585ff5d7361b1c25b42f778281846152202497c705cfc6ec93ce65a3
|
data/app/helpers/theme_helper.rb
CHANGED
@@ -44,7 +44,7 @@ module ThemeHelper
|
|
44
44
|
#
|
45
45
|
# However, if one of those two situations isn't true, then this call here will throw an exception and we can
|
46
46
|
# perform the appropriate magic to figure out where amongst the themes the partial should be rendering from.
|
47
|
-
|
47
|
+
super
|
48
48
|
rescue ActionView::MissingTemplate => exception
|
49
49
|
# The theme engine only supports `<%= render 'shared/box' ... %>` style calls to `render`.
|
50
50
|
if options.is_a?(String)
|
@@ -59,25 +59,23 @@ module ThemeHelper
|
|
59
59
|
|
60
60
|
# TODO We're hard-coding this for now, but this should probably come from the `Current` model.
|
61
61
|
current_theme_object.directory_order.each do |theme_path|
|
62
|
-
|
63
|
-
|
64
|
-
options = "themes/#{theme_path}/#{requested_partial}"
|
62
|
+
# Update our options from something like `shared/box` to `themes/light/box`.
|
63
|
+
options = "themes/#{theme_path}/#{requested_partial}"
|
65
64
|
|
66
|
-
|
67
|
-
|
65
|
+
# Try rendering the partial again with the updated options.
|
66
|
+
body = super
|
68
67
|
|
69
|
-
|
70
|
-
|
68
|
+
# 🏆 If we get this far, then we've found the actual path of the theme partial. We should cache it!
|
69
|
+
$resolved_theme_partial_paths[original_options] = options
|
71
70
|
|
72
|
-
|
73
|
-
|
71
|
+
# We also need to return whatever the rendered body was.
|
72
|
+
return body
|
74
73
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
74
|
+
# If calling `render` with the updated options is still resulting in a missing template, we need to
|
75
|
+
# keep iterating over `directory_order` to work our way up the theme stack and see if we can find the
|
76
|
+
# partial there, e.g. going from `light` to `tailwind` to `base`.
|
77
|
+
rescue ActionView::MissingTemplate => _
|
78
|
+
next
|
81
79
|
end
|
82
80
|
end
|
83
81
|
end
|