Skip to content

Commit

Permalink
Fix scaffolding with sidebar flag (#209)
Browse files Browse the repository at this point in the history
* Fix scaffolding with sidebar flag

* fix the wording to match the option

---------

Co-authored-by: Jeremy Green <[email protected]>
  • Loading branch information
gazayas and jagthedrummer authored Aug 21, 2023
1 parent 9dc69f0 commit 9b90551
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bullet_train-super_scaffolding/lib/scaffolding/transformer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1602,14 +1602,24 @@ def scaffold_crud(attributes)

if top_level_model?
icon_name = nil
if cli_options["sidebar"].present?
icon_name = cli_options["sidebar"]
if cli_options["navbar"].present?
icon_name = if cli_options["navbar"].match?(/^ti/)
"ti #{cli_options["navbar"]}"
elsif cli_options["navbar"].match?(/^fa/)
"fal #{cli_options["navbar"]}"
else
puts ""
puts "'#{cli_options["navbar"]}' is not a valid icon.".red
puts "Please refer to the Themify or Font Awesome documentation and pass the value like so:"
puts "--navbar=\"ti-world\""
exit
end
else
puts ""
# TODO: Update this help text letting developers know they can Super Scaffold
# models without a parent after the `--skip-parent` logic is implemented.
puts "Hey, models that are scoped directly off of a Team are eligible to be added to the navbar."
puts "Do you want to add this resource to the sidebar menu? (y/N)"
puts "Do you want to add this resource to the navbar menu? (y/N)"
response = $stdin.gets.chomp
if response.downcase[0] == "y"
puts ""
Expand Down

0 comments on commit 9b90551

Please sign in to comment.