From 9fffdc5cdb80b1824473a6d7ae1fedf9e74aa748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 18 Jan 2010 13:44:32 +0100 Subject: Generators load path now will be Ruby load path. If you want to use rspec:install generator, you need generators/rspec/install_generator in your load path. --- .../erb/scaffold/templates/_form.html.erb | 13 +++++++++++ .../erb/scaffold/templates/edit.html.erb | 6 +++++ .../erb/scaffold/templates/index.html.erb | 27 ++++++++++++++++++++++ .../erb/scaffold/templates/layout.html.erb | 14 +++++++++++ .../generators/erb/scaffold/templates/new.html.erb | 5 ++++ .../erb/scaffold/templates/show.html.erb | 10 ++++++++ 6 files changed, 75 insertions(+) create mode 100644 railties/lib/generators/erb/scaffold/templates/_form.html.erb create mode 100644 railties/lib/generators/erb/scaffold/templates/edit.html.erb create mode 100644 railties/lib/generators/erb/scaffold/templates/index.html.erb create mode 100644 railties/lib/generators/erb/scaffold/templates/layout.html.erb create mode 100644 railties/lib/generators/erb/scaffold/templates/new.html.erb create mode 100644 railties/lib/generators/erb/scaffold/templates/show.html.erb (limited to 'railties/lib/generators/erb/scaffold/templates') diff --git a/railties/lib/generators/erb/scaffold/templates/_form.html.erb b/railties/lib/generators/erb/scaffold/templates/_form.html.erb new file mode 100644 index 0000000000..9c19a09616 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/_form.html.erb @@ -0,0 +1,13 @@ +<%% form_for(@<%= singular_name %>) do |f| %> + <%%= f.error_messages %> + +<% for attribute in attributes -%> +
+ <%%= f.label :<%= attribute.name %> %>
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> +
+<% end -%> +
+ <%%= f.submit %> +
+<%% end %> diff --git a/railties/lib/generators/erb/scaffold/templates/edit.html.erb b/railties/lib/generators/erb/scaffold/templates/edit.html.erb new file mode 100644 index 0000000000..5bc507ffc8 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/edit.html.erb @@ -0,0 +1,6 @@ +

Editing <%= singular_name %>

+ +<%%= render 'form' %> + +<%%= link_to 'Show', @<%= singular_name %> %> | +<%%= link_to 'Back', <%= plural_name %>_path %> diff --git a/railties/lib/generators/erb/scaffold/templates/index.html.erb b/railties/lib/generators/erb/scaffold/templates/index.html.erb new file mode 100644 index 0000000000..b5c7fd1e58 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/index.html.erb @@ -0,0 +1,27 @@ +

Listing <%= plural_name %>

+ + + +<% for attribute in attributes -%> + +<% end -%> + + + + + +<%% @<%= plural_name %>.each do |<%= singular_name %>| %> + +<% for attribute in attributes -%> + +<% end -%> + + + + +<%% end %> +
<%= attribute.human_name %>
<%%= <%= singular_name %>.<%= attribute.name %> %><%%= link_to 'Show', <%= singular_name %> %><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %>
+ +
+ +<%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %> diff --git a/railties/lib/generators/erb/scaffold/templates/layout.html.erb b/railties/lib/generators/erb/scaffold/templates/layout.html.erb new file mode 100644 index 0000000000..7aa049fe80 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/layout.html.erb @@ -0,0 +1,14 @@ + + + + <%= controller_class_name %>: <%%= controller.action_name %> + <%%= stylesheet_link_tag 'scaffold' %> + + + +

<%%= notice %>

+ +<%%= yield %> + + + diff --git a/railties/lib/generators/erb/scaffold/templates/new.html.erb b/railties/lib/generators/erb/scaffold/templates/new.html.erb new file mode 100644 index 0000000000..9a1c489331 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/new.html.erb @@ -0,0 +1,5 @@ +

New <%= singular_name %>

+ +<%%= render 'form' %> + +<%%= link_to 'Back', <%= plural_name %>_path %> diff --git a/railties/lib/generators/erb/scaffold/templates/show.html.erb b/railties/lib/generators/erb/scaffold/templates/show.html.erb new file mode 100644 index 0000000000..24f13fc0f8 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/show.html.erb @@ -0,0 +1,10 @@ +<% for attribute in attributes -%> +

+ <%= attribute.human_name %>: + <%%= @<%= singular_name %>.<%= attribute.name %> %> +

+ +<% end -%> + +<%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> | +<%%= link_to 'Back', <%= plural_name %>_path %> -- cgit v1.2.3