diff options
Diffstat (limited to 'railties/lib/generators/erb/scaffold/templates')
5 files changed, 86 insertions, 0 deletions
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..cca1d61c68 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/edit.html.erb @@ -0,0 +1,18 @@ +<h1>Editing <%= singular_name %></h1> + +<%% form_for(@<%= singular_name %>) do |f| %> + <%%= f.error_messages %> + +<% for attribute in attributes -%> + <p> + <%%= f.label :<%= attribute.name %> %><br /> + <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> + </p> +<% end -%> + <p> + <%%= f.submit 'Update' %> + </p> +<%% end %> + +<%%= link_to 'Show', @<%= singular_name %> %> | +<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file 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..427ff81e03 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/index.html.erb @@ -0,0 +1,24 @@ +<h1>Listing <%= plural_name %></h1> + +<table> + <tr> +<% for attribute in attributes -%> + <th><%= attribute.human_name %></th> +<% end -%> + </tr> + +<%% @<%= plural_name %>.each do |<%= singular_name %>| %> + <tr> +<% for attribute in attributes -%> + <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td> +<% end -%> + <td><%%= link_to 'Show', <%= singular_name %> %></td> + <td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td> + <td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td> + </tr> +<%% end %> +</table> + +<br /> + +<%%= 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..ebc97f8130 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/layout.html.erb @@ -0,0 +1,17 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> + <title><%= controller_class_name %>: <%%= controller.action_name %></title> + <%%= stylesheet_link_tag 'scaffold' %> +</head> +<body> + +<p style="color: green"><%%= flash[:notice] %></p> + +<%%= yield %> + +</body> +</html> 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..96c89fc50e --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/new.html.erb @@ -0,0 +1,17 @@ +<h1>New <%= singular_name %></h1> + +<%% form_for(@<%= singular_name %>) do |f| %> + <%%= f.error_messages %> + +<% for attribute in attributes -%> + <p> + <%%= f.label :<%= attribute.name %> %><br /> + <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> + </p> +<% end -%> + <p> + <%%= f.submit 'Create' %> + </p> +<%% end %> + +<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file 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..adecaf70c6 --- /dev/null +++ b/railties/lib/generators/erb/scaffold/templates/show.html.erb @@ -0,0 +1,10 @@ +<% for attribute in attributes -%> +<p> + <b><%= attribute.column.human_name %>:</b> + <%%=h @<%= singular_name %>.<%= attribute.name %> %> +</p> + +<% end -%> + +<%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> | +<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file |