bullet_train-themes 1.0.2 → 1.0.5
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 +3 -2
- data/lib/bullet_train/themes/version.rb +1 -1
- data/lib/bullet_train/themes.rb +9 -0
- 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: 744d05668c8d24f923bf5a32515d47182047ec0a209f2f0f1914af86b9ac7ca8
|
4
|
+
data.tar.gz: 1f4ef7ed195439992f132a481b37bd8ee38a6241e795e6a32fd5c1a799d50072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a7e5803c7371c505bb6d61ae4c8c0f4bffba2d89befc5520b56450f904399f9a6784162b62c7b3e54e0c47c526e65e4925526c7ab42da274c449ed3087e870a
|
7
|
+
data.tar.gz: b2c5132d68ff59eb0f240f5168f81cc477d462a9f581f5e04b6b2a5c476ef27b918717e98ba3aeb4b3a4ef464fbfff7b9c66a39e4225d001433e7afd1608d77c
|
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
|
data/lib/bullet_train/themes.rb
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
require "bullet_train/themes/version"
|
2
2
|
require "bullet_train/themes/engine"
|
3
|
+
# require "bullet_train/themes/base/theme"
|
3
4
|
|
4
5
|
module BulletTrain
|
5
6
|
module Themes
|
6
7
|
mattr_accessor :themes, default: {}
|
8
|
+
|
9
|
+
module Base
|
10
|
+
class Theme
|
11
|
+
def directory_order
|
12
|
+
['base']
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
7
16
|
end
|
8
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-themes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|