Skip to content
Browse files

Scaffold resource should have both a layout and a stylesheet [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5566 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 97d9dca commit 9ba96771c3c4d57ecc2485b55dcc7680b2ca6a15 @dhh dhh committed Nov 19, 2006
View
6 railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml
@@ -1,5 +1,9 @@
-<html>
+<!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>
View
4 ...ib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb
@@ -46,6 +46,10 @@ def manifest
)
end
+ # Layout and stylesheet.
+ m.template('layout.rhtml', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.rhtml"))
+ m.template('style.css', 'public/stylesheets/scaffold.css')
+
m.template('model.rb', File.join('app/models', class_path, "#{file_name}.rb"))
m.template(
View
17 railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml
@@ -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>
View
74 railties/lib/rails_generator/generators/components/scaffold_resource/templates/style.css
@@ -0,0 +1,74 @@
+body { background-color: #fff; color: #333; }
+
+body, p, ol, ul, td {
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px;
+}
+
+pre {
+ background-color: #eee;
+ padding: 10px;
+ font-size: 11px;
+}
+
+a { color: #000; }
+a:visited { color: #666; }
+a:hover { color: #fff; background-color:#000; }
+
+.fieldWithErrors {
+ padding: 2px;
+ background-color: red;
+ display: table;
+}
+
+#errorExplanation {
+ width: 400px;
+ border: 2px solid red;
+ padding: 7px;
+ padding-bottom: 12px;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+}
+
+#errorExplanation h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 5px 5px 15px;
+ font-size: 12px;
+ margin: -7px;
+ background-color: #c00;
+ color: #fff;
+}
+
+#errorExplanation p {
+ color: #333;
+ margin-bottom: 0;
+ padding: 5px;
+}
+
+#errorExplanation ul li {
+ font-size: 12px;
+ list-style: square;
+}
+
+div.uploadStatus {
+ margin: 5px;
+}
+
+div.progressBar {
+ margin: 5px;
+}
+
+div.progressBar div.border {
+ background-color: #fff;
+ border: 1px solid grey;
+ width: 100%;
+}
+
+div.progressBar div.background {
+ background-color: #333;
+ height: 18px;
+ width: 0%;
+}
+
View
2 ...ies/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml
@@ -1,5 +1,7 @@
<h1>Editing <%= singular_name %></h1>
+<%%= error_messages_for :<%= singular_name %> %>
+
<%% form_for(:<%= singular_name %>, :url => <%= singular_name %>_path(@<%= singular_name %>), :html => { :method => :put }) do |f| %>
<% for attribute in attributes -%>
<p>
View
2 ...ties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.rhtml
@@ -1,5 +1,7 @@
<h1>New <%= singular_name %></h1>
+<%%= error_messages_for :<%= singular_name %> %>
+
<%% form_for(:<%= singular_name %>, :url => <%= plural_name %>_path) do |f| %>
<% for attribute in attributes -%>
<p>

0 comments on commit 9ba9677

Please sign in to comment.
Something went wrong with that request. Please try again.