Class: Deepagents::Generators::ViewGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Deepagents::Generators::ViewGenerator
- Defined in:
- lib/generators/deepagents/view/view_generator.rb
Instance Method Summary collapse
- #create_javascript ⇒ Object
- #create_stylesheet ⇒ Object
- #create_views ⇒ Object
- #display_next_steps ⇒ Object
Instance Method Details
#create_javascript ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/deepagents/view/view_generator.rb', line 20 def create_javascript return if [:skip_javascript] template "javascript.js", "app/javascript/#{file_name}_chat.js" append_to_file "app/javascript/packs/application.js", <<~JS // DeepAgents #{class_name} Chat import "../#{file_name}_chat" JS end |
#create_stylesheet ⇒ Object
32 33 34 35 36 |
# File 'lib/generators/deepagents/view/view_generator.rb', line 32 def create_stylesheet return if [:skip_stylesheet] template "stylesheet.css", "app/assets/stylesheets/#{file_name}_chat.css" end |
#create_views ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/generators/deepagents/view/view_generator.rb', line 11 def create_views template "index.html.erb", "app/views/#{file_name.pluralize}/index.html.erb" template "show.html.erb", "app/views/#{file_name.pluralize}/show.html.erb" template "new.html.erb", "app/views/#{file_name.pluralize}/new.html.erb" template "_conversation.html.erb", "app/views/#{file_name.pluralize}/_conversation.html.erb" template "_message.html.erb", "app/views/#{file_name.pluralize}/_message.html.erb" template "_form.html.erb", "app/views/#{file_name.pluralize}/_form.html.erb" end |
#display_next_steps ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/generators/deepagents/view/view_generator.rb', line 38 def display_next_steps say "\n" say "DeepAgents UI views for #{file_name} have been created! 🎨", :green say "\n" say "Next steps:", :yellow say " 1. Ensure you have the required controller (use the controller generator if needed)" say " 2. Add the JavaScript to your application.js if using Webpacker" say " 3. Customize the views to match your application's design" say "\n" end |