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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b887cc1683a78e19df263a0ae451f8e926517bee14785408483a686f3e7045d2
4
- data.tar.gz: 4634ae00490cd02fe0758bda07cade5370833fcf758a09ffe0db41d2a2189320
3
+ metadata.gz: 744d05668c8d24f923bf5a32515d47182047ec0a209f2f0f1914af86b9ac7ca8
4
+ data.tar.gz: 1f4ef7ed195439992f132a481b37bd8ee38a6241e795e6a32fd5c1a799d50072
5
5
  SHA512:
6
- metadata.gz: 075d43fa0fe5c2a52d88eda8835e645cb12efe6b5f78685db71bfb14f6b82a685ba12791f969859dabcaaae9a54db9ef09f7f956ccbfdd456f2ed38a4525175a
7
- data.tar.gz: bf007da695280d3223471a6c43356bda55a71fd48acc973b3e19f4f4e9ba70b4004a3ed9c935e8446a9880acd0cb223c284bd11fadd3792f9bf152e177e84856
6
+ metadata.gz: 7a7e5803c7371c505bb6d61ae4c8c0f4bffba2d89befc5520b56450f904399f9a6784162b62c7b3e54e0c47c526e65e4925526c7ab42da274c449ed3087e870a
7
+ data.tar.gz: b2c5132d68ff59eb0f240f5168f81cc477d462a9f581f5e04b6b2a5c476ef27b918717e98ba3aeb4b3a4ef464fbfff7b9c66a39e4225d001433e7afd1608d77c
@@ -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
- return super
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
- begin
63
- # Update our options from something like `shared/box` to `themes/light/box`.
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
- # Try rendering the partial again with the updated options.
67
- body = super
65
+ # Try rendering the partial again with the updated options.
66
+ body = super
68
67
 
69
- # 🏆 If we get this far, then we've found the actual path of the theme partial. We should cache it!
70
- $resolved_theme_partial_paths[original_options] = options
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
- # We also need to return whatever the rendered body was.
73
- return body
71
+ # We also need to return whatever the rendered body was.
72
+ return body
74
73
 
75
- # If calling `render` with the updated options is still resulting in a missing template, we need to
76
- # keep iterating over `directory_order` to work our way up the theme stack and see if we can find the
77
- # partial there, e.g. going from `light` to `tailwind` to `base`.
78
- rescue ActionView::MissingTemplate => _
79
- next
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
@@ -1,8 +1,9 @@
1
- require_relative "../../theme_partials"
2
-
3
1
  module BulletTrain
4
2
  module Themes
5
3
  class Engine < ::Rails::Engine
4
+ initializer "bullet_train.themes.register" do |app|
5
+ BulletTrain.linked_gems << "bullet_train-themes"
6
+ end
6
7
  end
7
8
  end
8
9
  end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Themes
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.5"
4
4
  end
5
5
  end
@@ -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.2
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-10 00:00:00.000000000 Z
11
+ date: 2022-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails