class Rodauth::Rails::Generators::ViewsGenerator
Constants
- DEPENDENCIES
- VIEWS
Public Instance Methods
configuration_name()
click to toggle source
# File lib/generators/rodauth/views_generator.rb, line 137 def configuration_name options[:name]&.to_sym end
controller()
click to toggle source
# File lib/generators/rodauth/views_generator.rb, line 131 def controller rodauth = Rodauth::Rails.app.rodauth(configuration_name) fail ArgumentError, "unknown rodauth configuration: #{configuration_name.inspect}" unless rodauth rodauth.allocate.rails_controller end
create_views()
click to toggle source
# File lib/generators/rodauth/views_generator.rb, line 101 def create_views if options[:all] features = VIEWS.keys else features = (options[:features] || self.features).map(&:to_sym) end views = features.inject([]) do |list, feature| list |= VIEWS[feature] || [] list |= VIEWS[DEPENDENCIES[feature]] || [] end views.each do |view| template "app/views/rodauth/#{view}.html.erb", "app/views/#{directory}/#{view}.html.erb" end end
directory()
click to toggle source
# File lib/generators/rodauth/views_generator.rb, line 119 def directory if controller.abstract? fail Error, "no controller configured for configuration: #{configuration_name.inspect}" end controller.controller_path end
rodauth()
click to toggle source
# File lib/generators/rodauth/views_generator.rb, line 127 def rodauth "rodauth#{"(:#{configuration_name})" if configuration_name}" end