提交 bc6f0d2f 编写于 作者: D David Heinemeier Hansson

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

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5565 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 02adc49d
<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>
......
......@@ -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(
......
<!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>
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%;
}
<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>
......
<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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册