Module: Charming::Generators::AppGenerator::ControllerTemplate
- Included in:
- Charming::Generators::AppGenerator
- Defined in:
- lib/charming/generators/app_generator/controller_template.rb
Instance Method Summary collapse
- #application_controller ⇒ Object
- #controller ⇒ Object
- #controller_actions ⇒ Object
- #controller_helpers ⇒ Object
- #render_helpers ⇒ Object
Instance Method Details
#application_controller ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/charming/generators/app_generator/controller_template.rb', line 7 def application_controller %(# frozen_string_literal: true module #{name.class_name} class ApplicationController < Charming::Controller layout Layouts::Application focus_ring :sidebar, :content key "p", :open_command_palette, scope: :global key "q", :quit, scope: :global command "Home" do navigate_to "/" end command "Theme", :open_theme_palette command "Close palette", :close_command_palette command "Quit app", :quit end end ) end |
#controller ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/charming/generators/app_generator/controller_template.rb', line 30 def controller %(# frozen_string_literal: true module #{name.class_name} class HomeController < ApplicationController #{controller_actions} #{controller_helpers} end end ) end |
#controller_actions ⇒ Object
42 43 44 45 46 47 |
# File 'lib/charming/generators/app_generator/controller_template.rb', line 42 def controller_actions %( def show render_home end) end |
#controller_helpers ⇒ Object
49 50 51 52 53 54 |
# File 'lib/charming/generators/app_generator/controller_template.rb', line 49 def controller_helpers %( private #{render_helpers}) end |
#render_helpers ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/charming/generators/app_generator/controller_template.rb', line 56 def render_helpers %( def render_home render HomeView.new(home: home, palette: command_palette, screen: screen, theme: theme) end def home model(:home, HomeModel) end) end |