Module: Flipper::UI::ActionPatch
- Defined in:
- lib/flipper/ui/action_patch.rb
Instance Method Summary collapse
Instance Method Details
#custom_views_path ⇒ Object
21 22 23 |
# File 'lib/flipper/ui/action_patch.rb', line 21 def custom_views_path Rails.root.join('lib', 'flipper', 'ui', 'views') end |
#view(name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/flipper/ui/action_patch.rb', line 6 def view(name) # Use custom views if enabled in configuration. path = custom_views_path.join("#{name}.erb") unless custom_views_path.nil? # Fall back to default views if custom views haven't been enabled # or if the custom view cannot be found. path = views_path.join("#{name}.erb") if path.nil? || !path.exist? raise "Template does not exist: #{path}" unless path.exist? # rubocop:disable Security/Eval eval(Erubi::Engine.new(path.read, escape: true).src) # rubocop:enable Security/Eval end |