recipes/navigation.rb in rails_apps_composer-1.0.17 vs recipes/navigation.rb in rails_apps_composer-1.0.18

- old
+ new

@@ -2,28 +2,73 @@ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/navigation.rb after_bundler do say_wizard "Navigation recipe running 'after bundler'" + + if recipes.include? 'devise' + # Create navigation links for Devise + if recipes.include? 'haml' + # There is Haml code in this script. Changing the indentation is perilous between HAMLs. + # We have to use single-quote-style-heredoc to avoid interpolation. + create_file "app/views/shared/_navigation.html.haml" do <<-'HAML' +- if user_signed_in? + %li + = link_to('Logout', destroy_user_session_path, :method=>'delete') +- else + %li + = link_to('Login', new_user_session_path) +- if user_signed_in? + %li + = link_to('Edit account', edit_user_registration_path) +- else + %li + = link_to('Sign up', new_user_registration_path) +HAML + end + else + create_file "app/views/shared/_navigation.html.erb" do <<-ERB +<% if user_signed_in? %> + <li> + <%= link_to('Logout', destroy_user_session_path, :method=>'delete') %> + </li> +<% else %> + <li> + <%= link_to('Login', new_user_session_path) %> + </li> +<% end %> +<% if user_signed_in? %> + <li> + <%= link_to('Edit account', edit_user_registration_path) %> + </li> +<% else %> + <li> + <%= link_to('Sign up', new_user_registration_path) %> + </li> +<% end %> +ERB + end + end - # Create navigation links - if recipes.include? 'haml' - # There is Haml code in this script. Changing the indentation is perilous between HAMLs. - # We have to use single-quote-style-heredoc to avoid interpolation. - create_file "app/views/shared/_navigation.html.haml" do <<-'HAML' + else + # Create navigation links + if recipes.include? 'haml' + # There is Haml code in this script. Changing the indentation is perilous between HAMLs. + # We have to use single-quote-style-heredoc to avoid interpolation. + create_file "app/views/shared/_navigation.html.haml" do <<-'HAML' - if user_signed_in? %li Logged in as #{current_user.name} %li = link_to('Logout', signout_path) - else %li = link_to('Login', signin_path) HAML - end - else - create_file "app/views/shared/_navigation.html.erb" do <<-ERB + end + else + create_file "app/views/shared/_navigation.html.erb" do <<-ERB <% if user_signed_in? %> <li> Logged in as <%= current_user.name %> </li> <li> @@ -33,9 +78,10 @@ <li> <%= link_to('Login', signin_path) %> </li> <% end %> ERB + end end end # Add navigation links to the default application layout if recipes.include? 'html5'