From 90a90dff4a0d9f521ae6b353f362201004ecf25b Mon Sep 17 00:00:00 2001 From: Jeff Kreeftmeijer Date: Tue, 15 Jun 2010 06:18:20 +0200 Subject: [PATCH 1/2] Removed the index links from the generator's view templates when using the --singleton option. [#4863] --- .../erb/scaffold/templates/edit.html.erb | 6 ++++-- .../generators/erb/scaffold/templates/new.html.erb | 3 ++- .../erb/scaffold/templates/show.html.erb | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb index e58b9fb..115e387 100644 --- a/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb @@ -2,5 +2,7 @@ <%%= render 'form' %> -<%%= link_to 'Show', @<%= singular_table_name %> %> | -<%%= link_to 'Back', <%= index_helper %>_path %> +<%%= link_to 'Show', @<%= singular_table_name %> %> +<% unless options[:singleton] -%> +| <%%= link_to 'Back', <%= index_helper %>_path %> +<% end -%> diff --git a/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb index 02ae4d0..acd9464 100644 --- a/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb @@ -1,5 +1,6 @@

New <%= singular_table_name %>

<%%= render 'form' %> - +<% unless options[:singleton] -%> <%%= link_to 'Back', <%= index_helper %>_path %> +<% end -%> diff --git a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb index c0e5ccf..5d6ece5 100644 --- a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb @@ -8,5 +8,7 @@ <% end -%> -<%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> | -<%%= link_to 'Back', <%= index_helper %>_path %> +<%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> +<% unless options[:singleton] -%> +| <%%= link_to 'Back', <%= index_helper %>_path %> +<% end -%> -- 1.7.0.4