Class: KisoThemes::Generators::UserAccountPagesGenerator
- Inherits:
-
AppPagesGenerator
- Object
- Rails::Generators::NamedBase
- AppPagesGenerator
- KisoThemes::Generators::UserAccountPagesGenerator
show all
- Defined in:
- lib/generators/kiso_themes/user_account_pages_generator.rb
Instance Method Summary
collapse
#copy_view, #create_controller, #set_layout, set_page_type
Instance Method Details
#create_controller_methods ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/generators/kiso_themes/user_account_pages_generator.rb', line 22
def create_controller_methods
controller_const_name = "#{name.camelize}Controller"
target_controller_file_name = File.join('app/controllers', class_path, "#{file_name}_controller.rb")
["index", "billing", "plan", "profile", "support", "notifications"].each do |method_name|
inject_into_file( target_controller_file_name, build_method(method_name), before: /^end/ )
end
end
|
#set_partial_path ⇒ Object
31
32
33
34
|
# File 'lib/generators/kiso_themes/user_account_pages_generator.rb', line 31
def set_partial_path
controller_const_name = "#{name.camelize}Controller"
inject_into_class File.join('app/controllers', class_path, "#{file_name}_controller.rb"), controller_const_name, " prepend_view_path(File.join(Rails.root, 'app/views/#{name.downcase}/'))\n"
end
|
#setup_routing ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/generators/kiso_themes/user_account_pages_generator.rb', line 13
def setup_routing
route "get '/user' => '#{name.downcase}#profile'"
route "get '/user/billing' => '#{name.downcase}#billing'"
route "get '/user/plan' => '#{name.downcase}#plan'"
route "get '/user/profile' => '#{name.downcase}#profile'"
route "get '/user/support' => '#{name.downcase}#support'"
route "get '/user/notifications' => '#{name.downcase}#notifications'"
end
|