diff options
Diffstat (limited to 'actionpack/lib/action_controller/templates')
11 files changed, 182 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml new file mode 100644 index 0000000000..f1b4a2a1dd --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml @@ -0,0 +1,28 @@ +<% + base_dir = File.expand_path(File.dirname(__FILE__)) + + request_parameters_without_action = @request.parameters.clone + request_parameters_without_action.delete("action") + request_parameters_without_action.delete("controller") + + request_dump = request_parameters_without_action.inspect.gsub(/,/, ",\n") + session_dump = @request.session.instance_variable_get("@data").inspect.gsub(/,/, ",\n") + response_dump = @response.inspect.gsub(/,/, ",\n") + + template_assigns = @response.template.instance_variable_get("@assigns") + %w( response exception template session request template_root template_class url ignore_missing_templates logger cookies headers params ).each { |t| template_assigns.delete(t) } + template_dump = template_assigns.inspect.gsub(/,/, ",\n") +%> + +<h2 style="margin-top: 30px">Request</h2> +<p><b>Parameters</b>: <%=h request_dump == "{}" ? "None" : request_dump %></p> + +<p><a href="#" onclick="document.getElementById('session_dump').style.display='block'; return false;">Show session dump</a></p> +<div id="session_dump" style="display:none"><%= debug(@request.session.instance_variable_get("@data")) %></div> + + +<h2 style="margin-top: 30px">Response</h2> +<b>Headers</b>: <%=h @response.headers.inspect.gsub(/,/, ",\n") %><br/> + +<p><a href="#" onclick="document.getElementById('template_dump').style.display='block'; return false;">Show template parameters</a></p> +<div id="template_dump" style="display:none"><%= debug(template_assigns) %></div> diff --git a/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml b/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml new file mode 100644 index 0000000000..4eb1ed0439 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml @@ -0,0 +1,22 @@ +<% + base_dir = File.expand_path(File.dirname(__FILE__)) + + clean_backtrace = @exception.backtrace.collect { |line| line.gsub(base_dir, "").gsub("/../config/environments/../../", "") } + app_trace = clean_backtrace.reject { |line| line[0..6] == "vendor/" || line.include?("dispatch.cgi") } + framework_trace = clean_backtrace - app_trace +%> + +<h1> + <%=h @exception.class.to_s %> in + <%=h @request.parameters["controller"].capitalize %>#<%=h @request.parameters["action"] %> +</h1> +<p><%=h @exception.message %></p> + +<% unless app_trace.empty? %><pre><code><%=h app_trace.collect { |line| line.gsub("/../", "") }.join("\n") %></code></pre><% end %> + +<% unless framework_trace.empty? %> + <a href="#" onclick="document.getElementById('framework_trace').style.display='block'; return false;">Show framework trace</a> + <pre id="framework_trace" style="display:none"><code><%=h framework_trace.join("\n") %></code></pre> +<% end %> + +<%= render_file(@rescues_path + "/_request_and_response.rhtml", false) %> diff --git a/actionpack/lib/action_controller/templates/rescues/layout.rhtml b/actionpack/lib/action_controller/templates/rescues/layout.rhtml new file mode 100644 index 0000000000..d38f3e67f9 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/layout.rhtml @@ -0,0 +1,29 @@ +<html> +<head> + <title>Action Controller: Exception caught</title> + <style> + 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; } + </style> +</head> +<body> + +<%= @contents %> + +</body> +</html>
\ No newline at end of file diff --git a/actionpack/lib/action_controller/templates/rescues/missing_template.rhtml b/actionpack/lib/action_controller/templates/rescues/missing_template.rhtml new file mode 100644 index 0000000000..dbfdf76947 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/missing_template.rhtml @@ -0,0 +1,2 @@ +<h1>Template is missing</h1> +<p><%=h @exception.message %></p> diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.rhtml b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml new file mode 100644 index 0000000000..326fd0b057 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml @@ -0,0 +1,26 @@ +<% + base_dir = File.expand_path(File.dirname(__FILE__)) + + framework_trace = @exception.original_exception.backtrace.collect do |line| + line.gsub(base_dir, "").gsub("/../config/environments/../../", "") + end +%> + +<h1> + <%=h @exception.original_exception.class.to_s %> in + <%=h @request.parameters["controller"].capitalize %>#<%=h @request.parameters["action"] %> +</h1> + +<p> + Showing <i><%=h @exception.file_name %></i> where line <b>#<%=h @exception.line_number %></b> raised + <u><%=h @exception.message %></u> +</p> + +<pre><code><%=h @exception.source_extract %></code></pre> + +<p><%=h @exception.sub_template_message %></p> + +<a href="#" onclick="document.getElementById('framework_trace').style.display='block'">Show template trace</a> +<pre id="framework_trace" style="display:none"><code><%=h framework_trace.join("\n") %></code></pre> + +<%= render_file(@rescues_path + "/_request_and_response.rhtml", false) %> diff --git a/actionpack/lib/action_controller/templates/rescues/unknown_action.rhtml b/actionpack/lib/action_controller/templates/rescues/unknown_action.rhtml new file mode 100644 index 0000000000..683379da10 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/unknown_action.rhtml @@ -0,0 +1,2 @@ +<h1>Unknown action</h1> +<p><%=h @exception.message %></p> diff --git a/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml b/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml new file mode 100644 index 0000000000..1c7f4d9770 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml @@ -0,0 +1,6 @@ +<h1>Editing <%= @scaffold_singular_name %></h1> + +<%= form(@scaffold_singular_name, :action => "../update" + @scaffold_suffix) %> + +<%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => instance_variable_get("@#{@scaffold_singular_name}").id %> | +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %> diff --git a/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml b/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml new file mode 100644 index 0000000000..511054abe8 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml @@ -0,0 +1,29 @@ +<html> +<head> + <title>Scaffolding</title> + <style> + 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; } + </style> +</head> +<body> + +<%= @content_for_layout %> + +</body> +</html>
\ No newline at end of file diff --git a/actionpack/lib/action_controller/templates/scaffolds/list.rhtml b/actionpack/lib/action_controller/templates/scaffolds/list.rhtml new file mode 100644 index 0000000000..33af7079b2 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/list.rhtml @@ -0,0 +1,24 @@ +<h1>Listing <%= @scaffold_plural_name %></h1> + +<table> + <tr> + <% for column in @scaffold_class.content_columns %> + <th><%= column.human_name %></th> + <% end %> + </tr> + +<% for entry in instance_variable_get("@#{@scaffold_plural_name}") %> + <tr> + <% for column in @scaffold_class.content_columns %> + <td><%= entry.send(column.name) %></td> + <% end %> + <td><%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => entry.id %></td> + <td><%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => entry.id %></td> + <td><%= link_to "Destroy", :action => "destroy#{@scaffold_suffix}", :id => entry.id %></td> + </tr> +<% end %> +</table> + +<br /> + +<%= link_to "New #{@scaffold_singular_name}", :action => "new#{@scaffold_suffix}" %> diff --git a/actionpack/lib/action_controller/templates/scaffolds/new.rhtml b/actionpack/lib/action_controller/templates/scaffolds/new.rhtml new file mode 100644 index 0000000000..02f52e72f5 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/new.rhtml @@ -0,0 +1,5 @@ +<h1>New <%= @scaffold_singular_name %></h1> + +<%= form(@scaffold_singular_name, :action => "create" + @scaffold_suffix) %> + +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %>
\ No newline at end of file diff --git a/actionpack/lib/action_controller/templates/scaffolds/show.rhtml b/actionpack/lib/action_controller/templates/scaffolds/show.rhtml new file mode 100644 index 0000000000..10c46342fd --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/show.rhtml @@ -0,0 +1,9 @@ +<% for column in @scaffold_class.content_columns %> + <p> + <b><%= column.human_name %>:</b> + <%= instance_variable_get("@#{@scaffold_singular_name}").send(column.name) %> + </p> +<% end %> + +<%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => instance_variable_get("@#{@scaffold_singular_name}").id %> | +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %> |