Class: RankedLlm::Generators::ViewsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RankedLlm::Generators::ViewsGenerator
- Defined in:
- lib/generators/ranked_llm/views/views_generator.rb
Overview
Scaffolds a starting-point settings controller/view/JS for managing ranked credentials. Deliberately not auto-mounted: every host app has its own auth boundary (current_account/current_team/...) and UI conventions, so this is meant to be copied and adapted, not used as-is.
Instance Method Summary collapse
- #copy_controller ⇒ Object
- #copy_stimulus_controller ⇒ Object
- #copy_view ⇒ Object
- #show_post_install_message ⇒ Object
Instance Method Details
#copy_controller ⇒ Object
12 13 14 |
# File 'lib/generators/ranked_llm/views/views_generator.rb', line 12 def copy_controller template "ai_apis_controller.rb.tt", "app/controllers/settings/ai_apis_controller.rb" end |
#copy_stimulus_controller ⇒ Object
20 21 22 |
# File 'lib/generators/ranked_llm/views/views_generator.rb', line 20 def copy_stimulus_controller copy_file "ranked_list_controller.js", "app/javascript/controllers/ranked_list_controller.js" end |
#copy_view ⇒ Object
16 17 18 |
# File 'lib/generators/ranked_llm/views/views_generator.rb', line 16 def copy_view template "index.html.erb.tt", "app/views/settings/ai_apis/index.html.erb" end |
#show_post_install_message ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/ranked_llm/views/views_generator.rb', line 24 def say "" say "Copied a starting-point settings controller/view/JS for ranked_llm.", :green say "Adjust the following before using it:", :yellow say " - `current_account` in app/controllers/settings/ai_apis_controller.rb — rename to whatever" say " your app's auth boundary actually calls the owner (current_team, current_user, ...)." say " - Restyle app/views/settings/ai_apis/index.html.erb to match this app's existing UI conventions —" say " these Tailwind classes are just a starting point." say " - Add a route, e.g.:" say " namespace :settings do" say " resources :ai_apis, only: [ :index, :create, :destroy ] do" say " patch :move, on: :member" say " end" say " end" say " - Register the Stimulus controller if this app doesn't auto-register app/javascript/controllers" say " (importmap-rails/Stimulus's default setup already does this)." say " - This view drags with SortableJS via the `ranked-list` Stimulus controller — make sure" say " the `sortablejs` package (or your import-mapped equivalent) is available." say "" end |